From nobody Sat May 30 20:12:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1776852710; cv=none; d=zohomail.com; s=zohoarc; b=awbY8iq8RXWN9ZXGzcb+GiZjzGr4J1IOghLexvrUlo/dIgUthOo8sreOySlKKzlcqnxAc6ldgOA9Z8BWdeQ1GOsviWisNOJkxLCYN1N8YhJlgZwH+gW5a669xgTW7ba+FIwUkrIL8eRuO9JkmGoaBSOaflzth33dyu+H4DRT53g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776852710; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=SFHYYol3fQLtpVQaYQnNjnL8iJcFReh9WH604Hh8s60=; b=CTY7lJgsfcK2UqhEtl8d4chSEvqsZwgBJy3CNx6+CLq9DvbzPJTxZonfWCyvOG33MydMywWvaxSSV0V2S2Q98V+S9aykEXcilw3JgMjc6Fmbub1QzSnVqGRWWu6nt2c5YAsa9BhqNa5q1vWVT+YT78t1FkIWyZJhJCTCzyjb9yc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776852710796362.14441936264063; Wed, 22 Apr 2026 03:11:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wFUY3-0006z5-4Z; Wed, 22 Apr 2026 06:11:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wFUXj-0006pE-ST for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:10:53 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wFUXg-0000hj-1y for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:10:51 -0400 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-488b8bc6bc9so37090485e9.3 for ; Wed, 22 Apr 2026 03:10:47 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488fc1cfbf2sm452139945e9.15.2026.04.22.03.10.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 03:10:44 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 835395F941; Wed, 22 Apr 2026 11:10:43 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1776852646; x=1777457446; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SFHYYol3fQLtpVQaYQnNjnL8iJcFReh9WH604Hh8s60=; b=Qp3iL1rBjv7GAXds3xNF58e1E92dkHl8e11CE67ccsvj4ymUiZYhlJ8nmU+sfh66yT VDctwdkU8XxfyqjQ46y0e5x6OC9BKoNG50J10CdlUYHhufwsTg2pNHa7FzVD5Xekxg2K 4CvOTVLB8d3GYANwnOI9uDqxqFLfrkHKVtHJbdNbf7trAeMrRZAKlvTd6YTAaChLM+VA /QPk5pD0KwCpvPek2M3mUWSJynJuqmLUmrVv3+HFW12GrZ6IEWERe19J/Tl8ajU3wegb f2z7UYgyX0XItap0kgnbOszzhZTuPHf8iZnWqD4NYnLg9y5UU65BZa5Nk4R0SW64Xbx6 kW7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776852646; x=1777457446; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=SFHYYol3fQLtpVQaYQnNjnL8iJcFReh9WH604Hh8s60=; b=ppG47tw+HvDGkg53aIKiFKk9HXx7/TavjAJ+ZMJaryPq6xhHrvLiHRsK6ajErWuPUW AV7XiNJMQIK3Z51gZ3en8kPHHnRZ97V3iLXccCBZkdyxLAIP9H08b3wbTZ9bE6Iv4EXG 5YXcmXCVAfpSlU2SZJEXlaCp4wlumzQA3yL1VI70ju8r1Fl/VvXTdp5OcCAB2Nmx1CGQ DznNLJTP+Xv1elPtSKk9Rrju4ualcAEjh/YDL18NzaFdilboKmgzQHe7fiyii9tCvFxO 037i8Q00ST7Lvb2GH1w7Y/n7jMvXx37YacQFG3FQiRfJmlGrZ55wK/yxV7+2+62QjEOk Kb+A== X-Gm-Message-State: AOJu0YxjGWpaRdr5JpQneLJIFrPXM9UUSq5S1O924W6zuR2pEeaWQ9MF soR1cjwhGVrPTdWS2G/T5KIkFUKQJH6Ue+uIXjB7ce89m7iipgyeFOnheh4PuvIdrBQ= X-Gm-Gg: AeBDies8vPs1+i1ZlkwYPOC2iEuv2RKqTX2MPneusU//CHacv1ttmd1P8aj94OIa9xb 46lCcWo1xuUmhjrl8dX47wMtmsoDhm5jjzn8pKjyJj8YeppNqdSiyQ6mubrflVWMyL1n/acESEL i05z8pc7C96nnutIs8wQxxvjHtZ3V7xSNPCcoM7ROjeTuCK4mw5dYlsJxZyTzkZJfS3dg7Pu4xt ArPHqF3rhwe8ZyaxGX46MLgFw4sf0BfucOO555XVxDjn0KM+witWGjRCttQUeMvSOUDn2/r+NoN urKljLhC2dcj8rod4yOXmEu+MGEvdLUwqzmMfK/QtgSmD33w3Ka7VLXqPxwtELJ83ZRRuinXL+y DiBy8as6EYzcexPSmTJQWrQ1M4wG5vJXRCjoLG0BrQaESwHnnBYwuY0r6QuscZVNgW/lsr2406s TTyKAzSHEpMmDJ63om6bJz4oqEzSjtGcckNQ== X-Received: by 2002:a05:600c:a103:b0:48a:58e1:6d17 with SMTP id 5b1f17b1804b1-48a58e16ee0mr46804155e9.20.1776852645643; Wed, 22 Apr 2026 03:10:45 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , Mohamed Mediouni , kvm@vger.kernel.org, Pedro Barbuda , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Subject: [PATCH v2 01/31] target/arm: migrate basic syndrome helpers to registerfields Date: Wed, 22 Apr 2026 11:10:12 +0100 Message-ID: <20260422101043.1234229-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260422101043.1234229-1-alex.bennee@linaro.org> References: <20260422101043.1234229-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x330.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1776852711293158500 We have a registerfields interface which we can use for defining fields alongside helpers to access them. Define the basic syndrome layout and convert the helpers that take the imm16 data directly. Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e --- target/arm/syndrome.h | 75 ++++++++++++++++++++++++++++++++----------- 1 file changed, 57 insertions(+), 18 deletions(-) diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h index bff61f052cc..517fb2368bc 100644 --- a/target/arm/syndrome.h +++ b/target/arm/syndrome.h @@ -25,7 +25,7 @@ #ifndef TARGET_ARM_SYNDROME_H #define TARGET_ARM_SYNDROME_H =20 -#include "qemu/bitops.h" +#include "hw/core/registerfields.h" =20 /* Valid Syndrome Register EC field values */ enum arm_exception_class { @@ -76,6 +76,11 @@ enum arm_exception_class { EC_AA64_BKPT =3D 0x3c, }; =20 +/* Generic syndrome encoding layout for HSR and lower 32 bits of ESR_EL2 */ +FIELD(SYNDROME, EC, 26, 6) +FIELD(SYNDROME, IL, 25, 1) +FIELD(SYNDROME, ISS, 0, 25) + typedef enum { SME_ET_AccessTrap, SME_ET_Streaming, @@ -113,12 +118,12 @@ typedef enum { =20 static inline uint32_t syn_get_ec(uint32_t syn) { - return syn >> ARM_EL_EC_SHIFT; + return FIELD_EX32(syn, SYNDROME, EC); } =20 static inline uint32_t syn_set_ec(uint32_t syn, uint32_t ec) { - return deposit32(syn, ARM_EL_EC_SHIFT, ARM_EL_EC_LENGTH, ec); + return FIELD_DP32(syn, SYNDROME, EC, ec); } =20 /* @@ -133,49 +138,74 @@ static inline uint32_t syn_set_ec(uint32_t syn, uint3= 2_t ec) */ static inline uint32_t syn_uncategorized(void) { - return (EC_UNCATEGORIZED << ARM_EL_EC_SHIFT) | ARM_EL_IL; + uint32_t res =3D syn_set_ec(0, EC_UNCATEGORIZED); + res =3D FIELD_DP32(res, SYNDROME, IL, 1); + return res; } =20 +FIELD(ISS_IMM16, IMM16, 0, 16) + static inline uint32_t syn_aa64_svc(uint32_t imm16) { - return (EC_AA64_SVC << ARM_EL_EC_SHIFT) | ARM_EL_IL | (imm16 & 0xffff); + uint32_t res =3D syn_set_ec(0, EC_AA64_SVC); + res =3D FIELD_DP32(res, SYNDROME, IL, 1); + res =3D FIELD_DP32(res, ISS_IMM16, IMM16, imm16); + return res; } =20 static inline uint32_t syn_aa64_hvc(uint32_t imm16) { - return (EC_AA64_HVC << ARM_EL_EC_SHIFT) | ARM_EL_IL | (imm16 & 0xffff); + uint32_t res =3D syn_set_ec(0, EC_AA64_HVC); + res =3D FIELD_DP32(res, SYNDROME, IL, 1); + res =3D FIELD_DP32(res, ISS_IMM16, IMM16, imm16); + return res; } =20 static inline uint32_t syn_aa64_smc(uint32_t imm16) { - return (EC_AA64_SMC << ARM_EL_EC_SHIFT) | ARM_EL_IL | (imm16 & 0xffff); + uint32_t res =3D syn_set_ec(0, EC_AA64_SMC); + res =3D FIELD_DP32(res, SYNDROME, IL, 1); + res =3D FIELD_DP32(res, ISS_IMM16, IMM16, imm16); + return res; } =20 static inline uint32_t syn_aa32_svc(uint32_t imm16, bool is_16bit) { - return (EC_AA32_SVC << ARM_EL_EC_SHIFT) | (imm16 & 0xffff) - | (is_16bit ? 0 : ARM_EL_IL); + uint32_t res =3D syn_set_ec(0, EC_AA32_SVC); + res =3D FIELD_DP32(res, SYNDROME, IL, is_16bit ? 0 : 1); + res =3D FIELD_DP32(res, ISS_IMM16, IMM16, imm16); + return res; } =20 static inline uint32_t syn_aa32_hvc(uint32_t imm16) { - return (EC_AA32_HVC << ARM_EL_EC_SHIFT) | ARM_EL_IL | (imm16 & 0xffff); + uint32_t res =3D syn_set_ec(0, EC_AA32_HVC); + res =3D FIELD_DP32(res, SYNDROME, IL, 1); + res =3D FIELD_DP32(res, ISS_IMM16, IMM16, imm16); + return res; } =20 static inline uint32_t syn_aa32_smc(void) { - return (EC_AA32_SMC << ARM_EL_EC_SHIFT) | ARM_EL_IL; + uint32_t res =3D syn_set_ec(0, EC_AA32_SMC); + res =3D FIELD_DP32(res, SYNDROME, IL, 1); + return res; } =20 static inline uint32_t syn_aa64_bkpt(uint32_t imm16) { - return (EC_AA64_BKPT << ARM_EL_EC_SHIFT) | ARM_EL_IL | (imm16 & 0xffff= ); + uint32_t res =3D syn_set_ec(0, EC_AA64_BKPT); + res =3D FIELD_DP32(res, SYNDROME, IL, 1); + res =3D FIELD_DP32(res, ISS_IMM16, IMM16, imm16); + return res; } =20 static inline uint32_t syn_aa32_bkpt(uint32_t imm16, bool is_16bit) { - return (EC_AA32_BKPT << ARM_EL_EC_SHIFT) | (imm16 & 0xffff) - | (is_16bit ? 0 : ARM_EL_IL); + uint32_t res =3D syn_set_ec(0, EC_AA32_BKPT); + res =3D FIELD_DP32(res, SYNDROME, IL, is_16bit ? 0 : 1); + res =3D FIELD_DP32(res, ISS_IMM16, IMM16, imm16); + return res; } =20 static inline uint32_t syn_aa64_sysregtrap(int op0, int op1, int op2, @@ -246,7 +276,9 @@ static inline uint32_t syn_simd_access_trap(int cv, int= cond, bool is_16bit) =20 static inline uint32_t syn_sve_access_trap(void) { - return (EC_SVEACCESSTRAP << ARM_EL_EC_SHIFT) | ARM_EL_IL; + uint32_t res =3D syn_set_ec(0, EC_SVEACCESSTRAP); + res =3D FIELD_DP32(res, SYNDROME, IL, 1); + return res; } =20 /* @@ -361,12 +393,16 @@ static inline uint32_t syn_wfx(int cv, int cond, int = ti, bool is_16bit) =20 static inline uint32_t syn_illegalstate(void) { - return (EC_ILLEGALSTATE << ARM_EL_EC_SHIFT) | ARM_EL_IL; + uint32_t res =3D syn_set_ec(0, EC_ILLEGALSTATE); + res =3D FIELD_DP32(res, SYNDROME, IL, 1); + return res; } =20 static inline uint32_t syn_pcalignment(void) { - return (EC_PCALIGNMENT << ARM_EL_EC_SHIFT) | ARM_EL_IL; + uint32_t res =3D syn_set_ec(0, EC_PCALIGNMENT); + res =3D FIELD_DP32(res, SYNDROME, IL, 1); + return res; } =20 static inline uint32_t syn_gcs_data_check(GCSInstructionType it, int rn) @@ -388,7 +424,10 @@ static inline uint32_t syn_gcs_gcsstr(int ra, int rn) =20 static inline uint32_t syn_serror(uint32_t extra) { - return (EC_SERROR << ARM_EL_EC_SHIFT) | ARM_EL_IL | extra; + uint32_t res =3D syn_set_ec(0, EC_SERROR); + res =3D FIELD_DP32(res, SYNDROME, IL, 1); + res =3D FIELD_DP32(res, SYNDROME, ISS, extra); + return res; } =20 static inline uint32_t syn_mop(bool is_set, bool is_setg, int options, --=20 2.47.3 From nobody Sat May 30 20:12:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1776852771; cv=none; d=zohomail.com; s=zohoarc; b=lGwiLAAQH1i++pj3d6n//CoO6P+lYqFqxs0xa5wC/uhaQdFZqAmnXBgbvCXt7jBByNg4unujkqF4I9pPmB2CLf10zvTaVT0EN1XHKrktB0LtYbq6zDjntES/Ac/rGCjFNvLisDVFJXnOt4Mc3M9Zj05cEGQV8UUdzgIjHvzuF1I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776852771; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=FHkkfCdnBgFoOnCKUMnFf3OjHIWwkdSWF2yGrdtfKkY=; b=Y22ELkGRi2baI90KrZTZUrXfQmfntfS6B04YZUMCeo/qRbU0lopO4Oeu1uOm3KmEpOCEZmqE0ZFYVJtEELX2+CF1FLmTihw2KEYmnD5o/P1zzezRHVJqeo924HpsWH4t/AfxLdQwDmC/B+yvVPW5n+I5Aa+ZX24old2QFFQJZsc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776852771728911.3884557165172; Wed, 22 Apr 2026 03:12:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wFUXw-0006xi-Qm; Wed, 22 Apr 2026 06:11:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wFUXj-0006pF-T2 for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:10:53 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wFUXg-0000hr-3T for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:10:51 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-488ab2db91aso69716885e9.3 for ; Wed, 22 Apr 2026 03:10:47 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-489fec8f7cbsm172089085e9.11.2026.04.22.03.10.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 03:10:44 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 965785F943; Wed, 22 Apr 2026 11:10:43 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1776852646; x=1777457446; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FHkkfCdnBgFoOnCKUMnFf3OjHIWwkdSWF2yGrdtfKkY=; b=vEdhRZlisdyk1WKoTA6jSmUJG1Di6AlMdLF321nRbMhPaamRkytbtqNot14nb+Sy2Z 7WG3rZjF5dfnvKiu/Sw3TQi2ORsGD7Ua0/FDTqLa8I8AQKyr5wfSE5pWzPWR+J4K1271 FypAAy3Tu0OlrsZ8KUbkurIKgZZYn/ylV/9Q9hjzx4+/RGkm4MhC/6zwgBo408oMht49 8ANg76EOje1SQyb6nUUWkCHeDH0/vyDWPMhQ9s07JQo3R3VIYaElfb57YtDKjKfZF06R PCUT1hBB6knVwbEpnlVodBHkj18/0kjNhqPGKFHheRmpzAWbwB7s4Ikn5AM2+mbMAEN4 c4Pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776852646; x=1777457446; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=FHkkfCdnBgFoOnCKUMnFf3OjHIWwkdSWF2yGrdtfKkY=; b=pdLaj8YotqWc4lOInG38sSORe3BCxZOvTiODQWmJrq9glpPsatN+Kl6wiftcBleHnV KnptHjtbmal92/0v9QcJ9eK+DbaczX5qgSsSZCkATftLJ/pB1iDWlzOeT/m8+tLdWJwN eI+2gg8rhgAjxqGX6o+qvY9VeUrMR88kDDTXKDSNnFR+nUBLZnNunFS0It2wO6UTzP6v rnWws+ay/UO5L+9k2TCM3lnGgctXUDLP8x/xYl7ZLL3CzvNwFpMvFpfYoB7YTik7Ix3T X4bEHLGmVafsVWX8ayIraWzpQe2blNEAooqcBxDb7UhMbEgk5qhelGK4Sap9mrggNS6F I0wQ== X-Gm-Message-State: AOJu0YwTYHkY99bW4dyWaUD8nMdAlagTGk92SyJWUgwLz4peKIv8cHbm PwrTdUQeys0j/Sq5MJBnu5iBo9itHGb/n4wqMhSms1sWhAGexBNnkjkG6m7h4V2DpBwPMjM0Quv LxGk1ny0= X-Gm-Gg: AeBDietM5j+IXkyl0ISHGWxSjfIUDWCu9hSJPdu1v0Jg/7LJYgSwTSWxQoA9S7ZF3Bl ektvypyGWAdG4mf3gUzyBGq6z37vokH6gqBIc2HeV+5EeIvxLUHpckaDYm8viefzDu8kWj8MbFL KWBxFyngaNe2akYn/bxnW8ieVA44g65tLNIrk5uVormTL/e6YCvSZvnMVdPPSU+WBGEbfYxM08T TX6IkKOKo4q9edqfAzCy/FMwDOh6I0oEvMuMVigkmN8hTON+30xbo4fSnENsk9+CutxI7qhHNGo Mmwk6tmzb2RrlUDw/pdJruCCyaRyeSwMV6FNBpFv5R3FbTvgHyfsArEFii1o8tzXtGYpNY76zDb UOJYckHYTU9x4yTWoiQfDXNTUkG9xJTIXJBoDTxtp/vCL9ZPGDZqoWqfwgQq8BA0L90sGdJIu0U Dx7BUdO6gRzjJs/pdstlX3uTcYQgQrL2XCsQ== X-Received: by 2002:a05:600c:4e8f:b0:48a:56cd:5266 with SMTP id 5b1f17b1804b1-48a56cd549bmr77005405e9.4.1776852646131; Wed, 22 Apr 2026 03:10:46 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , Mohamed Mediouni , kvm@vger.kernel.org, Pedro Barbuda , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Subject: [PATCH v2 02/31] target/arm: migrate system/cp trap syndromes to registerfields Date: Wed, 22 Apr 2026 11:10:13 +0100 Message-ID: <20260422101043.1234229-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260422101043.1234229-1-alex.bennee@linaro.org> References: <20260422101043.1234229-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1776852773617154100 Migrate syn_aa64_sysregtrap and co-processor register trap syndromes to the registerfields API. The co-processor syndromes are split between single and duel register moves. Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e --- v2 - use !is_16bit directly --- target/arm/syndrome.h | 124 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 102 insertions(+), 22 deletions(-) diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h index 517fb2368bc..29462aa103c 100644 --- a/target/arm/syndrome.h +++ b/target/arm/syndrome.h @@ -78,7 +78,7 @@ enum arm_exception_class { =20 /* Generic syndrome encoding layout for HSR and lower 32 bits of ESR_EL2 */ FIELD(SYNDROME, EC, 26, 6) -FIELD(SYNDROME, IL, 25, 1) +FIELD(SYNDROME, IL, 25, 1) /* IL=3D1 for 32 bit instructions */ FIELD(SYNDROME, ISS, 0, 25) =20 typedef enum { @@ -172,7 +172,7 @@ static inline uint32_t syn_aa64_smc(uint32_t imm16) static inline uint32_t syn_aa32_svc(uint32_t imm16, bool is_16bit) { uint32_t res =3D syn_set_ec(0, EC_AA32_SVC); - res =3D FIELD_DP32(res, SYNDROME, IL, is_16bit ? 0 : 1); + res =3D FIELD_DP32(res, SYNDROME, IL, !is_16bit); res =3D FIELD_DP32(res, ISS_IMM16, IMM16, imm16); return res; } @@ -203,58 +203,138 @@ static inline uint32_t syn_aa64_bkpt(uint32_t imm16) static inline uint32_t syn_aa32_bkpt(uint32_t imm16, bool is_16bit) { uint32_t res =3D syn_set_ec(0, EC_AA32_BKPT); - res =3D FIELD_DP32(res, SYNDROME, IL, is_16bit ? 0 : 1); + res =3D FIELD_DP32(res, SYNDROME, IL, !is_16bit); res =3D FIELD_DP32(res, ISS_IMM16, IMM16, imm16); return res; } =20 +/* + * ISS encoding for an exception from MSR, MRS, or System instruction + * in AArch64 state. + */ +FIELD(SYSREG_ISS, ISREAD, 0, 1) /* Direction, 1 is read */ +FIELD(SYSREG_ISS, CRM, 1, 4) +FIELD(SYSREG_ISS, RT, 5, 5) +FIELD(SYSREG_ISS, CRN, 10, 4) +FIELD(SYSREG_ISS, OP1, 14, 3) +FIELD(SYSREG_ISS, OP2, 17, 3) +FIELD(SYSREG_ISS, OP0, 20, 2) + static inline uint32_t syn_aa64_sysregtrap(int op0, int op1, int op2, int crn, int crm, int rt, int isread) { - return (EC_SYSTEMREGISTERTRAP << ARM_EL_EC_SHIFT) | ARM_EL_IL - | (op0 << 20) | (op2 << 17) | (op1 << 14) | (crn << 10) | (rt << 5) - | (crm << 1) | isread; + uint32_t res =3D syn_set_ec(0, EC_SYSTEMREGISTERTRAP); + res =3D FIELD_DP32(res, SYNDROME, IL, 1); + + res =3D FIELD_DP32(res, SYSREG_ISS, OP0, op0); + res =3D FIELD_DP32(res, SYSREG_ISS, OP2, op2); + res =3D FIELD_DP32(res, SYSREG_ISS, OP1, op1); + res =3D FIELD_DP32(res, SYSREG_ISS, CRN, crn); + res =3D FIELD_DP32(res, SYSREG_ISS, RT, rt); + res =3D FIELD_DP32(res, SYSREG_ISS, CRM, crm); + res =3D FIELD_DP32(res, SYSREG_ISS, ISREAD, isread); + + return res; } =20 +/* + * ISS encoding for an exception from an MCR or MRC access + * (move to/from co-processor) + */ +FIELD(COPROC_ISS, ISREAD, 0, 1) +FIELD(COPROC_ISS, CRM, 1, 4) +FIELD(COPROC_ISS, RT, 5, 5) +FIELD(COPROC_ISS, CRN, 10, 4) +FIELD(COPROC_ISS, OP1, 14, 3) +FIELD(COPROC_ISS, OP2, 17, 3) +FIELD(COPROC_ISS, COND, 20, 4) +FIELD(COPROC_ISS, CV, 24, 1) + static inline uint32_t syn_cp14_rt_trap(int cv, int cond, int opc1, int op= c2, int crn, int crm, int rt, int isre= ad, bool is_16bit) { - return (EC_CP14RTTRAP << ARM_EL_EC_SHIFT) - | (is_16bit ? 0 : ARM_EL_IL) - | (cv << 24) | (cond << 20) | (opc2 << 17) | (opc1 << 14) - | (crn << 10) | (rt << 5) | (crm << 1) | isread; + uint32_t res =3D syn_set_ec(0, EC_CP14RTTRAP); + res =3D FIELD_DP32(res, SYNDROME, IL, !is_16bit); + + res =3D FIELD_DP32(res, COPROC_ISS, CV, cv); + res =3D FIELD_DP32(res, COPROC_ISS, COND, cond); + res =3D FIELD_DP32(res, COPROC_ISS, OP2, opc2); + res =3D FIELD_DP32(res, COPROC_ISS, OP1, opc1); + res =3D FIELD_DP32(res, COPROC_ISS, CRN, crn); + res =3D FIELD_DP32(res, COPROC_ISS, RT, rt); + res =3D FIELD_DP32(res, COPROC_ISS, CRM, crm); + res =3D FIELD_DP32(res, COPROC_ISS, ISREAD, isread); + + return res; } =20 static inline uint32_t syn_cp15_rt_trap(int cv, int cond, int opc1, int op= c2, int crn, int crm, int rt, int isre= ad, bool is_16bit) { - return (EC_CP15RTTRAP << ARM_EL_EC_SHIFT) - | (is_16bit ? 0 : ARM_EL_IL) - | (cv << 24) | (cond << 20) | (opc2 << 17) | (opc1 << 14) - | (crn << 10) | (rt << 5) | (crm << 1) | isread; + uint32_t res =3D syn_set_ec(0, EC_CP15RTTRAP); + res =3D FIELD_DP32(res, SYNDROME, IL, !is_16bit); + + res =3D FIELD_DP32(res, COPROC_ISS, CV, cv); + res =3D FIELD_DP32(res, COPROC_ISS, COND, cond); + res =3D FIELD_DP32(res, COPROC_ISS, OP2, opc2); + res =3D FIELD_DP32(res, COPROC_ISS, OP1, opc1); + res =3D FIELD_DP32(res, COPROC_ISS, CRN, crn); + res =3D FIELD_DP32(res, COPROC_ISS, RT, rt); + res =3D FIELD_DP32(res, COPROC_ISS, CRM, crm); + res =3D FIELD_DP32(res, COPROC_ISS, ISREAD, isread); + + return res; } =20 +/* + * ISS encoding for an exception from an MCRR or MRRC access + * (move to/from co-processor with 2 regs) + */ +FIELD(COPROC_R2_ISS, ISREAD, 0, 1) +FIELD(COPROC_R2_ISS, CRM, 1, 4) +FIELD(COPROC_R2_ISS, RT, 5, 5) +FIELD(COPROC_R2_ISS, RT2, 10, 5) +FIELD(COPROC_R2_ISS, OP1, 16, 4) +FIELD(COPROC_R2_ISS, COND, 20, 4) +FIELD(COPROC_R2_ISS, CV, 24, 1) + static inline uint32_t syn_cp14_rrt_trap(int cv, int cond, int opc1, int c= rm, int rt, int rt2, int isread, bool is_16bit) { - return (EC_CP14RRTTRAP << ARM_EL_EC_SHIFT) - | (is_16bit ? 0 : ARM_EL_IL) - | (cv << 24) | (cond << 20) | (opc1 << 16) - | (rt2 << 10) | (rt << 5) | (crm << 1) | isread; + uint32_t res =3D syn_set_ec(0, EC_CP14RRTTRAP); + res =3D FIELD_DP32(res, SYNDROME, IL, !is_16bit); + + res =3D FIELD_DP32(res, COPROC_R2_ISS, CV, cv); + res =3D FIELD_DP32(res, COPROC_R2_ISS, COND, cond); + res =3D FIELD_DP32(res, COPROC_R2_ISS, OP1, opc1); + res =3D FIELD_DP32(res, COPROC_R2_ISS, RT2, rt2); + res =3D FIELD_DP32(res, COPROC_R2_ISS, RT, rt); + res =3D FIELD_DP32(res, COPROC_R2_ISS, CRM, crm); + res =3D FIELD_DP32(res, COPROC_R2_ISS, ISREAD, isread); + + return res; } =20 static inline uint32_t syn_cp15_rrt_trap(int cv, int cond, int opc1, int c= rm, int rt, int rt2, int isread, bool is_16bit) { - return (EC_CP15RRTTRAP << ARM_EL_EC_SHIFT) - | (is_16bit ? 0 : ARM_EL_IL) - | (cv << 24) | (cond << 20) | (opc1 << 16) - | (rt2 << 10) | (rt << 5) | (crm << 1) | isread; + uint32_t res =3D syn_set_ec(0, EC_CP15RRTTRAP); + res =3D FIELD_DP32(res, SYNDROME, IL, !is_16bit); + + res =3D FIELD_DP32(res, COPROC_R2_ISS, CV, cv); + res =3D FIELD_DP32(res, COPROC_R2_ISS, COND, cond); + res =3D FIELD_DP32(res, COPROC_R2_ISS, OP1, opc1); + res =3D FIELD_DP32(res, COPROC_R2_ISS, RT2, rt2); + res =3D FIELD_DP32(res, COPROC_R2_ISS, RT, rt); + res =3D FIELD_DP32(res, COPROC_R2_ISS, CRM, crm); + res =3D FIELD_DP32(res, COPROC_R2_ISS, ISREAD, isread); + + return res; } =20 static inline uint32_t syn_fp_access_trap(int cv, int cond, bool is_16bit, --=20 2.47.3 From nobody Sat May 30 20:12:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1776852701; cv=none; d=zohomail.com; s=zohoarc; b=Fus3F1ajh9AUoZk0zhfSqBkLpVLzlNec6Tfm4sp5jA1UyOTIc/hcVeKu7moVGIsXY5yxrYBJIeIYV7Z8ucepyRmStoP/IK3OlngbIBF5b1qdlxD9b4Mx5I6rhdEF5DYD50odLanB026YS4i71FsjlfAqM28tSzlGBgtlGyc2Jlw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776852701; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=K6n23oz7LRRQlFUUM3gTQS/rrKewMUhskSZOvSJMe4M=; b=g7Ifti50Nyk+cZ/6QU67VdFfmc8Dyo3AK4PxlYeChWjOgEYVwqXcnZY8gsoogYHWdVaK51ldx3173/TMWVj+MVIjW7gFw0DKZIsaklx3IyRa5CvsERZbRrCj+YB2vcKe76QYONwD7DrXgeROLABTrJ7Wyt2L/66E/EuK4yzRevI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776852701574587.7572195735631; Wed, 22 Apr 2026 03:11:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wFUXs-0006uK-Dj; Wed, 22 Apr 2026 06:11:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wFUXj-0006oh-9u for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:10:51 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wFUXh-0000iI-98 for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:10:50 -0400 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-4411e1eba51so1925930f8f.3 for ; Wed, 22 Apr 2026 03:10:48 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43fe4e3a341sm48291163f8f.24.2026.04.22.03.10.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 03:10:44 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id A99A55FC04; Wed, 22 Apr 2026 11:10:43 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1776852648; x=1777457448; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=K6n23oz7LRRQlFUUM3gTQS/rrKewMUhskSZOvSJMe4M=; b=BWrMjJ72/kZoUl/0EVsS3S1mC1e3fB1a8afDzJPlXvymWoZbgekfmCet2zp6f1t53V hzDT7brJ/RZVfh9LrhjLBT8HwNWnRJTjffBHcoV0MSTwrMoMwTcDVt8TxueAc79a3jLV VnwXZWUVZ9EpjLbegxWg+pwHBUoIBmimWiHjV7nFHSfhGkN4TPhQoYwPuA2Ilumo55YB JV7Krl8gbGxRWVWSgPg0VWDs1duL62lIyZ/miSs5VGGZEtQPfEB3fRfAJsBijP8j+nav OckTmxomkEMQVadoSbAekeXXeloVebPFQvbRQ4i/jPs1kUd1SIprZKuI54qFIL95EUDE BWYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776852648; x=1777457448; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=K6n23oz7LRRQlFUUM3gTQS/rrKewMUhskSZOvSJMe4M=; b=WrKSxL2DL1gMjJst2B6YZxCTce+eJh7MSLTPoGRix5eUxxuhjDO1Kls0yM6G7QcjvF SvcWkDnLGXu4W+huUDvGSEDGeTRsPgNv+wjKdnh8kRF4zrRm8AV9B90a4UGN1Slj8ydK kCMqwnxhKyN6aGAHZAlnsBkutQREFHVAHhu1pWVcZvnzEZRep6l44ga2M1ON6e0LT78t gapVdaosEAQzLMZvjaScZqT2vrYtX3vQ1qQZnN1v5j0zl9/GXD/El6EKN5ubZepZ3HFT aGad/BbMSJyhbe6PPUG9TARmhMexfw68ulrxSaJFNNU4yM3xQ/nxjKCoQfmZEN09dKZP e9LQ== X-Gm-Message-State: AOJu0YyFbvgLB6VqpnuzNFy8bem0GEfmXLgUXYOW7JS/I4wILL8sf5z3 sXzxQb8Cn3L1uisORMYOq5upa4E+31k1F+uUEAJzpUkWGfp/EFTAqBcy2ZIpPgJFgD8= X-Gm-Gg: AeBDieuyqgy4Xx84mm8afhmr6KsF1RPQ0eqLG43jqCyA/BqyoLrrFnifKbP25uluGjh s1J8Bwoi7a8mmTxWFkFEhEq1/AWZjtA9Gf30Naj6OMCfY+ZOSHdUbpRoyn1dOLjj9Dsi+9z2EAa Wv+06iZHm0cfMG27n7NPe8Pi5U7kULRwTuqEq+s2IsJEG8PUie71gZEULRUT7ZYY8f8iJo5hv8C NtIqfBvWeB2SW+6ypoMw1d7G9J/GwYiCdYrlfFeZe+KLlIjduoG/0PXgNeGms+QWHyXt4KAZk8H yYbRazusRd8wuRP2xxJrcv5NAkYXZVl2ScF5s59BYjIQB8bcOJtoeCLmRIjOQc1iLz1pIRGmDRr IAlGCXjRnDEynpUxuTQpWwfa6PiinA5nPSNnhnmzstLwmnxqb3H1P4csx+L97wdQKcNLkLhCKQR JZW8AOQKxdcDUeVnYq95tBi6pIZ08rLsl0+Q== X-Received: by 2002:a05:6000:26ca:b0:43d:7883:87b9 with SMTP id ffacd0b85a97d-43fe3dc7b56mr33421360f8f.16.1776852647586; Wed, 22 Apr 2026 03:10:47 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , Mohamed Mediouni , kvm@vger.kernel.org, Pedro Barbuda , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Subject: [PATCH v2 03/31] target/arm: migrate FP/SIMD trap syndromes to registerfields Date: Wed, 22 Apr 2026 11:10:14 +0100 Message-ID: <20260422101043.1234229-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260422101043.1234229-1-alex.bennee@linaro.org> References: <20260422101043.1234229-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1776852703763154100 The syn_simd_access trap was never used so remove it. We should only see the COPROC encoding on v7 architectures. Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e --- v2 - use !is16_bit directly --- target/arm/syndrome.h | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h index 29462aa103c..72051443d59 100644 --- a/target/arm/syndrome.h +++ b/target/arm/syndrome.h @@ -337,21 +337,26 @@ static inline uint32_t syn_cp15_rrt_trap(int cv, int = cond, int opc1, int crm, return res; } =20 +/* + * ISS encoding for an exception from an access to a register of + * instruction resulting from the FPEN or TFP traps. + */ +FIELD(FP_ISS, COPROC, 0, 4) /* ARMv7 only */ +FIELD(FP_ISS, COND, 20, 4) +FIELD(FP_ISS, CV, 24, 1) + static inline uint32_t syn_fp_access_trap(int cv, int cond, bool is_16bit, int coproc) { /* AArch32 FP trap or any AArch64 FP/SIMD trap: TA =3D=3D 0 */ - return (EC_ADVSIMDFPACCESSTRAP << ARM_EL_EC_SHIFT) - | (is_16bit ? 0 : ARM_EL_IL) - | (cv << 24) | (cond << 20) | coproc; -} + uint32_t res =3D syn_set_ec(0, EC_ADVSIMDFPACCESSTRAP); + res =3D FIELD_DP32(res, SYNDROME, IL, !is_16bit); =20 -static inline uint32_t syn_simd_access_trap(int cv, int cond, bool is_16bi= t) -{ - /* AArch32 SIMD trap: TA =3D=3D 1 coproc =3D=3D 0 */ - return (EC_ADVSIMDFPACCESSTRAP << ARM_EL_EC_SHIFT) - | (is_16bit ? 0 : ARM_EL_IL) - | (cv << 24) | (cond << 20) | (1 << 5); + res =3D FIELD_DP32(res, FP_ISS, CV, cv); + res =3D FIELD_DP32(res, FP_ISS, COND, cond); + res =3D FIELD_DP32(res, FP_ISS, COPROC, coproc); + + return res; } =20 static inline uint32_t syn_sve_access_trap(void) --=20 2.47.3 From nobody Sat May 30 20:12:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1776852738; cv=none; d=zohomail.com; s=zohoarc; b=Kk/fVB+AfWJNwnD0XQaRBQKY7bouipoa6QQnpyPcvveFvV5Gy9a74zJSKuNXPCH51EvLIxMgJIddc3SQicoaakLTLn4yNbrQt7+yZUyJgdpbZZVeUlaJ5cn0v3W1DsbOx1ulbVd+1WEbSKEMMJGhHaNYazW7yLnWyubi1qHy5kI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776852738; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=XRTiu65oEEP/NVXKQGmyzqv/GBntii32+7VLEeXU9Tc=; b=Z5ddGs0BlN27OyP1Qao2u38pT9ILuvl46t3HjtMyL61gBjevF56lufh2zzxzOu7NKILptVs+lPpztYwGnJjSO3yBuDGVdsel7D+w6ciSaqvxcah4Efy7gShqTsPt44g9bezIm7zTqI3R1kaClzDAr1c7uEM1NqXB40IZjgU7DJo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776852738604970.3184199900423; Wed, 22 Apr 2026 03:12:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wFUXt-0006v6-7u; Wed, 22 Apr 2026 06:11:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wFUXl-0006pO-1w for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:10:53 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wFUXh-0000iQ-WD for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:10:52 -0400 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-483487335c2so52303525e9.2 for ; Wed, 22 Apr 2026 03:10:49 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43fe4e46898sm46509989f8f.27.2026.04.22.03.10.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 03:10:44 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id BC52060338; Wed, 22 Apr 2026 11:10:43 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1776852648; x=1777457448; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XRTiu65oEEP/NVXKQGmyzqv/GBntii32+7VLEeXU9Tc=; b=fzE97kJz62CgSTz+ZapOg+VcESMiBRuzcFh7RGBaaV0/sxCEOi5vuaDucca///vvWD AX/Tm1ZlAsrLiTs/up9dxB9d6QeZnUJi7vhCMXg1XluRVypGJjx/Va3ekd8mfoDWlZDI 9I5MBirNe8wF2sbL2YPchsOfHzi5fVjzbcEN4JdvlG+3feJuqc89oPb+l1j0maXdVAcJ xu/yqkqksdBTYN1k6SyMVKwjBO8kFY3DwStJiQyYH2XKWsrczSVwOifUtVZ0vJXPIZYh ameJwrKNy4IEZUUQORvZPH29vG2+a9UPUKt2NG+fGYuoVyJ3mDw/d/5Zx6UVFuL7Ezb0 06BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776852648; x=1777457448; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=XRTiu65oEEP/NVXKQGmyzqv/GBntii32+7VLEeXU9Tc=; b=XZhOnuRnxVoZ6NEvtlwCj4jUhIAsqRhB/RXgbczBG3GyTyx/xgudkh68hN5YfNeX2+ sjrW8osMaGGwXHILotZ7MJaN1rMPn/GcrWTeCKcaZtc6MnvAf8bw29psJ4k6ORrCgJxM pQoQUmBviR3E4F4AU0xOZVP28caZo9AdM42gCpaTg9DtdJAx3EgXfmFXZyi8NLgHAZX3 PC5/7Yx/MkEY8WXWQVpVrbEhDb5NJmH8Ar3yKWs4vpu7iZWgNDlQk42jrQcIcVIk3mj2 y7zIh52kZwh+r0upuN5G2nnzPkVFbUhNkLPO9edyfKTVJBAFcHwOBQw512vLb68o6sGg dOHA== X-Gm-Message-State: AOJu0YwrwNGnK93vMLcwE7HEWDpU/Q13hmRZrUzGEEfM1KkZ0IJac0sf GGJ2RD+/gLBQTRhinFMxmIB4XVf0cE+UeZgP/W5kOev0X58QpXkZn/w7mUuphXI+1FE= X-Gm-Gg: AeBDietzgykfpmcsYxjSZBpMSewZkNBfUIs6fpyH1Wxhckp4dYRRZLXc6xSAHUgjc9J TQNvzwaDQIRguKR5gjw0+LZ3XIMr6z2LAlcUegmSPy7Wa4CVyWMGo6FBSpwvpasRgXvp7s1XUAg 0xXg3B+8giGjFxE2DTJO1Nvv9edsNhOZ/IgeYIXobee30ZjJzBXort49fN0WcdYzCg68EKSbDfK G5aEbzKuap8edL3492YQjiD3VpdbJ6eLsSH/F2+9nWZEQt7Na9UkLxmAB99b3fK/w8r8oVY2+Gr XnK9t4+s20adMB5luRZgg3vmcxZjcGCpDoduv/UHu7HcnCliDLpVaa3BT0u80OK8IrE/73jGT2F 5FXtZC4ApOegKMC1qCpcPKSc4nxdcIbQ//Nrtt6aMKp7VaeOf7LBf12//Ie5S7+UFDntTnQKKfV JJAi4uCKpnFJAX3Aws964as/WH7DYdncY+kw== X-Received: by 2002:a05:600c:19d3:b0:489:1ae1:4eb9 with SMTP id 5b1f17b1804b1-4891ae14f23mr171514615e9.28.1776852648038; Wed, 22 Apr 2026 03:10:48 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , Mohamed Mediouni , kvm@vger.kernel.org, Pedro Barbuda , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Subject: [PATCH v2 04/31] target/arm: migrate eret trap syndromes to registerfields Date: Wed, 22 Apr 2026 11:10:15 +0100 Message-ID: <20260422101043.1234229-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260422101043.1234229-1-alex.bennee@linaro.org> References: <20260422101043.1234229-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1776852741195154100 For simplicity keep the OP as a two bit field rather than the two interlinked fields in the docs (ERET/ERETA). Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e --- target/arm/syndrome.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h index 72051443d59..63c8e66ea91 100644 --- a/target/arm/syndrome.h +++ b/target/arm/syndrome.h @@ -367,12 +367,21 @@ static inline uint32_t syn_sve_access_trap(void) } =20 /* + * ISS encoding for an exception from an ERET, ERETAA or ERETAB + * instructions. + * * eret_op is bits [1:0] of the ERET instruction, so: * 0 for ERET, 2 for ERETAA, 3 for ERETAB. */ +FIELD(ERET_ISS, OP, 0, 2) + static inline uint32_t syn_erettrap(int eret_op) { - return (EC_ERETTRAP << ARM_EL_EC_SHIFT) | ARM_EL_IL | eret_op; + uint32_t res =3D syn_set_ec(0, EC_ERETTRAP); + res =3D FIELD_DP32(res, SYNDROME, IL, 1); + res =3D FIELD_DP32(res, ERET_ISS, OP, eret_op); + + return res; } =20 static inline uint32_t syn_smetrap(SMEExceptionType etype, bool is_16bit) --=20 2.47.3 From nobody Sat May 30 20:12:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1776852893; cv=none; d=zohomail.com; s=zohoarc; b=VBlsh7NCvSwln6wfwfmC1C6FLhukZfjjxDGxF1Zck3nh0kfLZ90Pd4Wi4hi/2I73+CljcX2Pk75fTAZ9TUvogxlhl6jxAVRSooXx/8frLAhUIdrOHxO3g121+UQ3TqfJDYrkdUMXK5MUvFa9VfQXsdoeD5HOoU+0+lsM0mPfRCc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776852893; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=rUXCf79/aCPWP+oojaJHciitYmV1hJJUoyGLuPcbhOc=; b=VDKke4Nb8yu9YBC+mdwY+woslmAlte/plTFkibh0Fa6//mikhMH+BTkaQplLwwYq3FxNzabSzzPPaX5a7h2FUVkmySWjaI6sJYrjSEo6bp7dJmoBRh5W6PZD7Q0/b+Yv56PxOW0P7TR21LrauLHOfY6SgQM+69NQGr2Avn4lgOM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776852893387479.65148476742047; Wed, 22 Apr 2026 03:14:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wFUXp-0006sH-V0; Wed, 22 Apr 2026 06:10:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wFUXm-0006pW-CG for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:10:54 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wFUXj-0000jJ-IY for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:10:54 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-483487335c2so52303875e9.2 for ; Wed, 22 Apr 2026 03:10:50 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488fc17f642sm399924805e9.5.2026.04.22.03.10.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 03:10:48 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id CF21960342; Wed, 22 Apr 2026 11:10:43 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1776852650; x=1777457450; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rUXCf79/aCPWP+oojaJHciitYmV1hJJUoyGLuPcbhOc=; b=b9JVmR8AMwavo9+B1hw0BF6tqDsQJ0x/F4/7DX1xnF/oRKKdxz2Q3Ks/FdJJ6g2eaa iZmGFNkgUDYahZZ7PEQb77k39pcdFcvLgINQL8Ub+dNDYIy0PlsoGyqO+t4dfC1Mzduh T6Koio8Uzo5lccgB6giIfD87IEhdQA0qKkhAgAB1aU7rXXQsmnRC9KuANRL5L1lUdQzf feHlj7H2t4tgbmRXOxsC4Z0UzGvMMhXMrL0Cq/XpmAryVayxXRMNFQCPMOjh0dF+rzHc udt6rqUrTcDf9/VBula+DqqcYgKRXzIqCOAqKAbT7Fm31YYTh8PhUiA3al2A3zSyTw1q 7thw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776852650; x=1777457450; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=rUXCf79/aCPWP+oojaJHciitYmV1hJJUoyGLuPcbhOc=; b=X2icI6cU6SCFipOvoc1t3yavoU9oj3O16dnxVrkgRec2U5jJgyjRu0xf41OQFTdxL7 KlhxAeGoAIN5V9snfNo1y/rHPS+zdhixMG8PmWQQSMaS04kWFRCuPlT+0dL2fC3btQ0R RwKE6J0LJsdVUUe0J+7UXeJZplfDpxJx3Pdvb4wI3FEVjca94RW8XlEI7S8zxBbPTDge nhw7TZEJCeEp+UMS9TpU7DaZNx6GVFc3gKeO13J7y+D41Aq8GyYrf7Dw2RcsfkOhfBCL YNQ6VHyLkDJBLA/tVcFMNGVdd+w3KZtxX3U2xcoAXzdM5OJJ8p1a5xPfdkqZZg/B8g1l lkQg== X-Gm-Message-State: AOJu0Yx/E+sxhhkGa6P/+2vMOURYSKdHGY4DELNpVZ72hOYod5FxhIVr UKAlhcgRUTNy/D5vddG73otxmFxuTRvzeYyDqmfY92u6JVyy+wL4e+aXMoFpq2sYnBw= X-Gm-Gg: AeBDieuVeoN2Houpsp6qfhDcnhzhJ/sYTkS/c7pJeFBMpxMTX4vOPnkJ9otX4Wf+umk U3q1NYHagkUe/zZQEpRAibUtbfTALsE1+cWifK/t+VlfgLg6eGbmnnCNJV/YUPWu3GD+2jCbypB hCBdh2zuRnkhJFXiO0FkB1L2P3iPfPxEyHLETYzImxlHTd3Lfys6Un1Bf8JaBnykSa2R+c6he0Q W9mZb81YB2+OA9Rz0aLMoZfY3Y1e07Hza84JcLKRhNNAfMhEWy0e/8AUPKaxJDiJv533DOGAlMu PsLgxN1+UORrwpF0UNKIcfw1VuoJKThgRjWVDjM+L94iHAtZ72zGqZQp1PN9zDVkelfm9MY/Dnd zf7dr+N/AKO7WHn0cfOV2MVtrXCeFRMPHO8D6h6eFVfCt3eqfRwPGh/A+jWdsJ3SU/rv5C6rF39 X5FX0A7VE6MgVri3HAFkwJFfhfWzG3dewYJQ== X-Received: by 2002:a05:600c:a303:b0:48a:5576:a28a with SMTP id 5b1f17b1804b1-48a5576a618mr79079685e9.0.1776852649757; Wed, 22 Apr 2026 03:10:49 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , Mohamed Mediouni , kvm@vger.kernel.org, Pedro Barbuda , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Subject: [PATCH v2 05/31] target/arm: migrate SME trap syndromes to registerfields Date: Wed, 22 Apr 2026 11:10:16 +0100 Message-ID: <20260422101043.1234229-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260422101043.1234229-1-alex.bennee@linaro.org> References: <20260422101043.1234229-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1776852895537154100 Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e --- v2 - use !is_16bit directly --- target/arm/syndrome.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h index 63c8e66ea91..61053475984 100644 --- a/target/arm/syndrome.h +++ b/target/arm/syndrome.h @@ -384,10 +384,18 @@ static inline uint32_t syn_erettrap(int eret_op) return res; } =20 +/* + * ISS encoding for an exception due to SME functionality + */ +FIELD(SME_ISS, SMTC, 0, 2) + static inline uint32_t syn_smetrap(SMEExceptionType etype, bool is_16bit) { - return (EC_SMETRAP << ARM_EL_EC_SHIFT) - | (is_16bit ? 0 : ARM_EL_IL) | etype; + uint32_t res =3D syn_set_ec(0, EC_SMETRAP); + res =3D FIELD_DP32(res, SYNDROME, IL, !is_16bit); + res =3D FIELD_DP32(res, SME_ISS, SMTC, etype); + + return res; } =20 static inline uint32_t syn_pacfail(bool data, int keynumber) --=20 2.47.3 From nobody Sat May 30 20:12:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1776852746; cv=none; d=zohomail.com; s=zohoarc; b=HSZFSWNVcniNg9wxvQxuAKGCEWL21riysZ0pspXzFxFdNPFONvp/FeYEDNLz13E04AJp8+ZHT2AyiyCJCAiS2IvEu0eH8ZrlKzkEgYffAOgnRaQUgpRZJiXlFh9fW4JFq3SownfJtp1tPR7m381wvQpjAmFeWvbdm88I/RqO7m4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776852746; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=/O57BXYHK8ET+Z6BA/YHEqhtOr337eupd637bkTh7l0=; b=KdMMG5CO4HYPOsbjWdkOzaodFXon63LR+Ez7ApxT0LUJ1T/+sO3Ix5HRJDOrug6E6OVuBqT+bRFx16dtjv8h7gneGIEb9exS0QQibwjpmdUfoaTuVqpNhQ287Meo3fTmxmxkl46BAZrt4Td+JsoPxqOmhJUQrxTdgdsc+/yr5oQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177685274624817.959467347016812; Wed, 22 Apr 2026 03:12:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wFUXq-0006sx-Eq; Wed, 22 Apr 2026 06:10:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wFUXl-0006pP-7b for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:10:53 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wFUXi-0000iu-Vc for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:10:52 -0400 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-4891c00e7aeso30006805e9.2 for ; Wed, 22 Apr 2026 03:10:50 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488fc1393f5sm410399245e9.9.2026.04.22.03.10.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 03:10:48 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id E2F5F60469; Wed, 22 Apr 2026 11:10:43 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1776852649; x=1777457449; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/O57BXYHK8ET+Z6BA/YHEqhtOr337eupd637bkTh7l0=; b=nWQjJM1mTuQcRujdZTNx04U3WFqDDU7rwx+eyXVCIOZIZrqLFZW++o2MV0ZJNZRfU2 50uPZzlddAWcq0FphHFFBuE3RlFla7E/LOSRzolnSnbEDbliB3Pjf7YLMm7bggq7vbyR mB3sk3bqGx7zBhq/oNsVnPmfuaqJicwNxk9WqeRYoGRnsdn+MYtUypnOw4JDKEFgK7wL KkluszeDsqaSBIiFJEIvu6pSmNNWlBMhM4oMRFlNF13UxIAP4gDe+uMwMf/2KomSqiuh 8INrqs5UimOj9HpJe2486ZvvRdUu2yiDwoJR2M9w/rRwUHvaM/i+BchapwIhyyYrPB6g jc5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776852649; x=1777457449; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=/O57BXYHK8ET+Z6BA/YHEqhtOr337eupd637bkTh7l0=; b=KRQIscjGlrAsl4bQdFeDkcFzlvIzF4W8L7KbyJI3r3LUfTtoUyoFOnyiQ55AcjqsV+ oLwGgpachBDZlMWHW2avGmxd4BqO8jKGTwqQWqbI9uiZVayTYswS3FyGPRpgIeWM64ff koldWSsQoRLHBluTSjx7XH6pqzU2aePttJ7PA0YNjdKy9KyXF38v38ebROjOaLgyXXhl OTMakoO6cku1lAbWeV8PTUg/fXeO6bDfYPBpFH3cZodN932TiLs0ml11TUw3R9g6i/Gh Bywsic1L3e/F+NNtFkjhzmK/0t5ET7CA27uZ8c3z4TfhLm28FfayAIayNc0M9Sa1KeL8 8m5A== X-Gm-Message-State: AOJu0Yw7wchkaqgi5Q5/XFqmmKQ5eOOhRBpjYMiTtLzhXDVaiJxCXc5m TrhruvqTBik4jyQD+HXRwFIf8UarKhM1dn3xN/jxaUEDlNoytKysRi+OpbSKiSJAXww= X-Gm-Gg: AeBDiesBFhCcINP0mrY48xcCUN3f6hf2hTAZLwQiSGiujESM4lAx5KSj7RIreYiTz/D YHWsChVy6wBNa16BNjU/col0ELadDqGfM51zj1AyB44vYMbQvX3qzttX6OWXcjJZYf6bX5vs3tP snBLZ+IYMg4xyIfuTh5/bnWhThRdWRkasGYUdr65Q8ka2VvX1C0rTVLiQgSynSsNSc6eUDTUhu9 ZUbY4GfEOHl3Iiyi9+0ECjNyutkfm5k0nFQz4RvfKfsW7iAZuaE4ygAxYqHtvoEwI6sSirNzSNn QrnnbC6XsYOn7y4YeX92RseWfdcyiT+ATh2mjb+Edm+bZKjaVDBOv/zO5mZyuTh4GS0MeR4axMs uGDhVpBwEE3Luj+x90e2haYZIayXeaCBxwelHgb7DBx/sszx9u1RluTqGEMTX3J8pwbD/8PVZ95 U1m5auhpLb9vVurubB/LlBx3nYeLfFmF7p4Q== X-Received: by 2002:a05:600c:6289:b0:488:f941:aab2 with SMTP id 5b1f17b1804b1-488fb78a561mr299841095e9.30.1776852649323; Wed, 22 Apr 2026 03:10:49 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , Mohamed Mediouni , kvm@vger.kernel.org, Pedro Barbuda , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Subject: [PATCH v2 06/31] target/arm: migrate PAC trap syndromes to registerfields Date: Wed, 22 Apr 2026 11:10:17 +0100 Message-ID: <20260422101043.1234229-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260422101043.1234229-1-alex.bennee@linaro.org> References: <20260422101043.1234229-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x330.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1776852747317154100 syn_pactrap is fairly simple as the ISS is all RES0. Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e --- target/arm/syndrome.h | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h index 61053475984..fd8639d4f07 100644 --- a/target/arm/syndrome.h +++ b/target/arm/syndrome.h @@ -398,15 +398,32 @@ static inline uint32_t syn_smetrap(SMEExceptionType e= type, bool is_16bit) return res; } =20 +/* + * ISS encoding for a PAC Fail exceptions + */ +FIELD(PACFAIL_ISS, BnA, 0, 1) /* B key or A key */ +FIELD(PACFAIL_ISS, DnI, 1, 1) /* Data or Instruction */ + static inline uint32_t syn_pacfail(bool data, int keynumber) { - int error_code =3D (data << 1) | keynumber; - return (EC_PACFAIL << ARM_EL_EC_SHIFT) | ARM_EL_IL | error_code; + uint32_t res =3D syn_set_ec(0, EC_PACFAIL); + res =3D FIELD_DP32(res, SYNDROME, IL, 1); + + res =3D FIELD_DP32(res, PACFAIL_ISS, DnI, data); + res =3D FIELD_DP32(res, PACFAIL_ISS, BnA, keynumber); + + return res; } =20 +/* + * ISS encoding for an exception from a trapped Pointer + * Authentication instruction is RES0 + */ static inline uint32_t syn_pactrap(void) { - return (EC_PACTRAP << ARM_EL_EC_SHIFT) | ARM_EL_IL; + uint32_t res =3D syn_set_ec(0, EC_PACTRAP); + res =3D FIELD_DP32(res, SYNDROME, IL, 1); + return res; } =20 static inline uint32_t syn_btitrap(int btype) --=20 2.47.3 From nobody Sat May 30 20:12:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1776852748; cv=none; d=zohomail.com; s=zohoarc; b=EpIouAPHgeKaxSIK3uR+gB+a6AaVE9YI3N0/aGpaoNRIiyoTsq4WBGIkQSdxCqXuQrGT79uzehO10ObiwQAe2WdMkWlijoz3wQWGcJt8wad8MjR6jeaa2GvGknewNchVZG5fv2YxxMjz8s2IcVluFSLe6fNawloYLf6WX/VxLcg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776852748; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=EAtQqYAVHVvhu80r9xI/PSbLS4M6sLMvc1JPbP3qMzs=; b=JcCVi8Mqg1sGA0Wb45MVa2RRI4cT2nSywS6Htzc/XDrg/9YnQxiM8ZrkNr2ttnP68SPoHUbf4eSqs9U3xKtu3L6mrw/9cjN8GhLczddEj/sN3c941fm/4gfVj3/5pUmRN6Oht0D8ejWrAn5ZTC3xkRXjUJo3QFEk9INwWXzhhWU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776852748934944.1249619071409; Wed, 22 Apr 2026 03:12:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wFUYU-00073v-12; Wed, 22 Apr 2026 06:11:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wFUXp-0006s0-9F for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:10:57 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wFUXm-0000lI-G6 for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:10:56 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-48334ee0aeaso54075855e9.1 for ; Wed, 22 Apr 2026 03:10:54 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488ffc558f2sm296321775e9.1.2026.04.22.03.10.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 03:10:48 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 0180F608C6; Wed, 22 Apr 2026 11:10:44 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1776852653; x=1777457453; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EAtQqYAVHVvhu80r9xI/PSbLS4M6sLMvc1JPbP3qMzs=; b=j+wSpGcEN4LIBEvUj98+3sjf2+1OFjZCKUw62Snd+rABXSoBvZCodcC1PqN1y0gIpF aN5dnhde8Wl93zRHYh+Y9Rm3q9+F44oDpl7h75XkfTdfYGnwmJrOqfg3sgf7G684wdoG PTpVSGSOE3qroHwDLF2SnRwZ4CnJIxUxYyln3+ftvf6GP7Xv/U1KXqOpQgSrklzDdudP uFwZHuo9iwB3oZUiAnGT1AwaLMblBB43gFwVMINWvCUn+3RJOvAZgEBTIPNvDZgWbxd0 4n6KRdOEgXlqM+kJdcXrhLON7vDxitA0Zrb8JLeFk6MquSFfeUHPc9GXHiTtb7z+zbPE 8+gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776852653; x=1777457453; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=EAtQqYAVHVvhu80r9xI/PSbLS4M6sLMvc1JPbP3qMzs=; b=Lv7RNF7Xn3cwNxG6n9Qg08QYXi4rahDoyz0tgntkD/noaHBxwbO6Gws26m0WUVIVyg h7ObwEdgfGHdFMnUfrM4mKAaSbbBIZHAZzZZweERCWndL/+sItO78yQ8bnf67N9r5DiW 0JIPrQXY9yxoBvXC2IjVix5BgI46PCmqMjknBWeYVNfwypr3ZjG5ByM4hiSF8zhVqUGr 0GylgTj7Qax/Hz4o7cNXHW4/XijhSYOVZrP2RAS1XdNfWNOgR3+EH26sJwAXCI9m9L0E gAxGVHkmBnu7W5qt6nXRTHhkhrTOFQbIo+4Vn/qOJ9mafelRRYfcwFFZP+6gI69z4PK6 Punw== X-Gm-Message-State: AOJu0Ywx4gHMXj9jc5xG0wo0XLx2yKbd7HOAvhjTX8d0Kgd72FoPD6WD rdki9FQzuvUYt2N6cHcs/2o0FIXRwW1ITcu3qat5FKbXJfg5zZgIxogAZE5zQYStLDw= X-Gm-Gg: AeBDietCDT/c/VDCouOdWKO21qUlsyUmIZKLnlSUIXJ94OirnVR4VcZMB3PFd75YmuF vyZU/9iwvFYIMPmqLZRZQwSDJG7R0qAGgrdERTac1DNYHSlacsGNDg7YekZbcmb/96lPVm4QKmR 30iJi9WOX4o7RECvVht4UeODA6zFMg+cdAUl5PgEnNd2niOPqsc8ZTNpfX5cVViRD4VSjnHNThR x9UKg4b375h2yCfTsrKrSfgyZ10agxA6lZFo0sTLpdbVge8uCmd6CapTU0URrqtfGpk9dq270Qy P8aglwg3V3UrfbrbgnxFXImradw+TG/HBzBC6neRExhnMpS8PFcJlXNvDlumg4yKbbl5BovYWRQ 8VLM9IE4ylBuuVsUZ39Ub+zsFFlDRrf2B8D8ie70g1vYudR7C8wULuywHClOGRWLPa1qyaQoote gdI1zrrGnAclQA3yAj2yJGhMWR7tJF1gHda6DM9loSlKUs X-Received: by 2002:a05:600c:8909:b0:489:1b10:d896 with SMTP id 5b1f17b1804b1-4891b10dd45mr174107775e9.0.1776852652830; Wed, 22 Apr 2026 03:10:52 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , Mohamed Mediouni , kvm@vger.kernel.org, Pedro Barbuda , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Subject: [PATCH v2 07/31] target/arm: migrate BTI trap syndromes to registerfields Date: Wed, 22 Apr 2026 11:10:18 +0100 Message-ID: <20260422101043.1234229-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260422101043.1234229-1-alex.bennee@linaro.org> References: <20260422101043.1234229-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1776852749516158500 Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e --- target/arm/syndrome.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h index fd8639d4f07..52a6745cb23 100644 --- a/target/arm/syndrome.h +++ b/target/arm/syndrome.h @@ -426,9 +426,18 @@ static inline uint32_t syn_pactrap(void) return res; } =20 +/* + * ISS encoding for an exception from a Branch Target Identification + * instruction. + */ +FIELD(BTI_ISS, BTYPE, 0, 2) + static inline uint32_t syn_btitrap(int btype) { - return (EC_BTITRAP << ARM_EL_EC_SHIFT) | ARM_EL_IL | btype; + uint32_t res =3D syn_set_ec(0, EC_BTITRAP); + res =3D FIELD_DP32(res, SYNDROME, IL, 1); + res =3D FIELD_DP32(res, BTI_ISS, BTYPE, btype); + return res; } =20 static inline uint32_t syn_bxjtrap(int cv, int cond, int rm) --=20 2.47.3 From nobody Sat May 30 20:12:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1776852938; cv=none; d=zohomail.com; s=zohoarc; b=XnnbNyfU2Nbc0GUBAfqiDtuEKTnI6Y9lwx0hqcGlQTCYjth9RZGO+qCeH4j7pNztSdnBFuMACOna+ut1v2tSZuiS6IUfKo1NdoDGFx2DAJBTuWEY71kQgqp6cZtuV2KEbdFh/Tg6MXf4mgLknb8Zno63ocKxAxwy/fN1k+PC+AA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776852938; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=e8D+Vwc6j20F82XkTXJvqmESw0OfURlyV19jvdfWNbI=; b=A6WU07+WA3oC3hSdUiLHvqf6DnIWe6RjJDppWIh/T4HV7zmUddjRCP6q2eJE1/geDtP6c0CCDFiVl0nL408A651GO2qhphzApfveEj2dBPTBmtWv7/UYOV4KTtQRQjFPwCJQjozoZRvm65jAiemPMkZv4+XXXfPopZD5EM9BTfI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776852938915365.63673176153577; Wed, 22 Apr 2026 03:15:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wFUYi-0007Js-OR; Wed, 22 Apr 2026 06:11:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wFUXn-0006qx-Ez for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:10:55 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wFUXl-0000kW-79 for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:10:55 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-48334ee0aeaso54075465e9.1 for ; Wed, 22 Apr 2026 03:10:52 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48a55dc9f58sm265433565e9.6.2026.04.22.03.10.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 03:10:48 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 148DB60E72; Wed, 22 Apr 2026 11:10:44 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1776852651; x=1777457451; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=e8D+Vwc6j20F82XkTXJvqmESw0OfURlyV19jvdfWNbI=; b=HrCAWMlCbWuVQpRYzU/+rAUxUHuaROzF0YzQ12QbSD++Py7GAZ/oqlVKZakrDnIRe2 3fCTORkYQF0lsjrS3fnwdegDRnx9tM3WkDU1FAhENtSH+Yh8rChS8SAhX7p/CVUl7LH4 zN6lw00T7GEMxaHbFeqvlagoAK8FBtJYVuEmtrJ9vg7/bpRliqAkHlo/ewPe2BuGL9A3 +JygGPD8ujtOj0wxZHKBZVhLzKzai6NiK7Q+rPpIJ9WOMOrn7g+fgzEIQtByi2I1CsW+ 66QQHBFJmEkEB4EjEhLPnVDn/dJdf5/k4UHQfWuyoitG+JFJGdRfBBzJvJZLMsI88auH rMXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776852651; x=1777457451; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=e8D+Vwc6j20F82XkTXJvqmESw0OfURlyV19jvdfWNbI=; b=EyFAF/twlNXLgBK5jYkcUhfZjtl6b0EPjVO4URy5+Tk3/GvPlhF3e4JwRWM6BikVgA Yg3qHAiFDcw6MQ/XBRMhaf65pfj+Fdvj2F7vcziOatd/Wf9/f6es2kHuEZUdosh4tOYd rndhfgnw8tV+LFae4N50WIYLVnSJBAwOkyfHU0rfGUrdjj5TFbZg0rUmd/os76BNXDHZ K8gploUSFLeQreydFWRJL7wVB2aehopEmr9zvHn9UFVwmD9x4xv0jjwyApR6C8jxmqnV 4ThMecDu0XCDC1hcBQi/U9Uk5MbJbzZuQBdKfL+ezOsJsIW5PXiuESWLPTVKk9SN7ABU GPSQ== X-Gm-Message-State: AOJu0YxgWsnCCwbmzK7lYLtnIYevKe/znsInObMVBAozx8CLBgJ7Cmwl yfjXrSeArI22lsZir+zcXL2Tn77IC1E9SjxVNMIHLvwNGunJLyrayybrA3pBotwMK/c= X-Gm-Gg: AeBDies8AjE9+sCBc/B2Cn/XNSu4q8PviF/MDdfFRh2jxLlbjF58nx1nnbqdNGiYFYN BarhYL9gpIEtT2ppcdV3UWZxfk9GxNQK4B9mRpWOkaxotNRJG6xXX6ifSSNW+zsCOd8WZJyjTKH y+YYbGJXJok2MIhqD4Xa5szdCjknkPEWigsZ7nMhTBMBkcoSfsLYBkB/UXfXQF6NbMbnHz+Kcjo r+snDDCAZiR48RansCGTA6bbp1Ohw4sVmpEA44x4/7gUbysUaqpy3MvZBDdWeudnlrTwx9SYzLV A6BytGsf4O0ZFBkkAB3WHbVOBddw6WSXmrVKOx/dTbh5pw0SxfzlqYhFGcDuTzn6WiqPq2sIzI1 DC4Up+I33JZ+TyulqIQWcIq9HTLaHIMZC8xkuq0PFF6hwUFlANLdEhF1S2sd6ws506F8rq32VAi WHQX2mSCY3UGtnvt56a3wMHqBNIHn5/hQYCg== X-Received: by 2002:a05:600c:4e4f:b0:488:ab37:b442 with SMTP id 5b1f17b1804b1-488fb793c6bmr321958055e9.28.1776852651521; Wed, 22 Apr 2026 03:10:51 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , Mohamed Mediouni , kvm@vger.kernel.org, Pedro Barbuda , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Subject: [PATCH v2 08/31] target/arm: migrate BXJ trap syndromes to registerfields Date: Wed, 22 Apr 2026 11:10:19 +0100 Message-ID: <20260422101043.1234229-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260422101043.1234229-1-alex.bennee@linaro.org> References: <20260422101043.1234229-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1776852940461158500 This is an Armv7 specific syndrome for chips with Jazelle functionality. Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e --- target/arm/syndrome.h | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h index 52a6745cb23..6fcf0ac7572 100644 --- a/target/arm/syndrome.h +++ b/target/arm/syndrome.h @@ -440,10 +440,26 @@ static inline uint32_t syn_btitrap(int btype) return res; } =20 +/* + * ISS encoding for trapped BXJ execution + * + * This is an Armv7 encoding. + */ +FIELD(BXJ_ISS, RM, 0, 4) +/* bits 4:19 are Reserved, UNK/SBZP */ +FIELD(BXJ_ISS, COND, 20, 4) +FIELD(BXJ_ISS, CV, 24, 1) + static inline uint32_t syn_bxjtrap(int cv, int cond, int rm) { - return (EC_BXJTRAP << ARM_EL_EC_SHIFT) | ARM_EL_IL | - (cv << 24) | (cond << 20) | rm; + uint32_t res =3D syn_set_ec(0, EC_BXJTRAP); + res =3D FIELD_DP32(res, SYNDROME, IL, 1); + + res =3D FIELD_DP32(res, BXJ_ISS, CV, cv); + res =3D FIELD_DP32(res, BXJ_ISS, COND, cond); + res =3D FIELD_DP32(res, BXJ_ISS, RM, rm); + + return res; } =20 static inline uint32_t syn_gpc(int s2ptw, int ind, int gpcsc, int vncr, --=20 2.47.3 From nobody Sat May 30 20:12:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1776852793; cv=none; d=zohomail.com; s=zohoarc; b=CaPqAq8SH1ZxDPce1yYrQWHhBlewcfX2AAycnQMYoWPbYZ78PKrPWRErsDybKz4STH0DcGoWMYcix7al129LWeoASMfE859T4Ni7NW6hi+/y0pMXBJ0FekOxIbObyJptC5oHqtS2nAZQ/V8recV0yesJ1yipWe7H675aFtqofSA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776852793; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=OMEvstJVHgigEudV5H559dC48ky9GaKFB5z4g04o+Y4=; b=F4KM6Z6DTYEKOF5LXiOwJzO8zyZzL/MZ9eJ9JYZawqTFLL+TiHxAsfsWIcDXL9RT5AsBQJ2KlEDK2DRy4j0biKv6F5q7PD7MXXyTO2kN9gI6Ak9DcB4wbkUdgSYEnjFj44R9EfvA+1iN5sfJXlr8W9IYw4+eVrZI5l6HXwxkOW0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776852793536846.9641332016686; Wed, 22 Apr 2026 03:13:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wFUXw-0006ww-6f; Wed, 22 Apr 2026 06:11:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wFUXo-0006rY-QE for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:10:56 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wFUXl-0000kk-Vh for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:10:56 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-4838c15e3cbso48289695e9.3 for ; Wed, 22 Apr 2026 03:10:53 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488fb77b001sm203412585e9.3.2026.04.22.03.10.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 03:10:48 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 2899B60ED5; Wed, 22 Apr 2026 11:10:44 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1776852652; x=1777457452; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OMEvstJVHgigEudV5H559dC48ky9GaKFB5z4g04o+Y4=; b=zBRN0HwIMfZvK4E4ntbSwXzh/HotpGxRNaVBt06q3W1rgYS3hLYgkJJT0Jbd7jPukT Rr7jNQV7Snfp+gdlp0YKr9zQqFE0AJFctF5bhNYNNUSXPVP8eRmItmAM6lv56MJ3pwpn v5xkbuwiHYxeeGfPS1Q/KUtRvusdB6XXtf8EkgKNWUa1RJ6cQiytC/+DuqckzgPjC/+J 3H/KEDrv4vnZU/HD8v8bQhCjuJzIfKYgEAYn4kTyln2NJ3F3RhhEFO4A6uO8xTEuKNEC 8wltYPrFLaOrrRtSP74GyeqElGNEJZ9pe5pAakRY4XP/N2suIJBKRylWJ9c/wRl6Qyl+ +Uhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776852652; x=1777457452; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=OMEvstJVHgigEudV5H559dC48ky9GaKFB5z4g04o+Y4=; b=D1IL4OoezsD5oU0z1G2LDxQCo7lJl+werUVrgNvOY0dTdM/ilB7Gfu4NBdHQeYomxq hE8W6G8KMKUalmo84rrlWOG28were7IuT2f6FbxptnEBr+e/OxaOebDuUFetcth5lbta aficbQ0U/lDaOkdynyWkjlmOwnE2D5WHd6EpJjs1wq8ouaQ3iTV4o7koYtAyCgyMWz/h NW4B8jmrETBmHADbdA1h4KPNO90GvjGRvDn/0cmtwnsSzBGma6wqBefRR4z0b7NVZ04f 1/BjhAjeepG4/cQNiqcnRZhtxPhVPJER369vsDHiPY9MZUNELtFYGEVAZjYcE7oFsDlA 4OxA== X-Gm-Message-State: AOJu0Yw76dqrhZE+eRFitdlyQbLFoiFWTUyvt5B2iE4YilC/MvKgv+7f W1ROe4vLBioHv/WZYAICuiTmyS72z+Nzt4cjBcddLp4i2Q9k5UmSfI5eHF4NoUzI9Tk= X-Gm-Gg: AeBDieu/MoYbRRPrFotRTTD6927ud+NLyTNENjGQB8eGxfuEVWsvxUWXCOAvZWQ+5FK 1itY8Fc0gpM5YiLCARk7glgxpTwfgQ9p8hrMnxHjlIl3GVgqX52Uccgt+FsoLRXsCfneV1SeHV6 FXhzC/V6ca+Qj+Uck9LbY78vpFLARtjusl8sw4JiM71T7mG0sfM7uciXhTBSQfABHgpvjtZfC4z LNGTJ+uMW1Opia0G78QSQR49BJsV+ib/bdBaTJH5rtyKJI7t6EWK/Y5bLiODqsccvuVp4aUD6ea Ve8H/FhGsKjjSjXy+GSAQ1/qFYkFBDwVG78Tu54PLwtlP/NGoGfDMlw7I/1wSr132Z7KO+5/jQ+ izN0wlY8JkYHeUxdvZYzrf2QGQ4SA2YoFqOHDNV4TSklW/xIR+Qst2TVcfwQPa4nJxfba50mngU cm+1L93o23b2gemE74E335KO6Cht0vvPOMM9NDPqQBpy5D X-Received: by 2002:a05:600c:c106:b0:489:1ba8:5be9 with SMTP id 5b1f17b1804b1-4891ba85d07mr128773375e9.29.1776852652050; Wed, 22 Apr 2026 03:10:52 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , Mohamed Mediouni , kvm@vger.kernel.org, Pedro Barbuda , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Subject: [PATCH v2 09/31] target/arm: migrate Granule Protection traps to registerfields Date: Wed, 22 Apr 2026 11:10:20 +0100 Message-ID: <20260422101043.1234229-10-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260422101043.1234229-1-alex.bennee@linaro.org> References: <20260422101043.1234229-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1776852795870158500 Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e --- target/arm/syndrome.h | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h index 6fcf0ac7572..bc65106c61a 100644 --- a/target/arm/syndrome.h +++ b/target/arm/syndrome.h @@ -462,12 +462,36 @@ static inline uint32_t syn_bxjtrap(int cv, int cond, = int rm) return res; } =20 +/* + * ISS encoding for a Granule Protection Check exception + * + * These are only reported to EL3 + */ +FIELD(GPC_ISS, xFSC, 0, 6) +FIELD(GPC_ISS, WnR, 6, 1) /* Write not Read */ +FIELD(GPC_ISS, S1PTW, 7, 1) +FIELD(GPC_ISS, CM, 8, 1) +FIELD(GPC_ISS, VNCR, 13, 1) +FIELD(GPC_ISS, GPCSC, 14, 6) +FIELD(GPC_ISS, InD, 20, 1) /* Instruction not Data access */ +FIELD(GPC_ISS, S2PTW, 21, 1) + static inline uint32_t syn_gpc(int s2ptw, int ind, int gpcsc, int vncr, int cm, int s1ptw, int wnr, int fsc) { - return (EC_GPC << ARM_EL_EC_SHIFT) | ARM_EL_IL | (s2ptw << 21) - | (ind << 20) | (gpcsc << 14) | (vncr << 13) | (cm << 8) - | (s1ptw << 7) | (wnr << 6) | fsc; + uint32_t res =3D syn_set_ec(0, EC_GPC); + res =3D FIELD_DP32(res, SYNDROME, IL, 1); + + res =3D FIELD_DP32(res, GPC_ISS, S2PTW, s2ptw); + res =3D FIELD_DP32(res, GPC_ISS, InD, ind); + res =3D FIELD_DP32(res, GPC_ISS, GPCSC, gpcsc); + res =3D FIELD_DP32(res, GPC_ISS, VNCR, vncr); + res =3D FIELD_DP32(res, GPC_ISS, CM, cm); + res =3D FIELD_DP32(res, GPC_ISS, S1PTW, s1ptw); + res =3D FIELD_DP32(res, GPC_ISS, WnR, wnr); + res =3D FIELD_DP32(res, GPC_ISS, xFSC, fsc); + + return res; } =20 static inline uint32_t syn_insn_abort(int same_el, int ea, int s1ptw, int = fsc) --=20 2.47.3 From nobody Sat May 30 20:12:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1776852728; cv=none; d=zohomail.com; s=zohoarc; b=hZKDTDSL03fT5PHjGPQ+PreI8lpqGn91pEjm90XNprVCWOv8bUrZk05YoPVF/0lGnKMGD1nBpStP4jfG7kRRY1JPNDYuxvvAZluUmi1Jm07sQxg8tkkNXje/MptZXjAkZntPvEfWIO4nNrM/bwreNLq9PcbKxhLyb19/xuyYxBE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776852728; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=VPvaC3auN+3Ca9Dko/At0hA0QqcpQF6nrnCTiO0WhDI=; b=UKIYexSTPAm71WJvdWw9LqrR/hIQODCvEv3jRBw5AcRe7o4utj0/JVZFoBT2zuBPTG7Rf4rYPLZIGrORJPCxGuoj68X3+/QFgzxxsWhOV2S3QjgRbUzv5NmliobX2psaRv8Lkd0GXusHREaXmC2ZFog3O8VZ0xUtED0p5RyxErg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776852728046709.0585725854031; Wed, 22 Apr 2026 03:12:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wFUYU-00073w-0a; Wed, 22 Apr 2026 06:11:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wFUXm-0006qM-PJ for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:10:55 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wFUXk-0000jh-1e for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:10:54 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4891f625344so35392815e9.0 for ; Wed, 22 Apr 2026 03:10:51 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43fe4e4daf2sm43294514f8f.33.2026.04.22.03.10.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 03:10:48 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 3B95360EE9; Wed, 22 Apr 2026 11:10:44 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1776852650; x=1777457450; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VPvaC3auN+3Ca9Dko/At0hA0QqcpQF6nrnCTiO0WhDI=; b=qd997h15DzxX9ptkbXH0zLdVOEYqI+HyxERfvQEc/o5JtVkxKsxV53HL/zXh8WlF+v c+nvgL7xPgo7nBkvdtw3/cjFoG6Lkwt1n7PQxPGaH5ZuzTEFONd0XbNnCHCr2ZMYDLC9 nknQvCsN8w9yzORcjauSJUUIm0+5lGuG1NHo3V5WSBJZHFvPLFfyTa2W2TZ38Xp9WqtG OHHZIGFYoJiJqfwVtW+83dO+Tzzjz8rTKKyR31SNHYd1iYLjd9sDwilnhPlZKblnDtFq Ciz21PT0fBvhvPLT3e1+KLYP6EEtEE/0Jd1oMFTEZ01iBMOFRslSIlxdxIpPL64iT2KM vJ4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776852650; x=1777457450; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=VPvaC3auN+3Ca9Dko/At0hA0QqcpQF6nrnCTiO0WhDI=; b=sNBwQtaLvnRP+HUWyH39CXjnqkST74XoQuRvabMcZUSToEFnwE8wB/Ipm6Pg1V1ERJ zcuVD+fLINEN/tLBYMAxJeysBfPMdiVgYfiQWrjWujGaW0z+aeVQTZ6t2a3OG/lHdXCy EAVYlad3oZMN5UCIBjrc2GxKAxIdZV2spDXr0ckZDVfM3Knb+jCZ/A+FnzbjDTYatBYo kfwnQf9qSpO0lyEZBiKTV44tjbdD4OwJ4HKwxinCPb/8QK/IEjGWSx17o3XP9MoHx/7r 9fZiifxcuhvJUJzTaeqOe/e9Og8hXSfv6PcY4aABFRVjy7VmgWrDG3yFJj+QVwLimg67 ZLXQ== X-Gm-Message-State: AOJu0YyAQaEu5Epkqprv9RCYCU+ubvjmLHGro0bAq0AT5dJL3jSRqyrl MQ764GiXF5eUShmZNm6g/P/zbaeGV3GUtyLoLVntvge1tM7Gas5BD2dUSghybIZlLjU= X-Gm-Gg: AeBDieuPoUF/me5WYpy6EYtJ+iLlf3ZdZ8f+8EG+2IcrXa04bJ5quU2yOAt0QsiTmOI Yn84UKlRnnZbe1VMVDmk3p+DzaEHvPGgIE/w5Six+Tagy6KIlSfULuWMaxp/+tMeZgxvmK5vpfj pAiccc0fxY0Tdh/vCUvVKbRB20ikk38OdTuVoEwa2MKvk36tRbCJ4d7MbvBgCfRObVfy69Miwpe R6pQbCXbu31uRQlXSbT1TAvStsLCjc3VPmXrpNmW7AMvWDMlStFNMbt26gE4KK4tvu4IdzpsllF 1mfh/Kq7XKy3D+MVUYLYMxp/IaUp/1O2BU2DuVX5MQWAsvJDd7l6TwW6LDnD7hsJX5BM1jm/uji tCYJh57Hdo/oIBpM99kj5bZkFsvD9EoamC1X6DhunBYQ3YvTv2du6t6F4h4ChmqcekBkhDDdnKh GThz9yDxZuRg2INdYrdb4NhZVNcTzCKSo0jA== X-Received: by 2002:a05:600c:2256:b0:489:1927:5c0 with SMTP id 5b1f17b1804b1-48919270787mr135668195e9.0.1776852650190; Wed, 22 Apr 2026 03:10:50 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , Mohamed Mediouni , kvm@vger.kernel.org, Pedro Barbuda , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Subject: [PATCH v2 10/31] target/arm: migrate fault syndromes to registerfields Date: Wed, 22 Apr 2026 11:10:21 +0100 Message-ID: <20260422101043.1234229-11-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260422101043.1234229-1-alex.bennee@linaro.org> References: <20260422101043.1234229-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1776852731086154100 Migrate syn_insn_abort and syn_data_abort_* to the registerfields API. Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e --- v2 - use !is_16bit directly --- target/arm/syndrome.h | 87 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 74 insertions(+), 13 deletions(-) diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h index bc65106c61a..2031b3704fb 100644 --- a/target/arm/syndrome.h +++ b/target/arm/syndrome.h @@ -494,20 +494,64 @@ static inline uint32_t syn_gpc(int s2ptw, int ind, in= t gpcsc, int vncr, return res; } =20 +/* + * ISS encoding for an exception from an Instruction Abort + * + * (aka instruction abort) + */ +FIELD(IABORT_ISS, IFSC, 0, 6) +FIELD(IABORT_ISS, S1PTW, 7, 1) +FIELD(IABORT_ISS, EA, 9, 1) +FIELD(IABORT_ISS, FnV, 10, 1) /* FAR not Valid */ +FIELD(IABORT_ISS, SET, 11, 2) +FIELD(IABORT_ISS, PFV, 14, 1) +FIELD(IABORT_ISS, TopLevel, 21, 1) /* FEAT_THE */ + static inline uint32_t syn_insn_abort(int same_el, int ea, int s1ptw, int = fsc) { - return (EC_INSNABORT << ARM_EL_EC_SHIFT) | (same_el << ARM_EL_EC_SHIFT) - | ARM_EL_IL | (ea << 9) | (s1ptw << 7) | fsc; + uint32_t res =3D syn_set_ec(0, EC_INSNABORT + same_el); + res =3D FIELD_DP32(res, SYNDROME, IL, 1); + + res =3D FIELD_DP32(res, IABORT_ISS, EA, ea); + res =3D FIELD_DP32(res, IABORT_ISS, S1PTW, s1ptw); + res =3D FIELD_DP32(res, IABORT_ISS, IFSC, fsc); + + return res; } =20 +/* + * ISS encoding for an exception from a Data Abort + */ +FIELD(DABORT_ISS, DFSC, 0, 6) +FIELD(DABORT_ISS, WNR, 6, 1) +FIELD(DABORT_ISS, S1PTW, 7, 1) +FIELD(DABORT_ISS, CM, 8, 1) +FIELD(DABORT_ISS, EA, 9, 1) +FIELD(DABORT_ISS, FnV, 10, 1) +FIELD(DABORT_ISS, LST, 11, 2) +FIELD(DABORT_ISS, VNCR, 13, 1) +FIELD(DABORT_ISS, AR, 14, 1) +FIELD(DABORT_ISS, SF, 15, 1) +FIELD(DABORT_ISS, SRT, 16, 5) +FIELD(DABORT_ISS, SSE, 21, 1) +FIELD(DABORT_ISS, SAS, 22, 2) +FIELD(DABORT_ISS, ISV, 24, 1) + static inline uint32_t syn_data_abort_no_iss(int same_el, int fnv, int ea, int cm, int s1ptw, int wnr, int fsc) { - return (EC_DATAABORT << ARM_EL_EC_SHIFT) | (same_el << ARM_EL_EC_SHIFT) - | ARM_EL_IL - | (fnv << 10) | (ea << 9) | (cm << 8) | (s1ptw << 7) - | (wnr << 6) | fsc; + uint32_t res =3D syn_set_ec(0, EC_DATAABORT + same_el); + res =3D FIELD_DP32(res, SYNDROME, IL, 1); + + res =3D FIELD_DP32(res, DABORT_ISS, FnV, fnv); + res =3D FIELD_DP32(res, DABORT_ISS, EA, ea); + res =3D FIELD_DP32(res, DABORT_ISS, CM, cm); + res =3D FIELD_DP32(res, DABORT_ISS, S1PTW, s1ptw); + res =3D FIELD_DP32(res, DABORT_ISS, WNR, wnr); + res =3D FIELD_DP32(res, DABORT_ISS, DFSC, fsc); + + return res; } =20 static inline uint32_t syn_data_abort_with_iss(int same_el, @@ -517,11 +561,22 @@ static inline uint32_t syn_data_abort_with_iss(int sa= me_el, int wnr, int fsc, bool is_16bit) { - return (EC_DATAABORT << ARM_EL_EC_SHIFT) | (same_el << ARM_EL_EC_SHIFT) - | (is_16bit ? 0 : ARM_EL_IL) - | ARM_EL_ISV | (sas << 22) | (sse << 21) | (srt << 16) - | (sf << 15) | (ar << 14) - | (ea << 9) | (cm << 8) | (s1ptw << 7) | (wnr << 6) | fsc; + uint32_t res =3D syn_set_ec(0, EC_DATAABORT + same_el); + res =3D FIELD_DP32(res, SYNDROME, IL, !is_16bit); + + res =3D FIELD_DP32(res, DABORT_ISS, ISV, 1); + res =3D FIELD_DP32(res, DABORT_ISS, SAS, sas); + res =3D FIELD_DP32(res, DABORT_ISS, SSE, sse); + res =3D FIELD_DP32(res, DABORT_ISS, SRT, srt); + res =3D FIELD_DP32(res, DABORT_ISS, SF, sf); + res =3D FIELD_DP32(res, DABORT_ISS, AR, ar); + res =3D FIELD_DP32(res, DABORT_ISS, EA, ea); + res =3D FIELD_DP32(res, DABORT_ISS, CM, cm); + res =3D FIELD_DP32(res, DABORT_ISS, S1PTW, s1ptw); + res =3D FIELD_DP32(res, DABORT_ISS, WNR, wnr); + res =3D FIELD_DP32(res, DABORT_ISS, DFSC, fsc); + + return res; } =20 /* @@ -530,8 +585,14 @@ static inline uint32_t syn_data_abort_with_iss(int sam= e_el, */ static inline uint32_t syn_data_abort_vncr(int ea, int wnr, int fsc) { - return (EC_DATAABORT << ARM_EL_EC_SHIFT) | (1 << ARM_EL_EC_SHIFT) - | ARM_EL_IL | ARM_EL_VNCR | (wnr << 6) | fsc; + uint32_t res =3D syn_set_ec(0, EC_DATAABORT_SAME_EL); + res =3D FIELD_DP32(res, SYNDROME, IL, 1); + + res =3D FIELD_DP32(res, DABORT_ISS, VNCR, 1); + res =3D FIELD_DP32(res, DABORT_ISS, WNR, wnr); + res =3D FIELD_DP32(res, DABORT_ISS, DFSC, fsc); + + return res; } =20 static inline uint32_t syn_swstep(int same_el, int isv, int ex) --=20 2.47.3 From nobody Sat May 30 20:12:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1776852801; cv=none; d=zohomail.com; s=zohoarc; b=Cu+O3khn7fMTZtwZXcrCa2KO32VXdhBzaTGNDwa5TphUnkb9+6Ktf70T+IU0fvWmW9loxU0iFSm+UMxaLL8mD73xAADdgIEmlCtql9hZBpGBq6Twp4WMcTJT6m8PrOQmeqt1p3TPiXeJaUCQgNjrj9AtN7IeZZNUSK6sEZt80Go= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776852801; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=7nsukKtrqlrIyVc1W2h4m0opSAHZeyebGQjoHRKe/ww=; b=F2/q6g5tmAObi4OJLtGxrDeWUNJxF7CziWjctOYYKqR+m675AIbY3j8/8dSmCn3v/JwtkYcY9joLtqW64PptfLHgQLAme2d6f3J28Z9/97Y5LXbIcxLPc+7cwpQ9YCsUTt1+UiZvWUmuaMYuTz7Cg/S9iy+Twvh7jCmZ2y2OIpw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776852801359779.930318574927; Wed, 22 Apr 2026 03:13:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wFUYm-0007Pe-Lu; Wed, 22 Apr 2026 06:11:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wFUXv-0006wV-7n for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:11:03 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wFUXr-0000oc-Nw for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:11:02 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-488b8bc6bc9so37091935e9.3 for ; Wed, 22 Apr 2026 03:10:59 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488fb794e26sm184086025e9.6.2026.04.22.03.10.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 03:10:52 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 4F1F060EFD; Wed, 22 Apr 2026 11:10:44 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1776852658; x=1777457458; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7nsukKtrqlrIyVc1W2h4m0opSAHZeyebGQjoHRKe/ww=; b=vr8xjoqiSr/A9Q5vma+MiQS4ObghBSjoCH18IKJZY6b1nrDG0pOJom4JUHdhvXajq0 YF9v0HufFyUiofn4gSpATaTxbY+WIFFBfn8EHnFmAFrYIQnn6Cxdxw5apKp1kd4MGoYs KPXhlxZRzdK8Hgm0e+bExCdmn6gEAa8SMngWy2zsOMwv2MbHes07f6LiKoC3sneEpdwg RhtMFN8kzx8SC41YcSyhiyR4kAxgDcaST8ri6ldNgc7XHzMbr7Tj4Hg2bKZ4oSqhH7Dw 9V3paGeCDIqOcJ210B+sqqaSjAGR1cEhY1KuHKtqU8D9yuPf9kgHynA3P8HOqbIZV3f0 AQww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776852658; x=1777457458; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=7nsukKtrqlrIyVc1W2h4m0opSAHZeyebGQjoHRKe/ww=; b=VtHS04/McFuATiKFKA3Tp9ahw7sOAuaAnxm9Bf0oQB2L1f6oHmMlr8fNEaZWZ5sp/i V4/QQK5QEtXLnuB69Fd5kV7Mp9CRGGeKqCM3O/A5ylduiO+Y6k7V8p1Su+ZpQyPI5Lk5 64CLncNYphP0TSpll7mGj8Q6cP4sdXCz2OsWQhEUSXBR+9HFlfgUmVh2acREoXDv7/Qi S+FGNFk3zrO58fxfYIgiqSkgDjTHhAdsDWqEwTmOU3Q2Eb9pXimVwoVnMauq8VICR0OU Ra6N4mWEOXVthnoIZXtm/c9d+lkBQtwoS6pMj4uxCqsGhnhlIIWAb4VSQLg868CT84Ag zMmg== X-Gm-Message-State: AOJu0YzQhySsFrL14cSlMr3wrS3nf7rz2CQy08ZHW5fMcFmLvigk9tPE hWZzQiD/+4iHpTPN5dgW1b0+vv+2mK1bZew8qFI98CQOSTLoYQoGWDTJ1gDsuFRNEaw= X-Gm-Gg: AeBDiet+sklk6onk1oowckh8zlS6G1fAmgHKeVCEDa9fY8LNDMaJRpTj+pfK7QZj+oN 6nOw2ibWZh14l1VkR6RLOiByoeUUvoWoDLxy4v2F205roVuiFEFotpgecq+hxKnLDC09KVk4qot zDAIAm0Pj8dgiusCilH79SK03y3+kE9AYUZ9/uI3A08IqSwhDRgOcndgWkTaiK97mtfXAawrUkD uH5INzDFYtbbhThQYcP6Uvh04YAdoUWPb1GMdawVK5dLJGKBtsYzu59Peq4S/wNAulrfCbo1ZMi un0U4dd0RjTMl61SpUCuVhErZi19XdxBxrBOSaJ23M18EElJOPOz0iDBjDdxwmxhBMTmyNlH6ou 8ymP1D5q7rEgS2P/S6Wx16D+kJFEwQgIoDflRyqVtrVhHzPgY6ytTEvM9dkjKZvdW+hdm0ddX6X fn44GyrtfSPoiRdUGI2Jddgk39rlkNFIiBGQ== X-Received: by 2002:a05:600c:888b:b0:488:c40b:c8bf with SMTP id 5b1f17b1804b1-488fb73d234mr256866985e9.2.1776852657985; Wed, 22 Apr 2026 03:10:57 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , Mohamed Mediouni , kvm@vger.kernel.org, Pedro Barbuda , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Subject: [PATCH v2 11/31] target/arm: migrate debug syndromes to registerfields Date: Wed, 22 Apr 2026 11:10:22 +0100 Message-ID: <20260422101043.1234229-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260422101043.1234229-1-alex.bennee@linaro.org> References: <20260422101043.1234229-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1776852804046154100 Migrate syn_swstep, syn_watchpoint and syn_breakpoint to the registerfields API. Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e --- target/arm/syndrome.h | 54 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h index 2031b3704fb..2ad6b97aea5 100644 --- a/target/arm/syndrome.h +++ b/target/arm/syndrome.h @@ -595,22 +595,64 @@ static inline uint32_t syn_data_abort_vncr(int ea, in= t wnr, int fsc) return res; } =20 +/* + * ISS encoding for an exception from a Software Step exception. + */ +FIELD(SOFTSTEP_ISS, IFSC, 0, 6) +FIELD(SOFTSTEP_ISS, EX, 6, 1) +FIELD(SOFTSTEP_ISS, ISV, 24, 1) + static inline uint32_t syn_swstep(int same_el, int isv, int ex) { - return (EC_SOFTWARESTEP << ARM_EL_EC_SHIFT) | (same_el << ARM_EL_EC_SH= IFT) - | ARM_EL_IL | (isv << 24) | (ex << 6) | 0x22; + uint32_t res =3D syn_set_ec(0, EC_SOFTWARESTEP + same_el); + res =3D FIELD_DP32(res, SYNDROME, IL, 1); + + res =3D FIELD_DP32(res, SOFTSTEP_ISS, ISV, isv); + res =3D FIELD_DP32(res, SOFTSTEP_ISS, EX, ex); + res =3D FIELD_DP32(res, SOFTSTEP_ISS, IFSC, 0x22); + + return res; } =20 +/* + * ISS encoding for an exception from a Watchpoint exception + */ +FIELD(WATCHPOINT_ISS, DFSC, 0, 6) +FIELD(WATCHPOINT_ISS, WNR, 6, 1) +FIELD(WATCHPOINT_ISS, CM, 8, 1) +FIELD(WATCHPOINT_ISS, FnV, 10, 1) +FIELD(WATCHPOINT_ISS, VNCR, 13, 1) /* FEAT_NV2 */ +FIELD(WATCHPOINT_ISS, FnP, 15, 1) +FIELD(WATCHPOINT_ISS, WPF, 16, 1) +/* bellow mandatory from FEAT_Debugv8p9 */ +FIELD(WATCHPOINT_ISS, WPTV, 17, 1) /* FEAT_Debugv8p2 - WPT valid */ +FIELD(WATCHPOINT_ISS, WPT, 18, 6) /* FEAT_Debugv8p2 - missing WP number */ + static inline uint32_t syn_watchpoint(int same_el, int cm, int wnr) { - return (EC_WATCHPOINT << ARM_EL_EC_SHIFT) | (same_el << ARM_EL_EC_SHIF= T) - | ARM_EL_IL | (cm << 8) | (wnr << 6) | 0x22; + uint32_t res =3D syn_set_ec(0, EC_WATCHPOINT + same_el); + res =3D FIELD_DP32(res, SYNDROME, IL, 1); + + res =3D FIELD_DP32(res, WATCHPOINT_ISS, CM, cm); + res =3D FIELD_DP32(res, WATCHPOINT_ISS, WNR, wnr); + res =3D FIELD_DP32(res, WATCHPOINT_ISS, DFSC, 0x22); + + return res; } =20 +/* + * ISS encoding for an exception from a Breakpoint or a Vector Catch + * debug exception. + */ +FIELD(BREAKPOINT_ISS, IFSC, 0, 6) + static inline uint32_t syn_breakpoint(int same_el) { - return (EC_BREAKPOINT << ARM_EL_EC_SHIFT) | (same_el << ARM_EL_EC_SHIF= T) - | ARM_EL_IL | 0x22; + uint32_t res =3D syn_set_ec(0, EC_BREAKPOINT + same_el); + res =3D FIELD_DP32(res, SYNDROME, IL, 1); + res =3D FIELD_DP32(res, BREAKPOINT_ISS, IFSC, 0x22); + + return res; } =20 static inline uint32_t syn_wfx(int cv, int cond, int ti, bool is_16bit) --=20 2.47.3 From nobody Sat May 30 20:12:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1776852901; cv=none; d=zohomail.com; s=zohoarc; b=hPFoy4+7Vvoe4elUNnm8KqeCQ0Iblwms4OJVZ2GyjTb0cc2k8EqfS2z01Kta8iWtVvuFvyFxpg2gwbjLzjv0uiJXvwaJEZ1/W4iAIybmykEOpGDa8id0/EgRy9XcBCjiTN/+Eq1ki+/4Jw0Fr58YKlzCC8KinuKSOsc/2Z2wmsE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776852901; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Oy8aVZbZZZe1U+CUvOIDDEpwm1FnWydA8CkWhWsEzmU=; b=TUen91k1nQcntUcWk/9oSjUrKV+ae2MyYQE9QILpURru73x92UfHE0eOfrgVMObwb9IXXgR8B9OFFDx/qTeg+AoEj1gfXn1lfhve2jQbqN7Nofotfmy2q1Caear7vIcNbglTdrsdgPtkuIaP4GzoB5ICX4dzc/7WsEhWteU5mBM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776852901320399.43687792126104; Wed, 22 Apr 2026 03:15:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wFUYi-0007J6-JX; Wed, 22 Apr 2026 06:11:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wFUXr-0006tx-B7 for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:10:59 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wFUXo-0000mh-Uv for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:10:59 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-488a9033b2cso59156045e9.2 for ; Wed, 22 Apr 2026 03:10:56 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4891bb3d121sm372711075e9.14.2026.04.22.03.10.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 03:10:52 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 61DED60F2B; Wed, 22 Apr 2026 11:10:44 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1776852655; x=1777457455; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Oy8aVZbZZZe1U+CUvOIDDEpwm1FnWydA8CkWhWsEzmU=; b=zp8vPvPIA2ylWMIXnmdNENeGXnQHB+AakOr4E7qJTiN8MEj+4iHYdCqqQb+4k90Anz Dpn+I2aL4nXE/qOCZMReUvm/6/mR33sxiEWdobgqr8NCCJLrJmDlZV+9ryOMBsSBf1DA 2XcQf3dEMTeUKKG2xJHo/J9i/gKhU9YPYNKXG7UpcSb1nUKxjCgKxrakMTsQw6ipIpTN 3zdBu1JJUOxAd3AB23ioMIqCDtf9Vi8FM+AvOCHel8Nx/Z5mM7WojprjSD7N9pMryCtJ urAkahcd8kp5nZkp0qoJzfYGSOrauqp2wsAHUdUuU2vDKP07JJITJWWR5rYycRIhpis5 DyxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776852655; x=1777457455; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Oy8aVZbZZZe1U+CUvOIDDEpwm1FnWydA8CkWhWsEzmU=; b=aluWCI5CCaLocKL1Scn7NQmnwJuy3inofgszQ67XczOcfZtJdX7qgsQ2r6SD9haV3m +f5WOVDRLcF5w97iBAVdJrj0rhWf8AAbDVckuuhwMgV/3S3V/uM4bFW5cAx+figJnDi8 ihk0pz7wH3oNYA4SS2OjN+cDuTW+Me9M2NWmkbO4DkoX7+0f/7CmEQUPrl/YPszkEnte LgXRIY76c1ZKWqoF2hVsN2ek1TLtWUlq9kreN5UdjzzWLaQl/eTBU+WgJUKu2omZZ2oy rZ6gl8mdmPdRzQHO/jkh8LwZBzeUHqC/9rhkzYe+YVMLuQhhapMO81oEQSp7QqXmmY9E JoQQ== X-Gm-Message-State: AOJu0YzOE2C2gqO1/AYKDT8SCw++gk1F4KwMx0ISUlVM8a5zzgUG/4od kqxBXVEdWCB7oh2xuTHcSch7PwlXixiCqvN/WnVbY8gFBQLVArSdJFV0LMX64LNTzOQ= X-Gm-Gg: AeBDiesMS0pkcA6P9HyL6/Bp8phfu7TIWq0dfHNz6UHFYnYu+XHQeYRp2/YpY6x96+b efeL6SOx6Tp+R8bClHMD9zRv88q2PLa3MKUj/7gtJsWn6me2MddSPc7j2Jkn4Q+LqmeOYzH397m A7UZ1lwkp9H/Q+XDw3JwdkagQduhzuFwng4PIlFqZAstoM/OU2gdFigvx72JX/QMv3feJDlUERY X+445IQ+HMZ1mxR57RL25jZm88Bk/3/+5KgrgVGEJrXSBPFCKprqwPWGdX23VwY6eKEZFefekTp 2ydmGBXIzpqVAUsNS8jzGlulSF3MW3Ujoea/fvAcGu8+TGzT+Rao0XZIDhRXupe5HP23nQRzjwn WSUewx/AXwrZVW4R05fDFUu9XuZq/8CanOqlddT/w5MOgKrju8p0SmQtHnbI3m7aKeNEZfK3if9 0fQIaO4rdb7iRlu3AQt/tt8pBjGK9ZN3pK3Q== X-Received: by 2002:a05:600c:4e4c:b0:48a:58ae:9938 with SMTP id 5b1f17b1804b1-48a58ae9f69mr70183535e9.19.1776852655127; Wed, 22 Apr 2026 03:10:55 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , Mohamed Mediouni , kvm@vger.kernel.org, Pedro Barbuda , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Subject: [PATCH v2 12/31] target/arm: migrate wfx syndromes to registerfields Date: Wed, 22 Apr 2026 11:10:23 +0100 Message-ID: <20260422101043.1234229-13-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260422101043.1234229-1-alex.bennee@linaro.org> References: <20260422101043.1234229-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1776852903585154100 This will help later when we expand the fields we report. Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e --- v2 - use !is_16bit directly --- target/arm/syndrome.h | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h index 2ad6b97aea5..65d0de63a83 100644 --- a/target/arm/syndrome.h +++ b/target/arm/syndrome.h @@ -655,11 +655,25 @@ static inline uint32_t syn_breakpoint(int same_el) return res; } =20 +/* + * ISS encoding for an exception from a WF* instruction + */ +FIELD(WFX_ISS, TI, 0, 2) +FIELD(WFX_ISS, RV, 2, 1) +FIELD(WFX_ISS, RN, 5, 5) +FIELD(WFX_ISS, COND, 20, 4) +FIELD(WFX_ISS, CV, 24, 1) + static inline uint32_t syn_wfx(int cv, int cond, int ti, bool is_16bit) { - return (EC_WFX_TRAP << ARM_EL_EC_SHIFT) | - (is_16bit ? 0 : (1 << ARM_EL_IL_SHIFT)) | - (cv << 24) | (cond << 20) | ti; + uint32_t res =3D syn_set_ec(0, EC_WFX_TRAP); + res =3D FIELD_DP32(res, SYNDROME, IL, !is_16bit); + + res =3D FIELD_DP32(res, WFX_ISS, CV, cv); + res =3D FIELD_DP32(res, WFX_ISS, COND, cond); + res =3D FIELD_DP32(res, WFX_ISS, TI, ti); + + return res; } =20 static inline uint32_t syn_illegalstate(void) --=20 2.47.3 From nobody Sat May 30 20:12:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1776852810; cv=none; d=zohomail.com; s=zohoarc; b=LWHs4P2cVxsbuz8G3+mWZoETnt+IlCy2TdwpPkeu/Jjl/bFPi27W9QwVPslkJL1OC8hNgIX9HO7iMLBMQh1esrksqPF/cx1TvnXxXlpENBq4eKH5c3EwI8s8dBBrQCh1s3QG/sdHRsbYqZqRNk/435MDYZRp/xZNjxEAflgu62M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776852810; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=qLD556mwBZN0FOjv6jT/HPan7Y0S6BW5g1K/GkaPB6k=; b=IhWVJTWmh1/Z2tCCV2cHGrwhhoZvAO7pKZzYnchBSockK+jfpke3L10yrohO82rYvltI9YAt2mKE/TS0M8ZCkTc2PQIlBRvwXVRklFyRHNe4wkUhG5b7RqhN5y/bAgeFOZ/RjC3kI7OS3S6VCkSmilRh/xluVvJqjle0xGbf+jk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776852810939855.9199947002141; Wed, 22 Apr 2026 03:13:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wFUYh-0007FV-M2; Wed, 22 Apr 2026 06:11:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wFUXq-0006tA-8Y for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:10:58 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wFUXn-0000lb-Cq for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:10:57 -0400 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-43fea39e066so4191940f8f.1 for ; Wed, 22 Apr 2026 03:10:54 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43fe4cb1405sm44247250f8f.4.2026.04.22.03.10.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 03:10:52 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 7475C60F3D; Wed, 22 Apr 2026 11:10:44 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1776852654; x=1777457454; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qLD556mwBZN0FOjv6jT/HPan7Y0S6BW5g1K/GkaPB6k=; b=KjbfbogYcpf6qTcdklRrYvxYzMDzZxBy07M1RxngPW9F78pS7pAw1Y6Dv9CuEjt37+ AmJ0N11HxBPJW7c8UXEYNnfDsJPCgF9o8tAggz3vZjES9jYwfHEr8czGowpwhfbnPWxm bL6Mjh9lDCvnNVLJmF5uQKoUj/tMjPdHsrm3KocdU1cBpLJ9TzydMZPc+HQEKwYgdtSP kwNLM+U3aB6svBNytnAlL2H2TzC/IRLvurHi6is4fuV66KUDc9N558OTrTpMH9yxfGSY P1ftnXdUgG3M0cygiFra2/Y3g1GGZfscYexM/fyCkB1khmbQZVvFwzG70i1vlrEsB+q+ RWSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776852654; x=1777457454; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=qLD556mwBZN0FOjv6jT/HPan7Y0S6BW5g1K/GkaPB6k=; b=KDSF6vIKY/1T+SNFQBJUQbCu11yL5Yhl3CagprjbHtZGcLZqmimpH7xRr9Qgfqc5Mn CMMHJo8zEsHzYl22lJ/ZxjI4eouoc6mdsSAliRlzs9zYG7ERNUzJyIGv0Iz5k945gSQE PE1/kLAA92FXbqKMCOdOy5n0obRg7e/9Y12+Q6JzRrUknADccDKOStK2SKJGYFuJ3Oci 1SxY9ennGkUp4VLPijPTyNkl0QLICmrkc9+Ewl6yAPCqLew3fDte6q23dgol7XDsQUgj tSSxF3I8VSi9fnDU31PlnbGU8sov1KisQttD8gNhf5STLoRPcQCtxZ0JxdDkF2/KMAB+ c52Q== X-Gm-Message-State: AOJu0Yw5gteUH8wtSBF0Wt0/TfgGoEhihfbNN5D0Vq9WoPnL/shFExqA n4n1+dSBO6ItWLOJEPHiXGirdFQSKtTbk5JPYcBv8jbqouQKNo59MhC6iZmpXlmf54s= X-Gm-Gg: AeBDiet53tgHMXUQ54DqWwuJngmZxNSlIdQwc6n7umvZ4sx9YsffG73c5DjuvM09zQ6 V6kxzq8hu6r++LCGcmJPmrLcWz//F3Kx0vLruAka8z4yS6JDQc24c5DByZIEBsTe9ptpmxWlyrb XpQZCtpIkIRA0guIkgz8itvKOzE+nTvve6VgELlqFHq82AEZaMwgrbbc7JjqPP0QUipEiQs9kdO axbsLDJRHl2SApGDLVbyolvsbWrtDGlJx+FPRrzzWkcb/Cc5KoItSEUpkw/JNOzkXPG30epWOVp e4ybjoDEeTEtHCH0068d6RFymLE163GmU+UeJaGffR6E4Wjpn0pneiZn5MQy18pNOvU6CNypgaf aHEl4lcKRd5Mi+4eCTT/meNQwXJ66VahkS3BlWbnGV5S7x522SKzkqb9tpjfokltno6FfB6qLc1 AjVcQzQmwqymgfzf+2qdVcRlpG48zPdEdGDg== X-Received: by 2002:a05:6000:186c:b0:43e:a703:3665 with SMTP id ffacd0b85a97d-43fe3e0c6femr33085614f8f.25.1776852653594; Wed, 22 Apr 2026 03:10:53 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , Mohamed Mediouni , kvm@vger.kernel.org, Pedro Barbuda , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Subject: [PATCH v2 13/31] target/arm: migrate gcs syndromes to registerfields Date: Wed, 22 Apr 2026 11:10:24 +0100 Message-ID: <20260422101043.1234229-14-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260422101043.1234229-1-alex.bennee@linaro.org> References: <20260422101043.1234229-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1776852812097154100 Tweak arg names to make it clear raddr is the data address register number. Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e --- v2 - rename ra->raddr to document things. --- target/arm/syndrome.h | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h index 65d0de63a83..7ff8c30e2bb 100644 --- a/target/arm/syndrome.h +++ b/target/arm/syndrome.h @@ -690,21 +690,48 @@ static inline uint32_t syn_pcalignment(void) return res; } =20 +/* + * ISS encoding for a GCS exception + * + * Field validity depends on EXTYPE + */ +FIELD(GCS_ISS, IT, 0, 5) +FIELD(GCS_ISS, RN, 5, 5) /* only for non EXLOCK exceptions */ +FIELD(GCS_ISS, RADDR, 10, 5) /* only for GCSSTR/GCSSTTR traps */ +FIELD(GCS_ISS, EXTYPE, 20, 4) + static inline uint32_t syn_gcs_data_check(GCSInstructionType it, int rn) { - return ((EC_GCS << ARM_EL_EC_SHIFT) | ARM_EL_IL | - (GCS_ET_DataCheck << 20) | (rn << 5) | it); + uint32_t res =3D syn_set_ec(0, EC_GCS); + res =3D FIELD_DP32(res, SYNDROME, IL, 1); + + res =3D FIELD_DP32(res, GCS_ISS, EXTYPE, GCS_ET_DataCheck); + res =3D FIELD_DP32(res, GCS_ISS, RN, rn); + res =3D FIELD_DP32(res, GCS_ISS, IT, it); + + return res; } =20 static inline uint32_t syn_gcs_exlock(void) { - return (EC_GCS << ARM_EL_EC_SHIFT) | ARM_EL_IL | (GCS_ET_EXLOCK << 20); + uint32_t res =3D syn_set_ec(0, EC_GCS); + res =3D FIELD_DP32(res, SYNDROME, IL, 1); + + res =3D FIELD_DP32(res, GCS_ISS, EXTYPE, GCS_ET_EXLOCK); + + return res; } =20 -static inline uint32_t syn_gcs_gcsstr(int ra, int rn) +static inline uint32_t syn_gcs_gcsstr(int raddr, int rn) { - return ((EC_GCS << ARM_EL_EC_SHIFT) | ARM_EL_IL | - (GCS_ET_GCSSTR_GCSSTTR << 20) | (ra << 10) | (rn << 5)); + uint32_t res =3D syn_set_ec(0, EC_GCS); + res =3D FIELD_DP32(res, SYNDROME, IL, 1); + + res =3D FIELD_DP32(res, GCS_ISS, EXTYPE, GCS_ET_GCSSTR_GCSSTTR); + res =3D FIELD_DP32(res, GCS_ISS, RADDR, raddr); + res =3D FIELD_DP32(res, GCS_ISS, RN, rn); + + return res; } =20 static inline uint32_t syn_serror(uint32_t extra) --=20 2.47.3 From nobody Sat May 30 20:12:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1776852703; cv=none; d=zohomail.com; s=zohoarc; b=gvRuG/GMt0L9YqwveA6KPVBSI/wwTid+PSUC8FIYZe8XGh3furRKDVaX2XjFB2pcadkhLK/Gb1vrv+2UrZgo1V/TY/u45SuUeS4RqXt9rAA7zc8GGlFm2e7y2EFMXbpmYwptPPbGeRh68Vh74pMqPXCdbHw3HuSBAHrlcnGxDzk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776852703; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=AJ6frWkT466kUBA2I2u6c2X58fkiBAsV+LbvLNVH5Kk=; b=fb4Hgulejk19IYPNcLszhUcjUNgnfr5bdoLe+4AYg9cyEbhtBELcbIQ9QJfEBgNSSKDF3PXgVce0BhxfsBeJD+M4gBW/6bNVfS73WlUvD6RXernbsyHzFVzYWKSaD1Ehof0oEZi2YX/yH0meBJ4Lvf5F1dDdGHqhr+2kEPqUSMg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776852703447767.9354870377517; Wed, 22 Apr 2026 03:11:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wFUXx-0006xk-6L; Wed, 22 Apr 2026 06:11:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wFUXq-0006td-Po for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:10:59 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wFUXo-0000m8-1r for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:10:58 -0400 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-43cfbd17589so4132849f8f.0 for ; Wed, 22 Apr 2026 03:10:55 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43fe4e4eec9sm42224451f8f.34.2026.04.22.03.10.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 03:10:52 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 880F161028; Wed, 22 Apr 2026 11:10:44 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1776852654; x=1777457454; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AJ6frWkT466kUBA2I2u6c2X58fkiBAsV+LbvLNVH5Kk=; b=or2KlmudFSa5ZRH6JDstaf6ixiyRlcdOkakx4p6gUZnwIlmpQieL7BXJxrZZIClq0+ VrnyCO0lAAkl2M7fnt/TKvY3GadEH0i06iuP3SvrVCLVi63kWlYLNgHqOAnZNe+Ernpg WxD7+SD14/lEI9bn2o1QAVbg2Gnrbr009Ao3+q7s6qs8mUIY1CU4WX1L3/8cjmW0PE4f 003tdkU9yMuozQWyFu4PqjArTCyNWImcR/q05VAaegKWwv7HYqP4qZYoepox2GNK0SNo cgK6MVuxZApsiXVRTJF3a83R1Ua8rcA/J58YjWMEBBO4C7IN+tkXAmdYmDIn3mODbzMN n+Dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776852654; x=1777457454; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=AJ6frWkT466kUBA2I2u6c2X58fkiBAsV+LbvLNVH5Kk=; b=FpTRlmp0mCxkSfKutXQV+iLysg75TVAXNuExnp7FYtruwaouJyP7HP8wkwmHf8JFSo kRhqE+/btmBUu0yuUz7li4wT55JS7V3QxfHZACwyeuR8dg6Zkw5thhFO2SI5NwMVI7AT cT7NMX222kPexbBac5VFO1kFPtg42lWphLTBXbOwdqoHDT9D3KSCcGpf3PWAkuyQOLIc Z5sO7b/v2ivb7zB1n8l8x5uvu8dpm2JBo/9iHXJX+rhTEuzNojFfhQEcKCmVVgkHySot Z92oeCrqzgM+ZtdRWnm0dw9PwDTbSMJaBxZZ2pcHsGyX8EMuqIapo3ncHdHt1GyQ27Bg y5Zw== X-Gm-Message-State: AOJu0Ywk0ATAZfRjaL0+MuIXOHYX/jbLj2nIlPscN97n0k/4mXvNs6lN WoZvnhJYRLKO3PoyVOV0yTCu2alhUupw7VUwOsmk1mBjPvtE1VSmKQOJn2VaLwVgwtw= X-Gm-Gg: AeBDiesWtwrzjkEg7PUvVGNhWyOsNiy5X1Ixl1u/jJJ5yltT2jyGhTjirgxfovn75KT HMWHqMUWyNqL8Y1VBElAwu8lG5Xq7DlKeXNddph1I3vXRNaxLdRU2ImMiT9MJ5WO32kIEjv6fBY yX3qzaBJECzHaQ0TkRARx1rGk1d/mJ08GhNNwNEzLqEr0qkHISEc8GJl8hguSzT50mufKpS+Yvz laY6JlN52J2yih/BfvV/V5iN8oE9EtOQNIXd+bfuligNfITWc9as5hoWolFxw7yhXtsdHRVlnjz UyIfRat677NQbt5gTD6jzHOi7Rk2gjC4m9BBI1pN1WgAuE5loTw3luzI0LyvnKXnmPLJAIrwOZf 0RKt1eM2S/Ty2Wq5pLS4gMkG8Y1YaHy3QGegSbdHsAGZMWEEj++WT1Z2NXHT5k2TQLOaw5Ai6dP 7cK/xX7W3YXpEjTt4FZao9IY/hxfxv9a5QwQ== X-Received: by 2002:a05:6000:1a8c:b0:43e:b0f8:66f1 with SMTP id ffacd0b85a97d-43fe3e0b86emr33151843f8f.43.1776852654367; Wed, 22 Apr 2026 03:10:54 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , Mohamed Mediouni , kvm@vger.kernel.org, Pedro Barbuda , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Subject: [PATCH v2 14/31] target/arm: migrate memory op syndromes to registerfields Date: Wed, 22 Apr 2026 11:10:25 +0100 Message-ID: <20260422101043.1234229-15-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260422101043.1234229-1-alex.bennee@linaro.org> References: <20260422101043.1234229-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x435.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1776852705160158500 Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e --- target/arm/syndrome.h | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h index 7ff8c30e2bb..841fd3292b8 100644 --- a/target/arm/syndrome.h +++ b/target/arm/syndrome.h @@ -742,14 +742,39 @@ static inline uint32_t syn_serror(uint32_t extra) return res; } =20 +/* + * ISS encoding for an exception from the Memory Copy and Memory Set + * instructions. + */ +FIELD(MOP_ISS, SIZEREG, 0, 5) +FIELD(MOP_ISS, SRCREG, 5, 5) +FIELD(MOP_ISS, DESTREG, 10, 5) +FIELD(MOP_ISS, FORMATOPT, 16, 2) +FIELD(MOP_ISS, OPT_A, 16, 1) +FIELD(MOP_ISS, WRONG_OPT, 17, 1) +FIELD(MOP_ISS, EPILOGUE, 18, 1) +FIELD(MOP_ISS, OPTIONS, 19, 4) +FIELD(MOP_ISS, IS_SETG, 23, 1) +FIELD(MOP_ISS, MEMINST, 24, 1) + static inline uint32_t syn_mop(bool is_set, bool is_setg, int options, bool epilogue, bool wrong_option, bool opti= on_a, int destreg, int srcreg, int sizereg) { - return (EC_MOP << ARM_EL_EC_SHIFT) | ARM_EL_IL | - (is_set << 24) | (is_setg << 23) | (options << 19) | - (epilogue << 18) | (wrong_option << 17) | (option_a << 16) | - (destreg << 10) | (srcreg << 5) | sizereg; + uint32_t res =3D syn_set_ec(0, EC_MOP); + res =3D FIELD_DP32(res, SYNDROME, IL, 1); + + res =3D FIELD_DP32(res, MOP_ISS, MEMINST, is_set); + res =3D FIELD_DP32(res, MOP_ISS, IS_SETG, is_setg); + res =3D FIELD_DP32(res, MOP_ISS, OPTIONS, options); + res =3D FIELD_DP32(res, MOP_ISS, EPILOGUE, epilogue); + res =3D FIELD_DP32(res, MOP_ISS, WRONG_OPT, wrong_option); + res =3D FIELD_DP32(res, MOP_ISS, OPT_A, option_a); + res =3D FIELD_DP32(res, MOP_ISS, DESTREG, destreg); + res =3D FIELD_DP32(res, MOP_ISS, SRCREG, srcreg); + res =3D FIELD_DP32(res, MOP_ISS, SIZEREG, sizereg); + + return res; } =20 =20 --=20 2.47.3 From nobody Sat May 30 20:12:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1776852795; cv=none; d=zohomail.com; s=zohoarc; b=mTed+jNoyWF7ok7Yq4Zrnc2EfDvrn02vAt2u5A/VBhvbPBUcc2IJM5nlN5Rym/hHc4EKH1XAKnEV+uC/+REaItd0vt1RV6K/BScM5qZeMKbaHTO2nQau1isQO8vADkUqfH+qik5CvLLzg1TTjhtV3go6xuQ6wSOUc/0OxYmQpNw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776852795; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=pBHHqWCNozXOcmQTxKAtN3Av+2DGbBLMiAYtHB54URk=; b=c0ZiG9wDhClc7TcGxhnmVKq58ncynIIl1pdsi8OKrkG7UdQrIIUGB4Hnlre7FXHnNFZhyeFkcYJiZW7OsTiV7uFf7tJUqFdJtdNXJE0EfF1fsG2dLPHJnYD1Gd1RGeDWptJnfgxhBfd/n4+/YtX9jd+SUrZkU//or9bWdnX3X3U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776852795106555.3443815525623; Wed, 22 Apr 2026 03:13:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wFUYh-0007E6-PG; Wed, 22 Apr 2026 06:11:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wFUXs-0006v3-SW for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:11:00 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wFUXp-0000n3-Rv for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:11:00 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-48334ee0aeaso54076505e9.1 for ; Wed, 22 Apr 2026 03:10:57 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43fe4cc2cacsm44153425f8f.13.2026.04.22.03.10.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 03:10:52 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 9E97E61063; Wed, 22 Apr 2026 11:10:44 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1776852656; x=1777457456; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pBHHqWCNozXOcmQTxKAtN3Av+2DGbBLMiAYtHB54URk=; b=w0H4QA3JjLg/z7XLcQpbxljm4pT0/S3Aji7ZeW9E9JwGZtohNcz1vMcGorj2mJgYrQ tjEhBXoFqmWJ9RMWEWZ0cZ5qtM04PWm16k6IFo0PUa2SVASguLPt7w4/aFz6FCrBznAM syv1maSWn8jesMNjs720hRE+Ki99opb6sr8jn/2MlS9JSXDdKad93db90DPRZ9YTeru9 oYcBFZC4QYzINWEhUMCNPKIHgBkm7nD+yGmItZE4GAtAYoGpAsGGaIXRtRCNoREC10sr 4GcZCf0CUvUUCfOjl8s9rQBQPc9Agc29+Zi67LX5U3CGR0RnxmY8+UVF3TJxvR8X02Tj Fovw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776852656; x=1777457456; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=pBHHqWCNozXOcmQTxKAtN3Av+2DGbBLMiAYtHB54URk=; b=C7lDL0Fdn/6+L10MJ3QpisWgvrSDQYZ8Z1a+8+YLlA3M7jiCQS2y3WTCzP/nzcRViN DhdqPSw0mu+/THmZzcmvQhGdd3Je+iuYa33qFxCAazIDKjL1Hdjxj+cdhXe8iBwFKbJB bretOL9baios9pW645ClT1iyYAy1aRLPt35/k5DDJxAvucnGaI4Tb0Y8fPZokEbH6tH6 2XmTITVD44fcuC6nL5uDI/1UdSzsHvWTh6PmuDdLXU1YR2AG2kuHLANUW5hmd3Tqx/NI ZG49kkqzqHOPYd6eol1t4mMsVBFzQSY/ozJ6fl4jh/akAe8jAMHzTRprt/Az9LztpcCB 26Ig== X-Gm-Message-State: AOJu0YykCwpJdumFkCk0ayc9xhMUKXBg/H+YqzySi+/b8wtkSy89LB0P KW6TpCK8oRR6bNFd96A4hCA+bMAk3po9MEqGWeR1C/C+i7a6TzKCavjjBDIb6hsqNSw= X-Gm-Gg: AeBDievEnGgRryqMHWdSxy83CarSUx1Z0OGXgMK1wNmsj/ViWx3sC+WVRHEogy6Q5nB DXgq6qsZNxXuKKlEqakcMTlQt2fJjaURtqmgECF1qxdx3hacbGoEonNM7Le3RejgUaVk3K0LdgL MEPAfZQ2nGXLJvTVWkUl1m0fh8A+9X0Qehkhu/+cWvFdW5T9nfhdoSJueEDQW+Rs4qxPdxQHW3b rRiUR+4ce+QOdq+IPcDBkJdWAFsEnf6EX0Wr3BiDdj30c8iO8IthxyhKhlUHHV5sk58brypnOdy vFpO+PNte6v74SQPsnX8afO2oG1uBA6Aao9385mcV/SJ2zl2OJNrNCAENbEGvytYyN/8NRmH6jC gyXmuhTeADbO71J3FwInGeUXcs93G/4Hcxbe77LYZ7ULl+5obic948lBlyIu+ATDwikTcpjf6cN xKB1CjBDCDBqEBfcHopAclxh5Y6g4NVd40Bw== X-Received: by 2002:a05:600c:45d3:b0:48a:5821:5ffc with SMTP id 5b1f17b1804b1-48a58216a4bmr72951945e9.2.1776852655809; Wed, 22 Apr 2026 03:10:55 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , Mohamed Mediouni , kvm@vger.kernel.org, Pedro Barbuda , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Subject: [PATCH v2 15/31] target/arm: migrate check_hcr_el2_trap to use syndrome helper Date: Wed, 22 Apr 2026 11:10:26 +0100 Message-ID: <20260422101043.1234229-16-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260422101043.1234229-1-alex.bennee@linaro.org> References: <20260422101043.1234229-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1776852797959154101 It shares the same COPROC_ISS encoding as the other CP traps although not all the fields are used. Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e --- target/arm/syndrome.h | 16 ++++++++++++++++ target/arm/tcg/vfp_helper.c | 5 +---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h index 841fd3292b8..53137394e28 100644 --- a/target/arm/syndrome.h +++ b/target/arm/syndrome.h @@ -251,6 +251,22 @@ FIELD(COPROC_ISS, OP2, 17, 3) FIELD(COPROC_ISS, COND, 20, 4) FIELD(COPROC_ISS, CV, 24, 1) =20 +static inline uint32_t syn_cp10_rt_trap(int cv, int cond, int opc1, + int crn, int rt, int isread) +{ + uint32_t res =3D syn_set_ec(0, EC_FPIDTRAP); + res =3D FIELD_DP32(res, SYNDROME, IL, 1); + + res =3D FIELD_DP32(res, COPROC_ISS, CV, cv); + res =3D FIELD_DP32(res, COPROC_ISS, COND, cond); + res =3D FIELD_DP32(res, COPROC_ISS, OP1, opc1); + res =3D FIELD_DP32(res, COPROC_ISS, CRN, crn); + res =3D FIELD_DP32(res, COPROC_ISS, RT, rt); + res =3D FIELD_DP32(res, COPROC_ISS, ISREAD, isread); + + return res; +} + static inline uint32_t syn_cp14_rt_trap(int cv, int cond, int opc1, int op= c2, int crn, int crm, int rt, int isre= ad, bool is_16bit) diff --git a/target/arm/tcg/vfp_helper.c b/target/arm/tcg/vfp_helper.c index 45f2eb0930f..e692bc568bd 100644 --- a/target/arm/tcg/vfp_helper.c +++ b/target/arm/tcg/vfp_helper.c @@ -1359,10 +1359,7 @@ void HELPER(check_hcr_el2_trap)(CPUARMState *env, ui= nt32_t rt, uint32_t reg) g_assert_not_reached(); } =20 - syndrome =3D ((EC_FPIDTRAP << ARM_EL_EC_SHIFT) - | ARM_EL_IL - | (1 << 24) | (0xe << 20) | (7 << 14) - | (reg << 10) | (rt << 5) | 1); + syndrome =3D syn_cp10_rt_trap(1, 0xe, 7, reg, rt, 1); =20 raise_exception(env, EXCP_HYP_TRAP, syndrome, 2); } --=20 2.47.3 From nobody Sat May 30 20:12:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1776852944; cv=none; d=zohomail.com; s=zohoarc; b=UyK952/qfErdoFZQ9jBFotaPebKxv7q5YPswcuB0ynzB/8Jdio1mwC8IFDyUev0y1mnnjxZP2X3DvXKy5ojrEMK6zBOO3Kbv1m6MIYkchC4npU6M/4AD4h2aPI1HAC7bypaYmNWSDkXhe4RD7/by8ZlJbq2LJSiES3iA2uvVG2A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776852944; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=9fpr3Ng7R6+bvHtx79oLF5EYo5OylKP6gzyU2DP/N60=; b=VKYdK2RTCTxoNqCa+IGuwiHdPbJbOk1bmsjf054Wfs6Be0dv+UI5LZ9jsuFba12JobTHocU9iQzHF70OT0jq5BiOoESS3KuSVrbp/LhuTW5fkeeMNf5/06IhmyLF1xy9nqyVI+4qtqLgpxOVWZkd3cko0HoVZoDEwKnlWiWJKQs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776852944755340.9845500263616; Wed, 22 Apr 2026 03:15:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wFUYj-0007LU-7m; Wed, 22 Apr 2026 06:11:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wFUXt-0006vi-Qf for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:11:02 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wFUXq-0000o8-Sk for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:11:01 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-488ad135063so45769745e9.0 for ; Wed, 22 Apr 2026 03:10:58 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488fc1393f5sm410402795e9.9.2026.04.22.03.10.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 03:10:52 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id B1380610BC; Wed, 22 Apr 2026 11:10:44 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1776852657; x=1777457457; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9fpr3Ng7R6+bvHtx79oLF5EYo5OylKP6gzyU2DP/N60=; b=K3rXP9JgvR/oBPJaQBdpU2BDL3IfsCux20qPNp66Gjv5OGuT3kKUBbQAPXyXuLFuyC 0k+QlLXVOqH29/WWSl1dVrr1rgbnNYfeZjFbPECwRg2hUCnEbsFQXdRwNjBbOVMLfNJt V6VdiOINivX2IkE/T9F8+LEnuw62P6VUtT32JrQdV1Y07cjgB2fFR4d2HDL04GJI8bpF IwLNrY/eg7v9cXgMM/Xp78XFoydWXymitZ3yONeAFgo8Vdb5xSQ4gS5hJAV/Fg4ENT6l 3FTPXFNwjyeKw4JwXi7Zj3BH8ACyrg8krhBZ2TNykWZSCWHM5t2FxyVEBt/RFmCQD5wH vx6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776852657; x=1777457457; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=9fpr3Ng7R6+bvHtx79oLF5EYo5OylKP6gzyU2DP/N60=; b=mn19u2gqqquGC+Tvuevtg6jqdkz8Hv5XyV2S7QDLAUH22/TIP4ap6Z8qKB0QrbiFyk G9j8ComctqMzfpwB2HFsohAU8NN+ariEZt2LeYAXERQHJGp9RIaDU3e+8fgL9DAwKabr ZwRXKbqZzuskNpoAk/UVrR9k9MMDJWYa4r6o9u3Kb3+1I9Y8Kfg4tqLaWzC6KWn58bkC MIApN6J/1ow7Iq2tY6NIZ7R4EtwrSfmYdEhx3xNqRNd8+WpHrpgVERUg5FtgMwi9JKzy fpPmX/5g28BgE+889Ns28Gh9HKU+OJykd0bNm1S6dOo/Bg2EQf9gc0LgTtwe/iatAvyl tWPA== X-Gm-Message-State: AOJu0YwMYdsheLrASn0Q5AFsuBlEkM006N6l+yp2NMY0D46OLgcXy29M t+HlA2TsYLN9xhMzF5g7sK0csFsTrDbpUcxDiz9qFGGs0WrkFBAo0pcjcxcH41QMEI1ew/DYGbu N27X4j8c= X-Gm-Gg: AeBDieuJaPQQKFrWaKb9JgHvISXV08M+T6B1aJfgvSmUuu/00VMdq/0c7CCRNUnMGuj KMfXHEn9xgy01Mb6fwYwKDevJ21njPFjScpX50T4pJDNNBvpXqEWmjn/J713Wv8yMVlBA4nOefW 7By4sKJ04ROMI1munc/yBK7uf2hz9D4++jRapW5beKz+fKiR1BRTAwqEx6QauvOlo8aQNR62+zf olCQhM90uMRJj0Kt3ynVJW2yJurFg1uldtyVdlA5EHLfTw5+HY0gtYr89hYr0obbRGb3G/SAsjP NkrrIV6M8uAlEZNo4cO4i0kDKDBe2t89Y/7yu59x10y33hIsBYYJuImsp5ro4ubHjm9SX99Cd5C PVjR6a93Jy9+7l+hX8ARyonUZ1dpfU2WbvdvL41F3gdkxpM/GJv63GpsUxSnmaAx9zjdCXhRsfS Ev8Up9Xh6k2xuwDWvdLGI7GU6UESVVyIFBb4NeQXvW8o3A X-Received: by 2002:a05:600c:6990:b0:48a:5970:1fe1 with SMTP id 5b1f17b1804b1-48a597021eamr47506875e9.4.1776852657303; Wed, 22 Apr 2026 03:10:57 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , Mohamed Mediouni , kvm@vger.kernel.org, Pedro Barbuda , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Subject: [PATCH v2 16/31] target/arm: use syndrome helpers in arm_cpu_do_interrupt_aarch32_hyp Date: Wed, 22 Apr 2026 11:10:27 +0100 Message-ID: <20260422101043.1234229-17-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260422101043.1234229-1-alex.bennee@linaro.org> References: <20260422101043.1234229-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1776852946317154100 One more step towards dropping the old #defines. Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e --- v2 - drop excess brackets --- target/arm/helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 7389f2988c4..40dd070d2c1 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -8898,9 +8898,9 @@ static void arm_cpu_do_interrupt_aarch32_hyp(CPUState= *cs) */ if (cs->exception_index =3D=3D EXCP_PREFETCH_ABORT || (cs->exception_index =3D=3D EXCP_DATA_ABORT && - !(env->exception.syndrome & ARM_EL_ISV)) || + !FIELD_EX32(env->exception.syndrome, SYNDROME, IL)) || syn_get_ec(env->exception.syndrome) =3D=3D EC_UNCATEGORIZE= D) { - env->exception.syndrome &=3D ~ARM_EL_IL; + env->exception.syndrome =3D FIELD_DP32(env->exception.synd= rome, SYNDROME, IL, 0); } } env->cp15.esr_el[2] =3D env->exception.syndrome; --=20 2.47.3 From nobody Sat May 30 20:12:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1776852901; cv=none; d=zohomail.com; s=zohoarc; b=T2c1NSCtZyUazWpMt+k1vkE4isqXO3VldruBTO/14shByM4vxzUdw/rrgChWDBaDbFwiWpVcJaxjYRZCGdvFLTBSshT8jGdgaSAS0ytNM0aTY/mHEo66+5vSUgLT9OhZ+modRfjYM5ZjUMHjct8zgf0F9v1N4dgSX/M8Pc27Few= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776852901; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=SLzSB9spY+gJhXJ81HA2xrXzxJ07lupyVRDFchBeQ6c=; b=CIm4/GsKwxj72UTv/TQ23m6o/4lnoJs1vjM0lX3S8Z0ful3jeAUaNJgPq217Mw4qjgG35J/DJC228cLUyR1o1SMvHI/1N8G2qkCNMIssg4M0/785FWtDa/fYlo2DnYJUbP0Es8PVCSmr07V/ooYoboj/552RotwHRbcZ2wK7ySA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776852901016753.0060817589932; Wed, 22 Apr 2026 03:15:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wFUYj-0007M2-Vr; Wed, 22 Apr 2026 06:11:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wFUXt-0006vh-PH for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:11:01 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wFUXq-0000nX-L6 for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:11:01 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-488d2079582so61485865e9.2 for ; Wed, 22 Apr 2026 03:10:57 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48a5c24d82asm10781745e9.7.2026.04.22.03.10.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 03:10:52 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id C499F611A5; Wed, 22 Apr 2026 11:10:44 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1776852656; x=1777457456; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SLzSB9spY+gJhXJ81HA2xrXzxJ07lupyVRDFchBeQ6c=; b=d4gM5khCmHpu9D91ZCld3JFzYwrwylTKMx0kFeS8V5IUiyELHVX5MWS3NIcG8HGlMO +X/Lflq1VIIBiZE8MqwZ3uqDAAatz+RQU+aeMDlac4SspoaG/pZUpHoN00UZE4sNLE4K AWh78cdnuDcpviJcpI1pmuQIzW/Wfqdv55KRUnXsABHSXpAN21SAU7MU47NNQ/zQk3fv j+gnhMy/niHsBaYCb4mUn3hmNNpKCvBtqGkp0w5OuH6+jIMvTVukqjqNl99PwZkqRRVL 6xMKkN2xZti1LYDkzxYkI1xgnIo1A3IIgbtoVWquWAkjJDFyS8u858I7w0lxXKrX7drN j/6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776852656; x=1777457456; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=SLzSB9spY+gJhXJ81HA2xrXzxJ07lupyVRDFchBeQ6c=; b=ZFtJOe0rb9mu3ZQFnwKOic+bPjZIlapxfICI6Z9EtcGtL2/n/0L9vm43g4DCzxpRl+ ghnWXwEGjk/ySDoWsXCAG1gX+MJK1Dkg95/mYsrQcaq8tekmWZhi36VR0CxwUgQ/gePc htHsF+HLHoBZDwwgFaApvHL3pIuPArHetLMZhtp2/iR9x0BWl2iZw60anMwzEWQW09Zg N5cmxP5gysganQ4Vqp7pfcQf/D8PUYU/jS8SPejQoj8f1EettXEE63O9b/1JsVZvMgOe rS8Sq1IfDJD6PKEQd4Ww69ui9Z1D16aFG6sCWl/PsE71i3g3C6YL7RUiRouOpa1f8sss jBLA== X-Gm-Message-State: AOJu0YwbjD/I99o/+WtwotLDrQpAmRvsKe5VR3QzL1ZklurOkFj3OHYC Dgos/qPs8DdBn5cQQLe0GfK3vpnm5l4LvBKanu3pz4SWeKitD7UcHG4435Htlr3VfDw= X-Gm-Gg: AeBDiet+xIZV6z5aqzYheCOScqfGjcSA/cTUXePHD7ObWZ0BHK0HWT4Nz6UouldHMky nIWssQdQGjsS20UqzIRKAxMJqCKDhGZ1sU2dxfhkwlC0eCDlSVtAlQ0LE7U+dgP6mWCamFYTj5u Pr6HKmRcFov5MKOIieNjMPrELDrZV03YbUqD+ypWrHxfyEQwK5ul0EVAglaBzdYl0EfWas2j2r9 cLePkbLLRehXE+fisqXGESLOCc+UqWCFQVDgIuDTVzon5/68UMZSVaJoyjTMol2EIn9+m2+rdWH IqEUGpNfJjF0miPRmB5PleWnUaT71odK9GXa4BVWVLfvF4cfYwpogqMNxoXzGv531zToVtw0k8C LQyvUjsGoIjz4xEa/xSKgCHuwXZnvF+AO6uLpoODvrjhI3Dp7Fm/sJYV4BAZ7viNWTbOKg/Zrng Wrv3T8TabedHGVOeFsMz9v6W3zRstrU+YM2A== X-Received: by 2002:a05:600c:1993:b0:489:e696:836f with SMTP id 5b1f17b1804b1-489e69686a7mr153151745e9.10.1776852656556; Wed, 22 Apr 2026 03:10:56 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , Mohamed Mediouni , kvm@vger.kernel.org, Pedro Barbuda , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Subject: [PATCH v2 17/31] target/arm: use syndrome helpers to set SAME_EL EC bit Date: Wed, 22 Apr 2026 11:10:28 +0100 Message-ID: <20260422101043.1234229-18-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260422101043.1234229-1-alex.bennee@linaro.org> References: <20260422101043.1234229-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1776852903579154100 This removes the last use of ARM_EL_EC_SHIFT. Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e --- v2 - drop ARM_EL_EC_SHIFT at this point --- target/arm/syndrome.h | 1 - target/arm/tcg/debug.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h index 53137394e28..d4dfab8cd15 100644 --- a/target/arm/syndrome.h +++ b/target/arm/syndrome.h @@ -107,7 +107,6 @@ typedef enum { } GCSInstructionType; =20 #define ARM_EL_EC_LENGTH 6 -#define ARM_EL_EC_SHIFT 26 #define ARM_EL_IL_SHIFT 25 #define ARM_EL_ISV_SHIFT 24 #define ARM_EL_IL (1 << ARM_EL_IL_SHIFT) diff --git a/target/arm/tcg/debug.c b/target/arm/tcg/debug.c index 5214e3c08a8..07a52643e71 100644 --- a/target/arm/tcg/debug.c +++ b/target/arm/tcg/debug.c @@ -56,7 +56,7 @@ raise_exception_debug(CPUARMState *env, uint32_t excp, ui= nt32_t syndrome) * Similarly for watchpoint and breakpoint matches. */ assert(debug_el >=3D cur_el); - syndrome |=3D (debug_el =3D=3D cur_el) << ARM_EL_EC_SHIFT; + syndrome |=3D (debug_el =3D=3D cur_el) << R_SYNDROME_EC_SHIFT; raise_exception(env, excp, syndrome, debug_el); } =20 --=20 2.47.3 From nobody Sat May 30 20:12:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1776853119; cv=none; d=zohomail.com; s=zohoarc; b=FkNbLnSEFqWY4VDGz3AJqOeeLY5OC/iETSdsPhXAuNAF6W00DkDqH9jMIV5wD0Bcmq1woYGaCRKDR1sLadZVrsKy5uN8uYHRERaGD25NWrbKBwpeoM9T5v2nsOOJQAbeQvOiE5w71VuwEwUs4LRU+4FMZjcrimBfqqYNesBytZ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776853119; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=1esNeOF5ufpO0cAxHdsE5rjzSjC5Q+4Ajm02teJ1954=; b=RhUsNTMBD085G8hdTunEZ0kCTzZxzsVludUoQZcoL+F9DktAxFH/ySfEFPJCMlE2RBi/Wsi+qpZd7UVVVro5NWbytI59DQVgq5x81KW0vCPElnThnHPxqCWVWyJInvWCwy9yK4GRoMfrmVWV+k53UKHldG0yjNIHz8zFX7vePCg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776853119922366.63172977101556; Wed, 22 Apr 2026 03:18:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wFUey-0007Vd-Ke; Wed, 22 Apr 2026 06:18:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wFUeN-0006z3-SA for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:17:45 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wFUeL-0002Op-GF for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:17:43 -0400 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-43eada6d900so5191194f8f.0 for ; Wed, 22 Apr 2026 03:17:34 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43fe4e4d5b1sm48556243f8f.30.2026.04.22.03.17.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 03:17:28 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id D6D1F611AD; Wed, 22 Apr 2026 11:10:44 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1776853053; x=1777457853; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1esNeOF5ufpO0cAxHdsE5rjzSjC5Q+4Ajm02teJ1954=; b=qxV6nDO/0F+3rFI7BAQwKgiX8CLJJMKNhXEmm2x6nHXLLYVsmWlqZaHWyvBh+z5E6o tApwgXOsBQbXIClOnHFXmMVTSboyFBo1EHOOdFcD7ZUVSWZNPKEHRt1InpZ8QW7G3569 WRfu7ocCY3Vo3zYPx0bpXZma6rFFNDCHQZVK7AuEiLpVVYSdxjgNdjrt0hJRbo9VItFC DAnzSkISW/KIKlx4Fv2s2MTkMgWtIsDr3lXeyeYIUU1LstgMYvsTDfjelcSOvv+FTIG3 tp2k/54D/MZYw2/41ZkTbdHu2VT1ZMJkbcXt5oPshmlbHr7u/s/8/A6bt37tIB1rmrTO Fihw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776853053; x=1777457853; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=1esNeOF5ufpO0cAxHdsE5rjzSjC5Q+4Ajm02teJ1954=; b=dy0XbrqkzXwfWMFOYB4Jg19rirQ5hUz7+0F4chtAHyhBe7v3cGMZkZfEs7yJA/ZHPP 6b1+2KLOqL1eDLuBslFxugg3Jt15quNr6kBNavx0//pI+EgyvbNEL/0I4qK/65IFXw8O gV3r64Y1pdf/7jZcMtgbnEnNy3co8Mh3iJunJweQgkEsWUuzcOGAG132o/zfjOz3xZFi W/rN3j4Ovic0t70KscyhH4r1lxDvk//IoiaFAG7SHt2IEUTMtbW0Gj3XY+8UHifq2DKb bX8Z/36IK4cxDyNOduG8Qw8M7F2KHV0bGujrtoYb4amC552+LKRmdjavb3Esrc0WZ68G AlKg== X-Gm-Message-State: AOJu0YwUAsGdVS1rD5A1InCgTey1PLyn0LAPbUQo7u9VYTKynD0v3Eqb BqooaKCcjsmpX78GylkvXuPk6LUHHyc3DD82KwIOBI+2t+gFXLojo4mSEV66J9DGgY4= X-Gm-Gg: AeBDieu9gUK0Nv65nfhPf3Aoo59zF402lDPX8B0Zh3b2iU7Lp7P7OF1LMmV0L6p3io5 RpnOU2OsgHk7rnOMww5KcVx4KOPbJS8BU811TSMO1+x6Tpou3IA+HS5N2+5Q7TXeJdN7Z48K2uf 40ujvmDmGLnD/JWlqoNmZ6/EsKIglTXf6BBsq/S25RImhx9M0bw5kIauGxn1B/reRafxGVNoWaz 7/07OrR/XJse69tYIshc32oebGNzOv/1fr7NKfXSQDgu6WDtCbZgcGoywWx1Zv+cdziOue+jpCF HqEvGtXDTvYOOqTUQvjADyeDvvMLHFHZHCPGCQIUePABgeGblM61ihRfpqCTzaIAajh1omXZGU1 SKtVukNc8fAn9GlqljC+vzr9fuQBBCd7uyHQIHa8e8QuMZCRghPdextKMDD3d/EeFsaxKj7Wz1X 9JE4SAMUcDV7LbasNtuAlTsjJei3jvMR9wOA== X-Received: by 2002:a5d:5f43:0:b0:43c:fde6:212d with SMTP id ffacd0b85a97d-43fe3e13d46mr34364660f8f.33.1776853053246; Wed, 22 Apr 2026 03:17:33 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , Mohamed Mediouni , kvm@vger.kernel.org, Pedro Barbuda , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Subject: [PATCH v2 18/31] target/arm: make whpx use syndrome helpers for decode Date: Wed, 22 Apr 2026 11:10:29 +0100 Message-ID: <20260422101043.1234229-19-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260422101043.1234229-1-alex.bennee@linaro.org> References: <20260422101043.1234229-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1776853123027154100 Rather than open coding a bunch of shifts and masks we can use the syndrome definitions. While we are at it assert it really is a EC_DATAABORT. Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e --- target/arm/whpx/whpx-all.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/target/arm/whpx/whpx-all.c b/target/arm/whpx/whpx-all.c index bbf0f6be961..4cfc7f99698 100644 --- a/target/arm/whpx/whpx-all.c +++ b/target/arm/whpx/whpx-all.c @@ -356,15 +356,16 @@ static int whpx_handle_mmio(CPUState *cpu, WHV_MEMORY= _ACCESS_CONTEXT *ctx) { uint64_t syndrome =3D ctx->Syndrome; =20 - bool isv =3D syndrome & ARM_EL_ISV; - bool iswrite =3D (syndrome >> 6) & 1; - bool sse =3D (syndrome >> 21) & 1; - uint32_t sas =3D (syndrome >> 22) & 3; + bool isv =3D FIELD_EX32(syndrome, DABORT_ISS, ISV); + bool iswrite =3D FIELD_EX32(syndrome, DABORT_ISS, WNR); + bool sse =3D FIELD_EX32(syndrome, DABORT_ISS, SSE); + uint32_t sas =3D FIELD_EX32(syndrome, DABORT_ISS, SAS); uint32_t len =3D 1 << sas; - uint32_t srt =3D (syndrome >> 16) & 0x1f; - uint32_t cm =3D (syndrome >> 8) & 0x1; + uint32_t srt =3D FIELD_EX32(syndrome, DABORT_ISS, SRT); + uint32_t cm =3D FIELD_EX32(syndrome, DABORT_ISS, CM); uint64_t val =3D 0; =20 + assert(syn_get_ec(syndrome) =3D=3D EC_DATAABORT); assert(!cm); assert(isv); =20 --=20 2.47.3 From nobody Sat May 30 20:12:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1776853118; cv=none; d=zohomail.com; s=zohoarc; b=OPrq919Xeku5OrjXy665fQv41UsQyXO2IcqFmDaTooXScmx0WmOvHSDbhEz6G60EieO75yJ4CUMneSMPCau05sW5OUneRZenP5cfqMXpKXOG2UNEBlKcGXXpQW7W8SlE3NZTNImLVwE7WFzrUh4eAd7AyeYP/IaD/vP0qN6cuQs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776853118; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=yq/bGIVh38nrtfwG2BReGAMOSU3dNrWCtccK7bpObt0=; b=UQ92Z06sQsQ+5ssEtNgh4AoKXVKSaVaP/HN1mEYOtCj/GLDHJhP9IfhZ9bVcAslCxlVzdVWTkh6V/eD3hfFrrrG0HL75nxsy+EkSvhwk9xokHQrOUmqtoaxAUmanngzv9XXeJGD6IVVbXuF04DtnTunlKxRYkF0sqrtDApWL+Rw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776853118083985.0352526030397; Wed, 22 Apr 2026 03:18:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wFUes-0007QQ-Ep; Wed, 22 Apr 2026 06:18:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wFUeN-0006z0-RZ for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:17:45 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wFUeJ-0002Pn-KP for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:17:42 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-4891cd41959so33540935e9.3 for ; Wed, 22 Apr 2026 03:17:34 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48a55dc9f58sm266237205e9.6.2026.04.22.03.17.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 03:17:33 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id E967F611CD; Wed, 22 Apr 2026 11:10:44 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1776853054; x=1777457854; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yq/bGIVh38nrtfwG2BReGAMOSU3dNrWCtccK7bpObt0=; b=R/Hnzk4LIMg5tAbF/6UzousfLH4uiWqR5BUnfAMyCjwhhdqiqSdIO/gpj8nnxuc7qx CrcmzgfswyC6nBNVWsGjpAnGNYcbgRkQBBAb8l527kmFK2M/NlLxq+8U7n0E7r22xXiC W7zUIGnkVOgMk2r7j4kHnqFH2cMlnKdnefDs0LYeh1uLdvKYK4DDVn6YG5pfB+VcczM7 84Aw8CKY4NQhujS7lHt1eb/wk+iyuftiQ4Diei19eRrjyFgEOZyFCRBQxMZqqfx7zZRQ to0EUAuim/apqZOWRd2qjiO5vShK03c10z8BnP1jNhjdH8ZJBn/7o+z032IDFwjW4b0o yqYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776853054; x=1777457854; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=yq/bGIVh38nrtfwG2BReGAMOSU3dNrWCtccK7bpObt0=; b=EUiSVslQlDNdhuLTRbf5WFurjETPwT/x+zStcCiysLDShRHJD7jqe9p4sjVoIC4Aqu DhKk26a5PkUL5UDB/Mkl5UBp6sZfEx9cCPk76Uo/psUpqLLLEYOSCyNITah7ySnSnOjB wcQ6ZOOD2hS8TfGUL9x2r8LGCS2ouN3SPYlTtFGJ9v7HwJLz9jZBWuI4r5TDf8V1Myn6 yLZqQYv6zCRq1cxrE+EEdjc1QmlxKAotaiARkjxRgi3/lIvxpazZlcgSy3maKBL2hgKk W+13N8r9WeDkaS74saSSrBzl2y6WdIviDfO3sprsk1AEz2MwJubE+XIsBIw6JtDt8kEs XzGQ== X-Gm-Message-State: AOJu0YyJIjMbhhUGo2l3fvkJgzc42ZHBUVuchJXlUAipmnzD9w2LmGqf b8gDuukcTnaZ8qRNT7sRV6gSj0LmRbA+21wYA3U06xRTpLGhZB7nF28nSp/TUA8zMw8= X-Gm-Gg: AeBDietoW5DN4wA4WpJONu79fPruOOKSfjqp+Q9N15M2NUQfi2UlZj1lPT1/iHG/rWA niNgOYn1m6JSDvhXUPw25mXq4ezMe8oG7/4hMrtmTRESmfi2QSbsKkRDz+lxSugsJ9G3JZ3WM++ WkzVte7CTHOrIWWl1EQXN5Oq5m/KGf/9mwBfUeNebHcVWB6zpjpRfWVrPKwlDkdRYXKNDdDUVAD OjppyUH8USpyTj3I2X4BuuUIHp8FqXk82pECC7XgjJsp6YLpt2FxkhouarYEx4qZO5/781ffrOT WkclQzf1ZZZYkUf7UR+nyhPDR22860GIAQ9opao2fQBL1eh7K3kX3bPp5RqFqOaXg+NYNh27zQM UsHFkm7sR55YCahFkOHvmw5V7ctO9YAfR8bOTlGK2VTHUyhnlKAqNe/nASt4MfSiYCvYLC9gosJ 9ueEc7IDXSBpGVnBVBMqzcpZ+WQdqK03RqXw== X-Received: by 2002:a05:600c:c0d5:b0:488:c683:be89 with SMTP id 5b1f17b1804b1-488fb74dffemr240575745e9.9.1776853053932; Wed, 22 Apr 2026 03:17:33 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , Mohamed Mediouni , kvm@vger.kernel.org, Pedro Barbuda , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Subject: [PATCH v2 19/31] target/arm: make hvf use syndrome helpers for decode Date: Wed, 22 Apr 2026 11:10:30 +0100 Message-ID: <20260422101043.1234229-20-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260422101043.1234229-1-alex.bennee@linaro.org> References: <20260422101043.1234229-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1776853119609158500 Rather than open coding a bunch of shifts and masks we can use the syndrome definitions. Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e --- target/arm/hvf/hvf.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index 5fc8f6bbbd9..1c1c31f0b15 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -2123,14 +2123,14 @@ static int hvf_handle_exception(CPUState *cpu, hv_v= cpu_exit_exception_t *excp) break; } case EC_DATAABORT: { - bool isv =3D syndrome & ARM_EL_ISV; - bool iswrite =3D (syndrome >> 6) & 1; - bool s1ptw =3D (syndrome >> 7) & 1; - bool sse =3D (syndrome >> 21) & 1; - uint32_t sas =3D (syndrome >> 22) & 3; + bool isv =3D FIELD_EX32(syndrome, DABORT_ISS, ISV); + bool iswrite =3D FIELD_EX32(syndrome, DABORT_ISS, WNR); + bool s1ptw =3D FIELD_EX32(syndrome, DABORT_ISS, S1PTW); + bool sse =3D FIELD_EX32(syndrome, DABORT_ISS, SSE); + uint32_t sas =3D FIELD_EX32(syndrome, DABORT_ISS, SAS); uint32_t len =3D 1 << sas; - uint32_t srt =3D (syndrome >> 16) & 0x1f; - uint32_t cm =3D (syndrome >> 8) & 0x1; + uint32_t srt =3D FIELD_EX32(syndrome, DABORT_ISS, SRT); + uint32_t cm =3D FIELD_EX32(syndrome, DABORT_ISS, CM); uint64_t val =3D 0; uint64_t ipa =3D excp->physical_address; AddressSpace *as =3D cpu_get_address_space(cpu, ARMASIdx_NS); --=20 2.47.3 From nobody Sat May 30 20:12:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1776853078; cv=none; d=zohomail.com; s=zohoarc; b=YjTppt6hOugE8FVpef8i6g3/xU5MbiMV1mlcsRqY0GQbzpu3EeJXm8UWovrC8gI28xXSSCDzH5jIaBWVLnG1ezGaArDIOJFEIp+wN2iAFUD2wLhsdWWhDlGWTPGeG+4Y9z3n63cANDwYVxzwh/93ulOOmb97ujLdec7okzxkrXQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776853078; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=rop61lo3CsCy/AA+flQ6RjC7mnHYxt45F3om3vFlXxk=; b=feSDbGFkBucVDogKtcl1t/uFbziFDMxnaNlkHcO1zEhUNskcJcVj89PE6x4GAWLnI6EDxzX/h0vv/GVMfvwi05BDdcVg/HhvHwxvUcdqbZXE9aGrHHgnAJCrDQzIzMd+6bzPlysKyzeF0yjEBKa0bUslHZGUYwJKPkODFOPSgtE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776853078707108.81068047426606; Wed, 22 Apr 2026 03:17:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wFUeL-0006yU-IH; Wed, 22 Apr 2026 06:17:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wFUeD-0006xy-TU for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:17:35 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wFUe8-0002MZ-8D for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:17:32 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-48a3e9862f0so19902685e9.1 for ; Wed, 22 Apr 2026 03:17:26 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43fe4e46898sm46560662f8f.27.2026.04.22.03.17.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 03:17:24 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 08B4E612AD; Wed, 22 Apr 2026 11:10:45 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1776853046; x=1777457846; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rop61lo3CsCy/AA+flQ6RjC7mnHYxt45F3om3vFlXxk=; b=dgQmp58Fs0NsPN5cCZ9jCVqKhIuJ/Y4bg01PcHOneJGIk5Es5VqpTlbybpn2U/rseo qeTfx/HLt4yCGHietOInV4eJhNwZLSUj8W3Kehe+YCpjGvxuP8CdqQSHzOk0i2RJTVuu vuJ+B7mnOXeNhirJTebe5QRMsgam6Qpj+x6Bz2tnVwn3v8UiJ6eCm0qgpHjQPSv2KfNU W+bVbTG3pkV2pfp5682qTCifYIjA+mTbOl2r5/qFacGCAyLVIR8ld875r+M7npndkxqY R9nJ7SXZqe9qgUHVzxg8TmtMX38vLrq7MxfDnJ2CVdl5aoCcTMw4Su8FLMoxoZ9Aipw1 lY7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776853046; x=1777457846; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=rop61lo3CsCy/AA+flQ6RjC7mnHYxt45F3om3vFlXxk=; b=OrZrEwecbUnXXVKlNA4WMV7PixbBEcqAFnliKl7524wZqeAC50fb7cF5499RRsHHdA BS3QfNQ/xYpEZ/tx33JsvbkNleMIRB8SyvEhUJosY4j685TO9KbIjP9mr0VYk0NnqrO1 1nbGQB+UnS1u/EcZ4TaDOXVkdRbWktBytXQs2/ROkkTUCUpnbHMRbnb2cYbKoqmccf7u kgGcbF+LLKcqssz9I/23XjBEIjQ4MVoHKoaxyV0XGOKyqrTErLK16UPT4zgJoX9FPQRk U0s4ozjn0f8uM+/sLN2pvDjFOIWnS5MtQyItU9IsArtP0ctit+HgTIHsMInlSgjPg1YP cSlA== X-Gm-Message-State: AOJu0YwOi1KcvVikRcOvaDASLTEdNRwJmSZSvJeNsBgRjdiSRVtMGxKy FvHjPyTAR3+/O5shOdyU47bxaTxPrrgG1XEh+iGjQWkjYhx//UdT4GMrf6G+77dMfPg= X-Gm-Gg: AeBDietbmlbuRr3O3ThgudkmizktdnXJLLIksabKzyq8AlfJ8TsNRJS31WvBZ696dKp QBv36LJZSisExrMnkFs5IE3WcByTz67VAUSyKp6ciDHn3XGQ5zQk9kPBvTHf09nCzwXoucPo4Bi t9JF6IDjw+2VohGQ6dipBRiHSusIWw3mTgD2hV0ghc5yqQjlH6F3JlTqBI+S3eqtrTJSXEQFn4G aHAX1q0sqoC9XUsWSMuLlt+vhAW/QR95bpXs7HD0GtFt8NZVZaC0kNAtvhJgUwZtUuNdcrle0oU VtaXYgokNwxtldaC7P3NSvZanvHEbeSFmyE/D2qyLdsPHg/7Pf2frFkJWej2Xo2K4CP09H1Bi8J laW5pegfA7LPm6xnPb0OJSK/beHF4U4INxC85FWlQqDKcUMOkwzTIVTrYgUzhiQpLQoOJPR0IF9 c881ZQDOjpeuTYh53W3lOSXp34Qt5WK8s2Cg== X-Received: by 2002:a05:600c:570f:b0:488:a502:8955 with SMTP id 5b1f17b1804b1-488fb882f13mr231449795e9.4.1776853045759; Wed, 22 Apr 2026 03:17:25 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , Mohamed Mediouni , kvm@vger.kernel.org, Pedro Barbuda , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Subject: [PATCH v2 20/31] target/arm: use syndrome helpers in merge_syn_data_abort Date: Wed, 22 Apr 2026 11:10:31 +0100 Message-ID: <20260422101043.1234229-21-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260422101043.1234229-1-alex.bennee@linaro.org> References: <20260422101043.1234229-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1776853079480158500 One more step to removing the old defines. Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e --- target/arm/tcg/tlb_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/tcg/tlb_helper.c b/target/arm/tcg/tlb_helper.c index 565954269f9..c74d8e785a6 100644 --- a/target/arm/tcg/tlb_helper.c +++ b/target/arm/tcg/tlb_helper.c @@ -56,7 +56,7 @@ static inline uint64_t merge_syn_data_abort(uint32_t temp= late_syn, */ assert(!fi->stage2); syn =3D syn_data_abort_vncr(fi->ea, is_write, fsc); - } else if (!(template_syn & ARM_EL_ISV) || target_el !=3D 2 + } else if (!FIELD_EX32(template_syn, DABORT_ISS, ISV) || target_el != =3D 2 || fi->s1ptw || !fi->stage2) { syn =3D syn_data_abort_no_iss(same_el, 0, fi->ea, 0, fi->s1ptw, is_write, fsc); --=20 2.47.3 From nobody Sat May 30 20:12:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1776852780; cv=none; d=zohomail.com; s=zohoarc; b=nV1xwuLkanCpnP2e5+Xp0vDi6jPp45EFSAMRZ2nEXizXRLXXS6Qrp57hEeIB7XOKKH4N/OgM+UlUTOcP45fYs0jE5r0LHbCDOX1+OA4JvznZaNuoQZhYBS4lY0AOXvEIRx2lWb31x2sySqTw39kF8nRu9wRLaPm1/e9OMsswoQs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776852780; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=kgu1+4lGM6dZXG0uV8Iil1k3pEDxsUz8IH6/W2kJVsY=; b=Q7FmsK2CoHROL/LfCdNJ6rteTWehEp3Fo73pnZoT9TrL3r58TQt56Sb0tJEOcDRZ4i/4CUcK+XJqxAjUX9k9OtkMlnN0fJCDiDgfLGkdsjy6OcsP5vbZQXaWo7tHppOYt6HO/RIHFVyR1HDEIpdRW5p0CLsXRM3jqJxyD7UeM3Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776852780769283.3515925442981; Wed, 22 Apr 2026 03:13:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wFUYk-0007MT-Ko; Wed, 22 Apr 2026 06:11:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wFUXv-0006wQ-2W for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:11:03 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wFUXs-0000pH-OP for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:11:02 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-488b3f8fa2bso56389515e9.1 for ; Wed, 22 Apr 2026 03:10:59 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43fe4e4633bsm44099622f8f.26.2026.04.22.03.10.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 03:10:53 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 1B610614A1; Wed, 22 Apr 2026 11:10:45 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1776852659; x=1777457459; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kgu1+4lGM6dZXG0uV8Iil1k3pEDxsUz8IH6/W2kJVsY=; b=da3PKY+B1lHfDFNrpkxoY16rFBIc9UZ8yqwXhVye6y7JlisZiDMp6Fpfw0SzKJ9BBy MXKIyv0rUZr+M40vvzmKXm6Pyr5CB7uJPSOrq/muzbmEevUG+xv0Gl4YZXx0iIa5KyLk QBfb8AIO1QtO1iLSK5kcJc6mXDr7bzJ66NDqjI36DQ69d+XvzDABfhpMnoGRsJ08X8LF BNTJyhOsxsQFbh3c03PDekDTngoRZt/MdzAPKTHupOhJHkPm0gtK1IzFiXoTUMA0qwP7 VnDoYG1w+/YwDTwEBADm/cB1q+0vOEKQ766StqfbFtcvcOepuQpKneh/x9z35HGUy69L hoJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776852659; x=1777457459; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=kgu1+4lGM6dZXG0uV8Iil1k3pEDxsUz8IH6/W2kJVsY=; b=k49TXd8kcXFoj+ibWcCiGg+E20HpAOSxVWRefFcITNHNjcCwRzNhL+5V0gqlBM2kn7 VggryMiznb8B5xnC+Q4u9M81PoAR3r2GBuVRywm9QrFkYWQmEbYg2jLBzdE67ulnru2g /6gBA64TY3KOLV3Ur28syjIjuMa3w35V52WIiuHzefre9nadTInXUSXc2GL5Y9XTiGMa DNmbjqx60UzEpXW4l+QDSFu3A57RzTvPf892RGTr9BCfBrBp+zAwcfg0Rj/QxOr73V6Q KL5PGrSeLDYGx8a9BW2XG430OtTFhdWF7rIY8b0ux9VFR3qgAKh76umgOREs0Aw/Bx+8 dTEA== X-Gm-Message-State: AOJu0YxBsrZRYFCE9aTccC5RWyWWnqCgqd2zeQu/TT+w9jiveb+a1Kl2 irXibHL4cVlVGrYO1nyAO2YTYw7+zMVP7TbGPvhrqpgwyL0pZ4aF1vN63DBv9WlPyi4= X-Gm-Gg: AeBDieuhdvFJTCDbNazYh6sG8KqxrhSozHXW1u+dJVC6GFsIlOrOrm1LqVuLpZOnZCM rQ4cgpsfGdcAmSGHTY5bBWCMiLPevVuObMzkXoHQJy0MSTwgQMBOMp+A53JoCttif7dBWQBim88 tmT4b3oRTFpHjBf20GAcKuLIFEf5Yf7/E6qljlfOfcQl+zHZnKt41RjS+bMdzrfAefhMHBkMzui Gt87syfUx6D51YS+qHcIheJCeGrH6pu9bWnPhqoXCE3TP0ep/dYOmYAHZcCY0Xbmdz7hgwl4w1k gVZRUxM2Rz4TSnT6Kwdd6fEDRPgDv9Xu1MYhMQ5lYsUDqpFg3QYGcdZ+FWXbvmx6a1uJj7qTKGR beDwceXZT2FaEem+qvnmyd1mXWJyYOtgwLksec/p9TQdP57QpNfDPE0DqBDtKb4Rc0H2QructH2 POgUqbp1hEnUUmONYtV2m7Xm952tEdDvsl3g== X-Received: by 2002:a05:600c:1444:b0:489:1c0d:c9cb with SMTP id 5b1f17b1804b1-4891c0dcaa5mr145715445e9.5.1776852658688; Wed, 22 Apr 2026 03:10:58 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , Mohamed Mediouni , kvm@vger.kernel.org, Pedro Barbuda , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Subject: [PATCH v2 21/31] target/arm: use syndrome helpers to query VNCR bit Date: Wed, 22 Apr 2026 11:10:32 +0100 Message-ID: <20260422101043.1234229-22-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260422101043.1234229-1-alex.bennee@linaro.org> References: <20260422101043.1234229-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1776852783742154100 These are only valid for data abort syndromes. Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e --- target/arm/tcg/tlb_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/arm/tcg/tlb_helper.c b/target/arm/tcg/tlb_helper.c index c74d8e785a6..bbe1e70bc43 100644 --- a/target/arm/tcg/tlb_helper.c +++ b/target/arm/tcg/tlb_helper.c @@ -48,7 +48,7 @@ static inline uint64_t merge_syn_data_abort(uint32_t temp= late_syn, * ST64BV, or ST64BV0 insns report syndrome info even for stage-1 * faults and regardless of the target EL. */ - if (template_syn & ARM_EL_VNCR) { + if (FIELD_EX32(template_syn, DABORT_ISS, VNCR)) { /* * FEAT_NV2 faults on accesses via VNCR_EL2 are a special case: * they are always reported as "same EL", even though we are going @@ -190,7 +190,7 @@ void arm_deliver_fault(ARMCPU *cpu, vaddr addr, * because we masked that out in disas_set_insn_syndrome()) */ bool is_vncr =3D (access_type !=3D MMU_INST_FETCH) && - (env->exception.syndrome & ARM_EL_VNCR); + FIELD_EX32(env->exception.syndrome, DABORT_ISS, VNCR); =20 if (is_vncr) { /* FEAT_NV2 faults on accesses via VNCR_EL2 go to EL2 */ --=20 2.47.3 From nobody Sat May 30 20:12:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1776853175; cv=none; d=zohomail.com; s=zohoarc; b=EqFDt7U5lFXVCFNeRPPAT4i4ZmF1YlHsbD0YRV/xnUbC2WNXhAEiaE5L8RYUKeYAcku6KbpF2azPeqDij1VL2iEfwBqdGqZeHVxD5jUeEfR8Led3Bys78Rk5dujrHLPEOmHaskv7+2gg7fNQOagL5Yhnn6HD05J+dIjOZNC29Z0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776853175; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=UF2x3LQsFVeOwuh4smvXIT3vMnoh5OJHhwB45pzXnIE=; b=IYGyjKWchLMMbkQ5RQodX4CvwyQLtoyoWQZ/38++5Dy2oE65N1kOGvgGxQ+G3jIs1SHgPg5xpYaZyyT8Vg+Sc0wOrxffYn9GlKFW4KiK+HcbqQ+SU47CH/i+lUwXiKJgR/6nbSdg0njVm/zOgbF3Pfp4HigcwOvrZdq0hqCa4o4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776853175264747.1906277562996; Wed, 22 Apr 2026 03:19:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wFUen-0007DZ-DE; Wed, 22 Apr 2026 06:18:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wFUeM-0006yr-74 for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:17:43 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wFUeD-0002Mr-Nh for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:17:37 -0400 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-43fe608cb92so3662288f8f.2 for ; Wed, 22 Apr 2026 03:17:28 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43fe4e4d525sm42572233f8f.31.2026.04.22.03.17.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 03:17:24 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 2F18F614A7; Wed, 22 Apr 2026 11:10:45 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1776853047; x=1777457847; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UF2x3LQsFVeOwuh4smvXIT3vMnoh5OJHhwB45pzXnIE=; b=EBhtq0Thxa3UEOH1ExBQBxahJvatpOmpfzKJM0j7Enjgt5REr0VkNqJB0/gJfqZiSW HJQanXenqRwRqEPLyB5YrmDtYYcD9SbDR7pOY1t9IiXBzxsSMlDBTECCGslHlItg+9WT 7xCrocsQ7K2fJ3zvzb8bhebSceLj1YJyPdZjTHGTvIdCApAbPtPbW6oi3/xIKHDW8K3J QbS3+PsnmnaZUr3q/Dy2faycyA71u/pKkgVoFc5tQJxlhjN/sPfi4DBpwoa1QOTGMk2x Gf6hWY8491OTlgFPO4pJ+1jHWt+LZZd8aUO50QiqMZGP51H58xAeEvL7jHVkS4E8d1P9 a18g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776853047; x=1777457847; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=UF2x3LQsFVeOwuh4smvXIT3vMnoh5OJHhwB45pzXnIE=; b=o5/V9IVwddIT8s2ea/8DOxzO06oFhCVhajD1FGiimNc39gdxAst7fObvF0AmaZfrXf DgMKipR2GuoHezYCs3S+OLDebGZiQo0tUFEPtM0rhmpV0TbKlYAc/rwDFIODxwI0TNrE WX9F9W+aZOuxD8GFNndCFNG6y1fScdYlJ6BQjtOxlpyqURUxl5UHtikPxi+zbKgKX/5O RMCQczIXgBjjZdehLTI/8lA52CaMhHyHp9eRVH7/A9U8dDfOjEtfK6t3P6tC5OyBGjko 0pNP3UqgOb4isSgANO/ZP6TDRQPynAypcGDqdz5GYvmQZsQvdOCmtM+4lFROKZcJMJuw TVIw== X-Gm-Message-State: AOJu0Yz7e5a1iL8rIFRDWfyzdBB7Og055DbBU33JdXIeBU84BC0IxV7U WqXItom/IJ8hjxe3gr2VwbFV/AQE9w7jB22s7C4pOU0EUNPRtfjXeNwdUmZV46omACQ= X-Gm-Gg: AeBDies66J1IRp6NG3thWkzgiAcPtAPMczhiYqPIa9CsWgQg6+ex4yYd9gu6ehavbIp OZOZmAn8bRO5NczkdEayBdcGTc1rSFAIxvDsGsUmVv82rNUkxf/Vy3gjAMz94KsjFiFxSy3oNrx SNfVImJdqEV9KkEQgZa49pYuF+ePAEQkNgqcUfOlozGa085WyCwryb3SKXEbfsjY2rUdyV8sNs6 EeUqDxwVIXs1wexmK3nf8QJM/A03LZSFKM5NDc5BHUiZc/cezXlepsBZkvdi2B0p8Ia2PaScexW URNd4cy+ojeYz0c+uGLrwzQo6XoDj+LIpA0nvMMtrzU4xYeT94Ng+hMoVluhMnsDk9JZisa8++p 8CaVl9n57hptYef5yXwkm0jzMzwmg47A0k9QONkrvMKhygFFZUDFraMWeOTX5NqfOKndGk1CRg5 Z3gFlZl8HJhuJg7J34wMX0CsjFkSydOZeGlrhRoxUMdIhb X-Received: by 2002:a05:6000:24c8:b0:43d:70b3:7edf with SMTP id ffacd0b85a97d-43fe3dc5386mr35212015f8f.12.1776853047494; Wed, 22 Apr 2026 03:17:27 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , Mohamed Mediouni , kvm@vger.kernel.org, Pedro Barbuda , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Subject: [PATCH v2 22/31] target/arm: remove old syndrome defines Date: Wed, 22 Apr 2026 11:10:33 +0100 Message-ID: <20260422101043.1234229-23-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260422101043.1234229-1-alex.bennee@linaro.org> References: <20260422101043.1234229-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1776853176169154100 Now everything is defined with registerfields we can drop the old defines. Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e --- v2 - remove stuff dropped earlier --- target/arm/syndrome.h | 9 --------- 1 file changed, 9 deletions(-) diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h index d4dfab8cd15..04a71eebcb5 100644 --- a/target/arm/syndrome.h +++ b/target/arm/syndrome.h @@ -106,15 +106,6 @@ typedef enum { GCS_IT_GCSPOPX =3D 9, } GCSInstructionType; =20 -#define ARM_EL_EC_LENGTH 6 -#define ARM_EL_IL_SHIFT 25 -#define ARM_EL_ISV_SHIFT 24 -#define ARM_EL_IL (1 << ARM_EL_IL_SHIFT) -#define ARM_EL_ISV (1 << ARM_EL_ISV_SHIFT) - -/* In the Data Abort syndrome */ -#define ARM_EL_VNCR (1 << 13) - static inline uint32_t syn_get_ec(uint32_t syn) { return FIELD_EX32(syn, SYNDROME, EC); --=20 2.47.3 From nobody Sat May 30 20:12:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1776853092; cv=none; d=zohomail.com; s=zohoarc; b=iJ1A2BdExAexk/8zPkm5nygSqzPbLaFuqSiZynE7seL1FMKFsDTJEfHqtTCT5IueuckBrC/mUccuEAiesiVM/+J+k85jsPUcGGpWFM72iT66D8lcVK0Z2qFxcJ9zchxfpInqp/+NvLXrkPp/N+Ze5NnNfAlS78aCK46GOijkJGw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776853092; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=reUwRDuVhNbhnF2K13EHapoGcij9kmY6U8ucQNXXySM=; b=cAR9PSS14hl+1ZBk5TTc0qTiDO5hHUDgBeIoHk0MATbkFQU7OzGbzKWuGfN8iTkjiJ7QQE1whpjT5uISouEXSmCICouTygKAuxpGP4pNotP0Y3oTTTvQZWqZJfsQyjB5IA6rxTtMpNyix+0brEwEhtDlKPemY4OIq2gRyDs0maQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776853092293402.76142221622877; Wed, 22 Apr 2026 03:18:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wFUeY-00073C-KL; Wed, 22 Apr 2026 06:17:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wFUeM-0006yu-6m for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:17:43 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wFUeD-0002NF-O9 for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:17:38 -0400 Received: by mail-wr1-x443.google.com with SMTP id ffacd0b85a97d-43d74086e5bso5204772f8f.0 for ; Wed, 22 Apr 2026 03:17:30 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43fe4e4d112sm49087054f8f.29.2026.04.22.03.17.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 03:17:28 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 45F47614FF; Wed, 22 Apr 2026 11:10:45 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1776853049; x=1777457849; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=reUwRDuVhNbhnF2K13EHapoGcij9kmY6U8ucQNXXySM=; b=NO6kdczo0uFwacby8k1t3VqM/gZIGsas+g3t/J4pJHrHs1SdT0Z2Le0Wtbf6VyUUFn /J3m5dLjokCu6Boal44tweRb6/SIeUotaWhc2IJkpwJD/m7D5C5HkDdfTFxTFStZu1W5 NuI6gxoIWc2itVouyWuNQ86XPzo1EQ0nlL6pXp042M+bNkbAW9bcwY7jQCf4cLutFrnz P4lqh7OU/XO5EVEl3snRcYe3GlbHxpz3/xqWOz65dSzCoN8MJZnDHGgT9Oh3q5DH9Re9 kEyDVkso/lcx42hoaHULaHXW/sZYbd7Hh3tL0T7frqK6RJmKn1RPgqKKTOW5NHeT7cen LjCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776853049; x=1777457849; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=reUwRDuVhNbhnF2K13EHapoGcij9kmY6U8ucQNXXySM=; b=GdEJ8KsPGfZ+ei1LpdyT2wLAiYcgDDJDqfhoK65Az5FfyaRDLe/1jl9ooNvV/5o7un hKyOUvEUTipXxhNa57bnFygdKj2c3v2Dv6igVPX9dujHXXEpG71ZgnVrBP5Jy8yNc5pg 9PCEvZAplTsVAn6y7tJzJiXA0akMp/MPtiK6Md/ufMx295NtBENuPgy+JjG+GwCgdbVM FMDuV6RV58JI+GOYSyGKT2gbk6TGtdSxl5QA9hbacHNV1ue4Hx4K6J3RZY2smD49zVRo 8c4JTblj9MmM1/5lIwx0tqm1e9KktATjgVR7hhHA9XyIYU+Z6tGPRm3jtoba7ka/d9gp 4JBg== X-Gm-Message-State: AOJu0YyLe2iOkuEt9HlN4K8M+MAO8w8J+Vbz9hCDXo2Ujyai3VqtyT61 tboYCt9uAfllkFOIt5+7UyE7dN6VVCsYrSeffyVY0mnlA3xZCNw2hnwLZNqozgZJoOf4s2H6eiU bZ+qvOzrO0Q== X-Gm-Gg: AeBDietzx0+3xYAWdlC4CP6BUMoTo/TvLzBXfWkrStPPAdS79oqxQyUKtUNr7SsQAZN CL8UHxx1YyZJHJxqFWFtIXgmTVwRzlskivc0uPdtwQfaI50lRUNgyJLsa/Nj0U+sETrJEuhav4q i03ARxMpflUEkYFz1M1FVXaSDYUxPHjjbLFJULbO/WBJ4yhBE+Nu6wvbZ0M8TZSBPA17DkqhtZF f7b4wjkHnRCo7FzSIluOodNOA+/REnt84kZ8tXCYB0ReWHijDqbo8faSWkSGmv82uybC3cKnFla ajoE197vJOLDC67jq+e9uNZtdya3La1Ap3Hp2rKDDAuybad9grWvd5IvAWB7dyj1QdaO2Zvbr/C qxW7AjTuoHw593wDZLau61GMEt6YWg3SxSECxRgBaJt2zndVq2kqdH7L8hYzwWuQpaY4GG/uMc0 mu0PlND2bizb3xWQDaKdstcITX+01+009777C+Jrl5EBri X-Received: by 2002:a05:6000:2211:b0:43f:e938:1e67 with SMTP id ffacd0b85a97d-43fe9381e75mr30962580f8f.38.1776853048906; Wed, 22 Apr 2026 03:17:28 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , Mohamed Mediouni , kvm@vger.kernel.org, Pedro Barbuda , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Subject: [PATCH v2 23/31] target/arm: report register in WFIT syndromes Date: Wed, 22 Apr 2026 11:10:34 +0100 Message-ID: <20260422101043.1234229-24-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260422101043.1234229-1-alex.bennee@linaro.org> References: <20260422101043.1234229-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::443; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x443.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1776853094824154100 Pass the register number (rd) to the wfit helper and report it in the syndrome ISS. Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e --- v2 - drop stale TODO - fixup stale commit comment (WFIT fix already merged) - make rv a bool - make ti a enum type --- target/arm/syndrome.h | 11 ++++++++++- target/arm/tcg/helper-defs.h | 2 +- target/arm/tcg/op_helper.c | 7 ++++--- target/arm/tcg/translate-a64.c | 2 +- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h index 04a71eebcb5..4d1f1c529e2 100644 --- a/target/arm/syndrome.h +++ b/target/arm/syndrome.h @@ -670,7 +670,14 @@ FIELD(WFX_ISS, RN, 5, 5) FIELD(WFX_ISS, COND, 20, 4) FIELD(WFX_ISS, CV, 24, 1) =20 -static inline uint32_t syn_wfx(int cv, int cond, int ti, bool is_16bit) +typedef enum { + WFI =3D 0b00, + WFE =3D 0b01, + WFIT =3D 0b10, + WFET =3D 0xb11 +} wfx_ti; + +static inline uint32_t syn_wfx(int cv, int cond, int rn, bool rv, wfx_ti t= i, bool is_16bit) { uint32_t res =3D syn_set_ec(0, EC_WFX_TRAP); res =3D FIELD_DP32(res, SYNDROME, IL, !is_16bit); @@ -678,6 +685,8 @@ static inline uint32_t syn_wfx(int cv, int cond, int ti= , bool is_16bit) res =3D FIELD_DP32(res, WFX_ISS, CV, cv); res =3D FIELD_DP32(res, WFX_ISS, COND, cond); res =3D FIELD_DP32(res, WFX_ISS, TI, ti); + res =3D FIELD_DP32(res, WFX_ISS, RN, rn); + res =3D FIELD_DP32(res, WFX_ISS, RV, rv); =20 return res; } diff --git a/target/arm/tcg/helper-defs.h b/target/arm/tcg/helper-defs.h index 5a10a9fba3b..a05f2258f29 100644 --- a/target/arm/tcg/helper-defs.h +++ b/target/arm/tcg/helper-defs.h @@ -55,7 +55,7 @@ DEF_HELPER_2(exception_pc_alignment, noreturn, env, vaddr) DEF_HELPER_1(setend, void, env) DEF_HELPER_2(wfi, void, env, i32) DEF_HELPER_1(wfe, void, env) -DEF_HELPER_2(wfit, void, env, i64) +DEF_HELPER_2(wfit, void, env, i32) DEF_HELPER_1(yield, void, env) DEF_HELPER_1(pre_hvc, void, env) DEF_HELPER_2(pre_smc, void, env, i32) diff --git a/target/arm/tcg/op_helper.c b/target/arm/tcg/op_helper.c index aa14f15eb62..652611b4313 100644 --- a/target/arm/tcg/op_helper.c +++ b/target/arm/tcg/op_helper.c @@ -399,7 +399,7 @@ void HELPER(wfi)(CPUARMState *env, uint32_t insn_len) env->regs[15] -=3D insn_len; } =20 - raise_exception(env, excp, syn_wfx(1, 0xe, 0, insn_len =3D=3D 2), + raise_exception(env, excp, syn_wfx(1, 0xe, 0, false, WFI, insn_len= =3D=3D 2), target_el); } =20 @@ -409,7 +409,7 @@ void HELPER(wfi)(CPUARMState *env, uint32_t insn_len) #endif } =20 -void HELPER(wfit)(CPUARMState *env, uint64_t timeout) +void HELPER(wfit)(CPUARMState *env, uint32_t rd) { #ifdef CONFIG_USER_ONLY /* @@ -428,6 +428,7 @@ void HELPER(wfit)(CPUARMState *env, uint64_t timeout) int target_el =3D check_wfx_trap(env, false, &excp); /* The WFIT should time out when CNTVCT_EL0 >=3D the specified value. = */ uint64_t cntval =3D gt_get_countervalue(env); + uint64_t timeout =3D env->xregs[rd]; /* * We want the value that we would get if we read CNTVCT_EL0 from * the current exception level, so the direct_access offset, not @@ -448,7 +449,7 @@ void HELPER(wfit)(CPUARMState *env, uint64_t timeout) =20 if (target_el) { env->pc -=3D 4; - raise_exception(env, excp, syn_wfx(1, 0xe, 2, false), target_el); + raise_exception(env, excp, syn_wfx(1, 0xe, rd, true, WFIT, false),= target_el); } =20 if (uadd64_overflow(timeout, offset, &nexttick)) { diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 5d261a5e32b..073454b9195 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -2064,7 +2064,7 @@ static bool trans_WFIT(DisasContext *s, arg_WFIT *a) } =20 gen_a64_update_pc(s, 4); - gen_helper_wfit(tcg_env, cpu_reg(s, a->rd)); + gen_helper_wfit(tcg_env, tcg_constant_i32(a->rd)); /* Go back to the main loop to check for interrupts */ s->base.is_jmp =3D DISAS_EXIT; return true; --=20 2.47.3 From nobody Sat May 30 20:12:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1776853110; cv=none; d=zohomail.com; s=zohoarc; b=DI0ttyI7zlJnOpjwCJbdAtc8pXaMC86/8m4bZQzrreu2MS/p9T7wQVO76ADWe7Qdsx4V81JP2D67SveYMKoAknisCaie1g5F8Dp9jUv2Ui6St5HmDxlCQMBjkV5+/wJzH5z8w/R55MwflXwR2Xt3ln6dm7vnbcWAwvav/XVRp90= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776853110; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=4/Ygp/F48dZ3RysrI6Uw/aAqnHQSpp+gk0lyGlg/T44=; b=jjxJt6pCFwnUUEGiFP2bIMY1tLQmOfZzv7Ra9PVNKEydpeeOXdH6BMR32BRr0J4J/09QkV6XOeNggzzyo6XEoLEj2o/EyLYhDr70uU3sP1z9dCoAl65Hp/M3t7hLkkmPDpH0EeUQX+ZglYUDLo1/L9hNqglJU2vjv7HvNE7c5+4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776853110687670.4131606624588; Wed, 22 Apr 2026 03:18:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wFUeR-00071u-Tw; Wed, 22 Apr 2026 06:17:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wFUeG-0006yK-1h for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:17:37 -0400 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wFUe9-0002MQ-S7 for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:17:35 -0400 Received: by mail-wr1-x441.google.com with SMTP id ffacd0b85a97d-43d70b3e159so2645138f8f.0 for ; Wed, 22 Apr 2026 03:17:26 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43fe4e4d5b1sm48555959f8f.30.2026.04.22.03.17.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 03:17:24 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 5F2015F93F; Wed, 22 Apr 2026 11:10:45 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1776853045; x=1777457845; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4/Ygp/F48dZ3RysrI6Uw/aAqnHQSpp+gk0lyGlg/T44=; b=ACbfygdzoYAjqpE/jecAyXS9uYlWDglC7XV3BgEsf5PQsDpr3AZP5N4208DE+W8x+X S4KFMiLfDaBhvA+qjJDkxCIIXi6M2VSlubRUBlov+A3L0l6dM6ssUn7/Y4tpnOhl+QAw kg6rwYYNIxuVC+HlB9jj1rjQl4p4bUTgijvhrFC5kYkdVDjJ0piqz+qq15FTFOZgm2MK f5Sx4essvPXayq4CnsKr1Ah4lAEMrc01T0/lbbdfuwVhQGu0A+4zp54Spc9ZfpU83xRu 2yYefelpuxb8jDFB7kP1OaQdYOhdmvwut7XGW/AKKI6+heou6C0cwOAeJklLhNJ503xO 6JCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776853045; x=1777457845; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=4/Ygp/F48dZ3RysrI6Uw/aAqnHQSpp+gk0lyGlg/T44=; b=BCPuyjdob6MVPUl5IXedFuy6GU2wwSop2zkda1eF4Pm9BYEXg5y5hYBnn0SSqUeVbA zHfoWEH2ksfarNtNhuVJmqyp4jh7gk0Vmzr4YfQMIxDsM2HqS6hRli3QbwFi/0jb9Qwj nAaLILs0bTNZlcNzpeWhMkdKNOIeZUW9ZQgaP/BF22+Gd4IPkV7EUIYNYMZB4/wqLkPn 3Y+cfobmQqk1Y+SIJcayXuoG/KxxRQRD/41AIMXMNMLhLnIniv92/JqvX+agaAPG5YqS LsnsS/4Bd8xjjjPRk/6E5iYrjf+NXRgLCg2m4nIndV4ofzlsdwdjML7Fr6etnOel2Az3 sI8Q== X-Gm-Message-State: AOJu0YwRVKQlp5dDtpEpZtoH3/n74YswuFdIG8dG0WFJl3sScDDMRR4p Wq8YI9DNU+FVTwq5xEkVryu4x5pZMcnngKm41HB1kiGIFI+XRepahsTNMrc/sQiTSNw= X-Gm-Gg: AeBDievZnyyZeeer9ADkfNNWn842ZDP8rP21Au3GfukQ570pxQYGNeTrsxx4xkzi2Ch 3lYe39nYTXKov9jgyMzWHQFH6xTr/9mbWJGVSFroWhASi7rbXKdl5/i2P4+xwAGzTnPaOojnJZP B1sO0QNwsJAAtPWg5aqljMNMwHexlX4KyBISOz2qeWaWR5aCtTSJY3GmPQofRT5vu7ydqYo0H6r tBaZjzfxB/keSu0gtsFiYNRmD4AlQOBTQmaDIFbMf28GokKMl5KOKEuoOD75VGk3C1UyOb5ad4h rxjmaqlXnoXxunCLwgjxUR7YTrrbqDRCRB5Pu8tUmPUabxkXlO2uiO2bpm49YIY+HJJWFXWeYSP lm2s1G+I1iBmfqlzZElvkvnKf0kcgq9vAyPI4p5JF0BASj9vHdAl5QiauSBaNF42MBjoSaW34j2 bfzgOpNI633FAdPSlLKg80wkut34lpq/EY0w== X-Received: by 2002:a5d:5889:0:b0:43d:7a97:78b5 with SMTP id ffacd0b85a97d-43fe3e0a448mr32111190f8f.33.1776853044898; Wed, 22 Apr 2026 03:17:24 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , Mohamed Mediouni , kvm@vger.kernel.org, Pedro Barbuda , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v2 24/31] target/arm: teach arm_cpu_has_work about halting reasons Date: Wed, 22 Apr 2026 11:10:35 +0100 Message-ID: <20260422101043.1234229-25-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260422101043.1234229-1-alex.bennee@linaro.org> References: <20260422101043.1234229-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::441; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x441.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1776853112915154100 With the advent of WFE and WFI we need to pay closer attention to the reason why the vCPU may be sleeping to figure out if we should wake it up. Create env->halt_reason to track this and then re-order the tests so we: - ignore everything is the vCPU is powered off - wake up if the event_register is set and we were in a WFE - otherwise any IRQ event does wake the vCPU up. Signed-off-by: Alex Benn=C3=A9e --- target/arm/cpu.h | 27 +++++++++++++++++++++++++ target/arm/arm-powerctl.c | 4 +++- target/arm/cpu.c | 40 +++++++++++++++++++++++++++----------- target/arm/kvm.c | 5 +++-- target/arm/machine.c | 2 +- target/arm/tcg/op_helper.c | 3 +++ 6 files changed, 66 insertions(+), 15 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 657ff4ab20b..98cdfa6f130 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -257,6 +257,19 @@ typedef enum ARMFPStatusFlavour { } ARMFPStatusFlavour; #define FPST_COUNT 10 =20 +/** + * ARMHaltReason - the reason we have entered halt state + * + * To be able to correctly wake up via arm_cpu_has_work() we need to + * track the reason we went to sleep. + */ +typedef enum { + NOT_HALTED =3D 0, + HALT_PSCI, + HALT_WFI, + HALT_WFE +} ARMHaltReason; + typedef struct CPUArchState { /* Regs for current mode. */ uint32_t regs[16]; @@ -760,6 +773,9 @@ typedef struct CPUArchState { /* Optional fault info across tlb lookup. */ ARMMMUFaultInfo *tlb_fi; =20 + /* Reason the CPU is halted */ + ARMHaltReason halt_reason; + /* * The event register is shared by all ARM profiles (A/R/M), * so it is stored in the top-level CPU state. @@ -1691,6 +1707,17 @@ static inline void xpsr_write(CPUARMState *env, uint= 32_t val, uint32_t mask) #endif } =20 +/** + * arm_set_cpu_power_state() - set power state synced with halt_reason + */ +static inline void arm_set_cpu_power_state(ARMCPU *cpu, ARMPSCIState state) +{ + CPUARMState *env =3D &cpu->env; + + cpu->power_state =3D state; + env->halt_reason =3D (state =3D=3D PSCI_OFF) ? HALT_PSCI : NOT_HALTED; +} + #define HCR_VM (1ULL << 0) #define HCR_SWIO (1ULL << 1) #define HCR_PTW (1ULL << 2) diff --git a/target/arm/arm-powerctl.c b/target/arm/arm-powerctl.c index a788376d1d3..4ca63a54443 100644 --- a/target/arm/arm-powerctl.c +++ b/target/arm/arm-powerctl.c @@ -78,6 +78,7 @@ static void arm_set_cpu_on_async_work(CPUState *target_cp= u_state, =20 /* Finally set the power status */ assert(bql_locked()); + target_cpu->env.halt_reason =3D NOT_HALTED; target_cpu->power_state =3D PSCI_ON; } =20 @@ -186,6 +187,7 @@ static void arm_set_cpu_on_and_reset_async_work(CPUStat= e *target_cpu_state, =20 /* Finally set the power status */ assert(bql_locked()); + target_cpu->env.halt_reason =3D NOT_HALTED; target_cpu->power_state =3D PSCI_ON; } =20 @@ -239,7 +241,7 @@ static void arm_set_cpu_off_async_work(CPUState *target= _cpu_state, ARMCPU *target_cpu =3D ARM_CPU(target_cpu_state); =20 assert(bql_locked()); - target_cpu->power_state =3D PSCI_OFF; + arm_set_cpu_power_state(target_cpu, PSCI_OFF); target_cpu_state->halted =3D 1; target_cpu_state->exception_index =3D EXCP_HLT; } diff --git a/target/arm/cpu.c b/target/arm/cpu.c index ccc47c8a9ad..124be8c401e 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -144,18 +144,36 @@ static bool arm_cpu_has_work(CPUState *cs) { ARMCPU *cpu =3D ARM_CPU(cs); =20 - if (arm_feature(&cpu->env, ARM_FEATURE_M)) { - if (cpu->env.event_register) { - return true; - } + /* + * Only another PSCI call can wake the CPU up in which case the + * power_state would be set by arm_set_cpu_on_and_reset_async_work() + */ + if (cpu->power_state =3D=3D PSCI_OFF) { + g_assert(cpu->env.halt_reason =3D=3D HALT_PSCI); + return false; + } + + /* + * A wake-up event should only wake us if we are halted on a WFE + */ + if (cpu->env.halt_reason =3D=3D HALT_WFE && cpu->env.event_register) { + cpu->env.halt_reason =3D NOT_HALTED; + return true; + } + + /* + * Otherwise pretty much any IRQ would wake us up + */ + if (cpu_test_interrupt(cs, + CPU_INTERRUPT_FIQ | CPU_INTERRUPT_HARD + | CPU_INTERRUPT_NMI | CPU_INTERRUPT_VINMI | CPU= _INTERRUPT_VFNMI + | CPU_INTERRUPT_VFIQ | CPU_INTERRUPT_VIRQ | CPU= _INTERRUPT_VSERR + | CPU_INTERRUPT_EXITTB)) { + cpu->env.halt_reason =3D NOT_HALTED; + return true; } =20 - return (cpu->power_state !=3D PSCI_OFF) - && cpu_test_interrupt(cs, - CPU_INTERRUPT_FIQ | CPU_INTERRUPT_HARD - | CPU_INTERRUPT_NMI | CPU_INTERRUPT_VINMI | CPU_INTERRUPT_V= FNMI - | CPU_INTERRUPT_VFIQ | CPU_INTERRUPT_VIRQ | CPU_INTERRUPT_V= SERR - | CPU_INTERRUPT_EXITTB); + return false; } #endif /* !CONFIG_USER_ONLY */ =20 @@ -250,7 +268,7 @@ static void arm_cpu_reset_hold(Object *obj, ResetType t= ype) env->vfp.xregs[ARM_VFP_MVFR1] =3D cpu->isar.mvfr1; env->vfp.xregs[ARM_VFP_MVFR2] =3D cpu->isar.mvfr2; =20 - cpu->power_state =3D cs->start_powered_off ? PSCI_OFF : PSCI_ON; + arm_set_cpu_power_state(cpu, cs->start_powered_off ? PSCI_OFF : PSCI_O= N); =20 if (arm_feature(env, ARM_FEATURE_AARCH64)) { /* 64 bit CPUs always start in 64 bit mode */ diff --git a/target/arm/kvm.c b/target/arm/kvm.c index d4a68874b88..c08e4797b32 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -1143,11 +1143,12 @@ static int kvm_arm_sync_mpstate_to_qemu(ARMCPU *cpu) if (cap_has_mp_state) { struct kvm_mp_state mp_state; int ret =3D kvm_vcpu_ioctl(CPU(cpu), KVM_GET_MP_STATE, &mp_state); + ARMPSCIState state; if (ret) { return ret; } - cpu->power_state =3D (mp_state.mp_state =3D=3D KVM_MP_STATE_STOPPE= D) ? - PSCI_OFF : PSCI_ON; + state =3D (mp_state.mp_state =3D=3D KVM_MP_STATE_STOPPED) ? PSCI_O= FF : PSCI_ON; + arm_set_cpu_power_state(cpu, state); } return 0; } diff --git a/target/arm/machine.c b/target/arm/machine.c index b0e499515cf..62401c5a3ea 100644 --- a/target/arm/machine.c +++ b/target/arm/machine.c @@ -916,7 +916,7 @@ static int get_power(QEMUFile *f, void *opaque, size_t = size, { ARMCPU *cpu =3D opaque; bool powered_off =3D qemu_get_byte(f); - cpu->power_state =3D powered_off ? PSCI_OFF : PSCI_ON; + arm_set_cpu_power_state(cpu, powered_off ? PSCI_OFF : PSCI_ON); return 0; } =20 diff --git a/target/arm/tcg/op_helper.c b/target/arm/tcg/op_helper.c index 652611b4313..46c745077d5 100644 --- a/target/arm/tcg/op_helper.c +++ b/target/arm/tcg/op_helper.c @@ -403,6 +403,7 @@ void HELPER(wfi)(CPUARMState *env, uint32_t insn_len) target_el); } =20 + env->halt_reason =3D HALT_WFI; cs->exception_index =3D EXCP_HLT; cs->halted =3D 1; cpu_loop_exit(cs); @@ -464,6 +465,7 @@ void HELPER(wfit)(CPUARMState *env, uint32_t rd) } else { timer_mod(cpu->wfxt_timer, nexttick); } + env->halt_reason =3D HALT_WFI; cs->exception_index =3D EXCP_HLT; cs->halted =3D 1; cpu_loop_exit(cs); @@ -508,6 +510,7 @@ void HELPER(wfe)(CPUARMState *env) return; } =20 + env->halt_reason =3D HALT_WFE; cs->exception_index =3D EXCP_HLT; cs->halted =3D 1; cpu_loop_exit(cs); --=20 2.47.3 From nobody Sat May 30 20:12:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1776853173; cv=none; d=zohomail.com; s=zohoarc; b=EHNn3ZaXVzY0vBYSaPrdq7U9L66KPPIip4gpfCG+S+HvKHnaUwpvOadh04agt6te4G0oboP0dznuX9x0pNHwsYr92HTRjfypUJeTjhCePXXYl2Ee3GZheV0vka6ikDRCFHpm/nFACZbbcobdbKBAcUoXz1adcwALtLWtZ06m49U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776853173; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=V9WNiVc32x9uwc9Kvl3F3IabOVkUVJfyhaJuWqhRbgs=; b=bU4GcUumBtfNkTkQZFtoo0cdurhTEg9HUkMXytOZkWnSA8KAehL6hjbAwkol3BRpg0Oent5gXWNWg/5cZZrbETp1e7QY5tOqd9zGl3sZBAWZIYQUZAdLKuaFZ0/bB2tuQTHbQaz4wfdACTvGeyO7e+CF35IoMD1oyNnOodhosRA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776853173457301.27449303726814; Wed, 22 Apr 2026 03:19:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wFUeq-0007Jg-Ht; Wed, 22 Apr 2026 06:18:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wFUeM-0006yl-5V for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:17:43 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wFUeD-0002NN-Lb for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:17:36 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-488b8bc6bc9so37141405e9.3 for ; Wed, 22 Apr 2026 03:17:30 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4891c08faffsm420040875e9.1.2026.04.22.03.17.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 03:17:28 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 72EA26153F; Wed, 22 Apr 2026 11:10:45 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1776853050; x=1777457850; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=V9WNiVc32x9uwc9Kvl3F3IabOVkUVJfyhaJuWqhRbgs=; b=lpf5FT+fG4RvwdNrOLYAt5rVTc6OTeMRM5if5IFQX7ZTpGzjeeiMpcSF48dL4T8rf6 nS9Nv/aIibuPHhOhSJLdfM2t8Kdee+dh6GERxsODMgEdshIReJiHHiBNKq+Iv0LqEy4M muMJeRKelFwE33Tz8vWkYVMiP/yfC0Qmbt8um8EBKKlspnsMs23Y2tXmijUThWLuxwF8 y9VNWZWvLBdAOvGhV655rYNyBmODBjpc6OyB39dhRWItB1pTmENriOOw2f9OZnLqkbXg TO6QKmzA0Je7z1sQe5BbJCuQ/OarnSwCRMnPOqfBsdB0eY2IFVKRaap9jLbTo4M78yGb X4og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776853050; x=1777457850; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=V9WNiVc32x9uwc9Kvl3F3IabOVkUVJfyhaJuWqhRbgs=; b=bd2/rY6dwqf/K7HiqDpSlvswWP8X9/9GB7vpixxjrM1EhtIwjA1e2MTTqgccU6VH+H ocFx7mCsJeSxl2N4uZVmnWE3Axrsa4xr6m9vLLKsSP+7YCnDqVgrF7Diqx176aPMBIZP zR/lnv8hLilLSS3doo7g0aKZswLOyBjoGIIQ7JJjSWMThBekKXCqUEzDlEeC4rkZ5ePk s5ro/GHHCfHTzJGwgydroyLKuWC5xM/46JOF+WWoNOaEC5TGY1wwM1IW8lwESXU2+RtF cDS0cGVuGWhJ4TulvWqzuhm3k+ZqnTFtkPC1vJby1VXYbJg5mj5ilIfTWMqNRe69pAs5 9ibQ== X-Gm-Message-State: AOJu0Yy6hUFfNdJ6Vje0DS1L6Bjq+yt5FJ545ejwe91N6JupPqWVYvRx AeJgoI518tWw/aGg0gLUPzqGvrr6IrotChj8Lp/BmBXUW0ju7LonsllREWTEZEf3g24= X-Gm-Gg: AeBDietd6O0Mfc07MW4OHfd1IJlWdywpeU+dz9XSH2lR8jSbDJ2+/LXsyLiqWZMn366 44O4iV+TdNB9OsG0vYJ1pRX2vLfEBQztyIpNkkLE9CzV9fT+N7ploRie/MRk40eIKVaSmWBVI2D 8OJrx6XBBUnj04mwyzxSj3jAMqDPv2m9n0LBbXezr3V/A0aon46dQI9ayibGuHwYBygYwpttANX yEZ+IstirfdLOXBwjpCHC+cApj8KRNQVNIBgYTsnSxDqmOl5tgOH0IjDez/Y5BD/Rj4BYpTbxLm uLAvqD672Vqp4ceZDdbLRzvGA0tKcXUJzlHPYszT9odzmCdsF6AEJkOpi6ULQaQWwZ1tyxLTemg 3KlOyxDV6UJCs4KumWtkvnM3hax+/5w2kv30KqD9bYPZMDQy+OKUkLpUqFKi8ZgboIlNCvqGNrS z9mSy/VxJzNogBtZl3a0Bs8pvXj87txlUCtw== X-Received: by 2002:a05:600c:5254:b0:488:8bdd:cfcc with SMTP id 5b1f17b1804b1-488fb6e62a8mr333377305e9.0.1776853049667; Wed, 22 Apr 2026 03:17:29 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , Mohamed Mediouni , kvm@vger.kernel.org, Pedro Barbuda , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Subject: [PATCH v2 25/31] target/arm: redefine event stream fields Date: Wed, 22 Apr 2026 11:10:36 +0100 Message-ID: <20260422101043.1234229-26-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260422101043.1234229-1-alex.bennee@linaro.org> References: <20260422101043.1234229-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1776853176204154100 The event stream control bits are the same for both CNTHCTL and CNTKCTL so rather than duplicating the definitions rename them to be useful in both cases. We will need these in a later commit when we start implementing event streams. Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e --- target/arm/internals.h | 11 +++++++---- target/arm/helper.c | 8 ++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index 85980f0e69a..dc593f1fec8 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -263,14 +263,17 @@ FIELD(VSTCR, SA, 30, 1) * have different bit definitions, and EL1PCTEN might be * bit 0 or bit 10. We use _E2H1 and _E2H0 suffixes to * disambiguate if necessary. + * + * The event stream bits (EVN*) are in the same position for + * CNTKCTL_EL1/CTNKCTL. */ FIELD(CNTHCTL, EL0PCTEN_E2H1, 0, 1) FIELD(CNTHCTL, EL0VCTEN_E2H1, 1, 1) FIELD(CNTHCTL, EL1PCTEN_E2H0, 0, 1) FIELD(CNTHCTL, EL1PCEN_E2H0, 1, 1) -FIELD(CNTHCTL, EVNTEN, 2, 1) -FIELD(CNTHCTL, EVNTDIR, 3, 1) -FIELD(CNTHCTL, EVNTI, 4, 4) +FIELD(CNTxCTL, EVNTEN, 2, 1) +FIELD(CNTxCTL, EVNTDIR, 3, 1) +FIELD(CNTxCTL, EVNTI, 4, 4) FIELD(CNTHCTL, EL0VTEN, 8, 1) FIELD(CNTHCTL, EL0PTEN, 9, 1) FIELD(CNTHCTL, EL1PCTEN_E2H1, 10, 1) @@ -280,7 +283,7 @@ FIELD(CNTHCTL, EL1TVT, 13, 1) FIELD(CNTHCTL, EL1TVCT, 14, 1) FIELD(CNTHCTL, EL1NVPCT, 15, 1) FIELD(CNTHCTL, EL1NVVCT, 16, 1) -FIELD(CNTHCTL, EVNTIS, 17, 1) +FIELD(CNTxCTL, EVNTIS, 17, 1) FIELD(CNTHCTL, CNTVMASK, 18, 1) FIELD(CNTHCTL, CNTPMASK, 19, 1) =20 diff --git a/target/arm/helper.c b/target/arm/helper.c index 40dd070d2c1..81a07ca42d0 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -1746,9 +1746,9 @@ static void gt_cnthctl_write(CPUARMState *env, const = ARMCPRegInfo *ri, uint32_t valid_mask =3D R_CNTHCTL_EL0PCTEN_E2H1_MASK | R_CNTHCTL_EL0VCTEN_E2H1_MASK | - R_CNTHCTL_EVNTEN_MASK | - R_CNTHCTL_EVNTDIR_MASK | - R_CNTHCTL_EVNTI_MASK | + R_CNTxCTL_EVNTEN_MASK | + R_CNTxCTL_EVNTDIR_MASK | + R_CNTxCTL_EVNTI_MASK | R_CNTHCTL_EL0VTEN_MASK | R_CNTHCTL_EL0PTEN_MASK | R_CNTHCTL_EL1PCTEN_E2H1_MASK | @@ -1763,7 +1763,7 @@ static void gt_cnthctl_write(CPUARMState *env, const = ARMCPRegInfo *ri, R_CNTHCTL_EL1TVCT_MASK | R_CNTHCTL_EL1NVPCT_MASK | R_CNTHCTL_EL1NVVCT_MASK | - R_CNTHCTL_EVNTIS_MASK; + R_CNTxCTL_EVNTIS_MASK; } if (cpu_isar_feature(aa64_ecv, cpu)) { valid_mask |=3D R_CNTHCTL_ECV_MASK; --=20 2.47.3 From nobody Sat May 30 20:12:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1776853173; cv=none; d=zohomail.com; s=zohoarc; b=MXorc3Ht7Dionf+FfKk3H6e9Pqw/vjXal9W+37CiO7sTDYVNokVSWt8wxJnwUxWt1C1I9nHTYZ1duMMsnjf4sKESJ588J3CsrD6TAMG4gC6Nsbl53PM8WspWeazS8u8c5lzyYC1QX+bzRKSfB/GIo2ZVGKvodOTtmoihwdeYJmQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776853173; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=LHt/fkh4CQTgDK0U2IQzNp32v6ZUUxM/zBvWXPy5kqQ=; b=aIZPB8yjXluNLN/vgsT3j29xhs9Njh1SqJAZWg27Zz4xn7lYYtwK+m699IO6UwTzIGdcKLyqHAH4BxVOXrvjnz+CxuYJJDiSXrKtGZ3mtktYcCaI9nQyQPOXy1/jLlHwBmyJ6EaiOMXwTBWgeJ9JXYC8Q4KXhoPu1E4pfzbTOLk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17768531737051017.1984429396166; Wed, 22 Apr 2026 03:19:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wFUen-0007Dc-EN; Wed, 22 Apr 2026 06:18:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wFUeM-0006yn-5q for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:17:43 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wFUeD-0002N0-OT for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:17:39 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-488af96f6b2so67561485e9.0 for ; Wed, 22 Apr 2026 03:17:29 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4891cdfcd50sm84551615e9.9.2026.04.22.03.17.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 03:17:24 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 863CD61667; Wed, 22 Apr 2026 11:10:45 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1776853048; x=1777457848; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LHt/fkh4CQTgDK0U2IQzNp32v6ZUUxM/zBvWXPy5kqQ=; b=rMkYgyCVxR0x/IGkZoHlqbDBuMiCo41H5fBGAj7wNhFryHQNV+J+Mhdwb654IDqYjX 5RiKIg/trrCSAnqxp62aAe5LcSZPCLBL6nbfYdnOX4Wz09cIDXzzECO/2xt8PTquUmbv fAzyMfZ53jhrmSesK7S4x89cFUbaqpNKOJuCEldlIQINtsi419E3GxqYz52b0uXvHh/6 Cj2bBctBXdIdnCSs4U+4fLS2blJEGMq7CvvFdhue+AHdDtRIMICJIdrSUPubVofn5mNk rZ3Y3y1l6UMoQuXGVJzNCdcPMrGBCRVKCt6wNzZUecw2aJImU1QbMsw3tZCDhiVTRkkk hZpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776853048; x=1777457848; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=LHt/fkh4CQTgDK0U2IQzNp32v6ZUUxM/zBvWXPy5kqQ=; b=cx3Gyhf392LlPaU71u37iWzNbL0YBvszmFvZouvFW2fEqtd9Zo7rGrClyRZURLYA5o 9ufB6wgpAPWXZnB1g0SaWXgZedMzEwga+F5HUDte2lbF22nGEHOclzCN5uS+6OZ49gpB tkb1c2X4RhHJZsj0GpJG2sKp/POBlO4yUDoV6Z/7tz0VVf4MxKoRk7yQFsaFMgbnxhu6 TVtZO39dTv2bbs9foAqE4XmJGO5P/8WMYGgmwqFJqcAeV8lQ9ykSGsqNxvULlB2JyFcN ejJaVtr4iNupCCq4tcyYkXgXkxyD09YAPbDYEbRoe3IwTUeCL4P0jR+3z1wvkYPON8cL O1Aw== X-Gm-Message-State: AOJu0YwIp6d8gkDeag5z1YbHsJnwUeCd9dSzyEpdajYNN11T8ou+ba1B c5Cwz2oKbf/X+lxal1KX6/i5685Gc2XKqzKhVRMvtuw91dQW248pjomyLL71cAW19mI= X-Gm-Gg: AeBDiesaFUszbeV8YnXYXrkvD0wuXGV871yL7QadBwl9TnZC+fF49CGUGsCP3hrMoun 6/29zge67bHZ4RAlZEwIa+ZCwonr/C0FYbF7bsnuN8FNJGDCmtZGV9JXZlok/Ced2BI7ILdXlpa 0D9vV+o5a5S341ML2Vo9DicwBxCun0KLb+3LLdrAmT1Fvb2UOPAQEjQh0k6yFscShkTLAvqZWVG Rm+uiiUoxtLQJR9ldnQKJjTBxBraroD1ayvhxurZMpVezgp5Y10kW8H6HZC/ElAR2qiSvDjNYKL tYUekxnjuktOYljtWw2BrwELmDIFEn224N2AFZIG9Qs3LWHOnPs+HSNxlgSAZWAy8Jp+9dL3YJB 4jOylLPzIRZD+M0LTCTz2A91uNBH+VIJsien52rIGeuFRso3PzKE9JN/5esOarpfHAuiKGJBhDx anmBIFe3okOk8eJtGy3i+1qNp2lPbDp+hMiA== X-Received: by 2002:a05:600c:3216:b0:489:1ff1:74d3 with SMTP id 5b1f17b1804b1-4891ff17521mr88617735e9.20.1776853047996; Wed, 22 Apr 2026 03:17:27 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , Mohamed Mediouni , kvm@vger.kernel.org, Pedro Barbuda , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Subject: [PATCH v2 26/31] target/arm: ensure aarch64 DISAS_WFE will exit Date: Wed, 22 Apr 2026 11:10:37 +0100 Message-ID: <20260422101043.1234229-27-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260422101043.1234229-1-alex.bennee@linaro.org> References: <20260422101043.1234229-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1776853176182154100 This mirrors the logic for DISAS_WFE in 32 bit world. Fixes: 252ec405768 (target-arm: implement WFE/YIELD as a yield for AArch64) Reviewed-by: Richard Henderson Signed-off-by: Alex Benn=C3=A9e --- target/arm/tcg/translate-a64.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index 073454b9195..d79c8ab431b 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -10917,6 +10917,7 @@ static void aarch64_tr_tb_stop(DisasContextBase *dc= base, CPUState *cpu) case DISAS_WFE: gen_a64_update_pc(dc, 4); gen_helper_wfe(tcg_env); + tcg_gen_exit_tb(NULL, 0); break; case DISAS_YIELD: gen_a64_update_pc(dc, 4); --=20 2.47.3 From nobody Sat May 30 20:12:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1776853150; cv=none; d=zohomail.com; s=zohoarc; b=XkeucHFad20Pn/2FqV4BQM02MA5F/aJDmGq8JvKKdQ6/n0LgqZ173kVr9ioxB4j+tf/dfAT62Xo2hCeUHs4n2kmBP8xR5hgyOqg6Ffwh3p0cj3uCMZrnkou6d++7qkvqTWWHZMv9FWTOGhnBgQoYlzPEu+yRH13YDAdOkuFpw+o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776853150; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=N9iI3ryke1e2JIQkehVmmVgECgG7zvzI0XvyUC6unRY=; b=fLqFKOYftQUU8XCBvjKZB8oRq4qWaLNaq1Al1RnhJgryvvo4EiurYiUK+seHK371PpFfDbG6kBPTqjJruqMEf7LqIToa894etqm810dGyFHhjAXMxqRKe+VSfHKvP1UAsB5aNO6Mofp+6HENBbUWhxeeBC8Skcq4q5/WAfa/nbk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776853150174298.5226874027817; Wed, 22 Apr 2026 03:19:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wFUez-0007ZJ-Q8; Wed, 22 Apr 2026 06:18:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wFUeN-0006z1-Rk for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:17:45 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wFUeL-0002RE-Cc for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:17:43 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4891b0786beso28964915e9.1 for ; Wed, 22 Apr 2026 03:17:36 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4891cdfcd50sm84553285e9.9.2026.04.22.03.17.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 03:17:33 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id A28A161668; Wed, 22 Apr 2026 11:10:45 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1776853055; x=1777457855; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=N9iI3ryke1e2JIQkehVmmVgECgG7zvzI0XvyUC6unRY=; b=kM6dT2N1to8hBkSMYQoH0niPGtIFu0HXfyo/r93oL5/SM+KONeVJw6PgAzT6b/obHh nV2xJJMJAD0wwLxecwopgVJcRiW58FOhoaFhBxQtwf25fTA3CtUAP+8F8J3stnr5cJCE NdQx53E9X8Xw5CTMeGwzoFGwrPUe264I4ArwrRTs/b+XXrmNuefAbHIPA6VpSv7oKvzr vwVNZPLCw7CsBxKEn2iVefO5Vj+0QklumFuu3Gf+SZKm0nlYYoxMFOpu2YbhTFDz/ld+ l96K3Rj+BGPQU48RfJ4WGCWJRRyOXxbwFYEi/cy8rMcAk7i5OIiar9QCmznEl+eTQmiP Rrtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776853055; x=1777457855; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=N9iI3ryke1e2JIQkehVmmVgECgG7zvzI0XvyUC6unRY=; b=ebsD/ENcsY4MN86mhz+mgz3sKcvJM62/A6xs5rhBkd+vwvwnzZLy9LZ2JmlDdZ0ng6 pa/ELtWRKP3IFNJV6SbzNWEjtLd2LMkL3QzksNGvHANWIfKjhwxr9vZTEMxkokeOBJjs 0cXeDBB/CxvxXLF49LK0kJ8q5MInstVzEXxqfzo5EFjGbxV/4wBmIskjg/Ua8e/2qsih GM6ByTyF5d1g0IJmWUqVhWz10H+rXJDV8wDugOkteeJSVk8h/BWxEfEzkYHLt5Ywmb8A 1EdNuoqgIbVENdNGqGPqhZxCGxLOw/VbsV68m4DxG/fe2XwFaJtARsimsCDEYRon52w5 pMBQ== X-Gm-Message-State: AOJu0YzjRuvPbrVpco9LC8H4eRxlccu4XNLxYVepoF2WC1Ls8C0qdjlC YtNNm1K8b3CynGv0Yz6AtHCFurnZnA470uL50qVn61aG4KsvV4Q4XjFUAqPl/ImKkGk= X-Gm-Gg: AeBDiet2zjKMO0M3p6vcBuukVs+ca4EsTArauPJxdiFW15QKMX6HX4Kyj3Bi++oTeiO vier+a6OvsLxtu3+37DHgtJ4QDCckt4fiNjlJsSLful+X2bZTmkt5S8eFmWTrb9b7DcpnAbU3j9 nHdKE3t+RQv/Rm+iCnwScaoVYYSvIDQMhpGdGqr1tkGb/i7QHPfwayIaTW4E59cJBPtNxmWf0eQ QVnuD4MOCylyxCE8SG8ut3/xFWYm0FAKMI4QOOKjDDdiOVVtrVeqPRKbDEXrf4fbm556o3I0D0c HDz6z/EGmCtCBZztkeT91eKujAp85g0b+nr8OR5Y1ImhRBt88mE+Q7ZzMU+Ux94/iQSB1c8quWC 80DEcbuR+OWkYWKPR74Wxv4dTIKBn1xwdaNUofRjcOa873wPsuO9PgMGSXJ0Nyt9pJpSAA7Vs63 XMePoThTOmypQbVLUKWf7s6cJKqCI4u8tLXg== X-Received: by 2002:a05:600c:c085:b0:488:acbc:b2e with SMTP id 5b1f17b1804b1-488fb765b04mr247121445e9.17.1776853054834; Wed, 22 Apr 2026 03:17:34 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , Mohamed Mediouni , kvm@vger.kernel.org, Pedro Barbuda , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v2 27/31] target/arm: implements SEV/SEVL for all modes Date: Wed, 22 Apr 2026 11:10:38 +0100 Message-ID: <20260422101043.1234229-28-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260422101043.1234229-1-alex.bennee@linaro.org> References: <20260422101043.1234229-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1776853151614154100 Remove the restrictions that make this a M-profile only operation and enable the instructions for all Arm profiles. Signed-off-by: Alex Benn=C3=A9e --- v2 - fix alignment in a32.decode - set bool directly, defend with QEMU_BUILD_BUG_ON - s/instructions/profiles/ - share get_event_reg between translate/translate-a64 --- target/arm/tcg/translate.h | 18 ++++++++++++++++++ target/arm/tcg/a32.decode | 5 ++--- target/arm/tcg/a64.decode | 5 ++--- target/arm/tcg/t16.decode | 4 +--- target/arm/tcg/t32.decode | 4 +--- target/arm/tcg/op_helper.c | 4 +--- target/arm/tcg/translate-a64.c | 17 +++++++++++++++++ target/arm/tcg/translate.c | 13 ++++++++----- 8 files changed, 50 insertions(+), 20 deletions(-) diff --git a/target/arm/tcg/translate.h b/target/arm/tcg/translate.h index 3e3094a463e..9bf2701a56b 100644 --- a/target/arm/tcg/translate.h +++ b/target/arm/tcg/translate.h @@ -864,6 +864,24 @@ static inline void gen_restore_rmode(TCGv_i32 old, TCG= v_ptr fpst) gen_helper_set_rmode(old, old, fpst); } =20 +/* + * Event Register signalling. + * + * A bunch of activities trigger events, we just need to latch on to + * true. The event eventually gets consumed by WFE/WFET. + * + * user-mode treats these as NOPs. + */ + +static inline void gen_event_reg(void) +{ +#ifndef CONFIG_USER_ONLY + TCGv_i32 set_event =3D tcg_constant_i32(1); + QEMU_BUILD_BUG_ON(sizeof_field(CPUARMState, event_register) !=3D 1); + tcg_gen_st8_i32(set_event, tcg_env, offsetof(CPUARMState, event_regist= er)); +#endif +} + /* * Helpers for implementing sets of trans_* functions. * Defer the implementation of NAME to FUNC, with optional extra arguments. diff --git a/target/arm/tcg/a32.decode b/target/arm/tcg/a32.decode index f2ca4809495..547aa2b1490 100644 --- a/target/arm/tcg/a32.decode +++ b/target/arm/tcg/a32.decode @@ -192,9 +192,8 @@ SMULTT .... 0001 0110 .... 0000 .... 1110 ...= . @rd0mn WFE ---- 0011 0010 0000 1111 ---- 0000 0010 WFI ---- 0011 0010 0000 1111 ---- 0000 0011 =20 - # TODO: Implement SEV, SEVL; may help SMP performance. - # SEV ---- 0011 0010 0000 1111 ---- 0000 0100 - # SEVL ---- 0011 0010 0000 1111 ---- 0000 0101 + SEV ---- 0011 0010 0000 1111 ---- 0000 0100 + SEVL ---- 0011 0010 0000 1111 ---- 0000 0101 =20 ESB ---- 0011 0010 0000 1111 ---- 0001 0000 ] diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 01b1b3e38be..dcb3099dd5c 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -237,9 +237,8 @@ ERETA 1101011 0100 11111 00001 m:1 11111 1111= 1 &reta # ERETAA, ERETAB YIELD 1101 0101 0000 0011 0010 0000 001 11111 WFE 1101 0101 0000 0011 0010 0000 010 11111 WFI 1101 0101 0000 0011 0010 0000 011 11111 - # We implement WFE to never block, so our SEV/SEVL are NOPs - # SEV 1101 0101 0000 0011 0010 0000 100 11111 - # SEVL 1101 0101 0000 0011 0010 0000 101 11111 + SEV 1101 0101 0000 0011 0010 0000 100 11111 + SEVL 1101 0101 0000 0011 0010 0000 101 11111 # Our DGL is a NOP because we don't merge memory accesses anyway. # DGL 1101 0101 0000 0011 0010 0000 110 11111 XPACLRI 1101 0101 0000 0011 0010 0000 111 11111 diff --git a/target/arm/tcg/t16.decode b/target/arm/tcg/t16.decode index 778fbf16275..9a8f89538ac 100644 --- a/target/arm/tcg/t16.decode +++ b/target/arm/tcg/t16.decode @@ -228,10 +228,8 @@ REVSH 1011 1010 11 ... ... @rdm WFE 1011 1111 0010 0000 WFI 1011 1111 0011 0000 =20 - # M-profile SEV is implemented. - # TODO: Implement SEV for other profiles, and SEVL for all profiles; m= ay help SMP performance. SEV 1011 1111 0100 0000 - # SEVL 1011 1111 0101 0000 + SEVL 1011 1111 0101 0000 =20 # The canonical nop has the second nibble as 0000, but the whole of the # rest of the space is a reserved hint, behaves as nop. diff --git a/target/arm/tcg/t32.decode b/target/arm/tcg/t32.decode index 49b8d0037ec..8ae277fe112 100644 --- a/target/arm/tcg/t32.decode +++ b/target/arm/tcg/t32.decode @@ -369,10 +369,8 @@ CLZ 1111 1010 1011 ---- 1111 .... 1000 ..= .. @rdm WFE 1111 0011 1010 1111 1000 0000 0000 0010 WFI 1111 0011 1010 1111 1000 0000 0000 0011 =20 - # M-profile SEV is implemented. - # TODO: Implement SEV for other profiles, and SEVL for all profile= s; may help SMP performance. SEV 1111 0011 1010 1111 1000 0000 0000 0100 - # SEVL 1111 0011 1010 1111 1000 0000 0000 0101 + SEVL 1111 0011 1010 1111 1000 0000 0000 0101 =20 ESB 1111 0011 1010 1111 1000 0000 0001 0000 ] diff --git a/target/arm/tcg/op_helper.c b/target/arm/tcg/op_helper.c index 46c745077d5..655e3f96e78 100644 --- a/target/arm/tcg/op_helper.c +++ b/target/arm/tcg/op_helper.c @@ -477,9 +477,7 @@ void HELPER(sev)(CPUARMState *env) CPUState *cs =3D env_cpu(env); CPU_FOREACH(cs) { ARMCPU *target_cpu =3D ARM_CPU(cs); - if (arm_feature(&target_cpu->env, ARM_FEATURE_M)) { - target_cpu->env.event_register =3D true; - } + target_cpu->env.event_register =3D true; if (!qemu_cpu_is_self(cs)) { qemu_cpu_kick(cs); } diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index d79c8ab431b..f30df5dbfed 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -2032,6 +2032,23 @@ static bool trans_WFI(DisasContext *s, arg_WFI *a) return true; } =20 +static bool trans_SEV(DisasContext *s, arg_SEV *a) +{ + /* + * SEV is a NOP for user-mode emulation. + */ +#ifndef CONFIG_USER_ONLY + gen_helper_sev(tcg_env); +#endif + return true; +} + +static bool trans_SEVL(DisasContext *s, arg_SEV *a) +{ + gen_event_reg(); + return true; +} + static bool trans_WFE(DisasContext *s, arg_WFI *a) { /* diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c index f9d1b8897d2..59925151fc3 100644 --- a/target/arm/tcg/translate.c +++ b/target/arm/tcg/translate.c @@ -3244,17 +3244,20 @@ static bool trans_YIELD(DisasContext *s, arg_YIELD = *a) static bool trans_SEV(DisasContext *s, arg_SEV *a) { /* - * Currently SEV is a NOP for non-M-profile and in user-mode emulation. - * For system-mode M-profile, it sets the event register. + * SEV is a NOP for user-mode emulation. */ #ifndef CONFIG_USER_ONLY - if (arm_dc_feature(s, ARM_FEATURE_M)) { - gen_helper_sev(tcg_env); - } + gen_helper_sev(tcg_env); #endif return true; } =20 +static bool trans_SEVL(DisasContext *s, arg_SEV *a) +{ + gen_event_reg(); + return true; +} + static bool trans_WFE(DisasContext *s, arg_WFE *a) { /* --=20 2.47.3 From nobody Sat May 30 20:12:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1776853121; cv=none; d=zohomail.com; s=zohoarc; b=gonzKh9A9RuXjEHh/iuqCyoEulofreFzWfG9EW34bFg55dec2avYfzy6ZFRHSNpJtNc2x1z53QgEz8KOneMuPLbVENcf8jxlv0fe/QSMNFg2nVJR/1NkOCiy9P3mOOESRGPRVeq0B3Fa8dv2iAWad6sH3SuSm1XcXR/3JncOWXQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776853121; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=p/Vl2py7bAr3MMXnnVGwEiFMxjfl+Vi5CKcG3JxQvlI=; b=R7FkMvHTqSh+j8/HiwumEOW9v+tcuWhmhW5aW4USw/pTR9xr2qk0xwhsK8yi/JleBMlSfOyMlw1VIE5qIsy2dskul/aX0yA9E9b/ZDBtef+4qtTniljK7AEv1jTU8g02okKS88378cLBjlWP1OukBPbKYceL1W311yWFFtEegl8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776853121417172.97770093658698; Wed, 22 Apr 2026 03:18:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wFUeX-000737-MX; Wed, 22 Apr 2026 06:17:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wFUeM-0006yf-1D for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:17:43 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wFUeD-0002Nt-NQ for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:17:37 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-488e1a8ac40so65974265e9.2 for ; Wed, 22 Apr 2026 03:17:33 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48a55b8baaesm181142385e9.10.2026.04.22.03.17.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 03:17:28 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id B68F65F941; Wed, 22 Apr 2026 11:10:45 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1776853052; x=1777457852; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=p/Vl2py7bAr3MMXnnVGwEiFMxjfl+Vi5CKcG3JxQvlI=; b=ren4nwMvrDHa0nBceUgmUprUFdCGrxHQKucJ4iksICqcZ3bWHDdUNN5gZwfNY1EZYI +rGosqqpCyD2WYrZxOASgFuZtALkZRn85w7q05vBOW4AM04AQfsBxkQfwRIIiqO14crd SA0jmrhWS/kAmN70dOgjVf2cYg7+vMmvfMj7vCI4uI/Z1XlZA6uZzapp++bGxgRdDeDh vHxsCNQB0IA+PXe/gGQUPQW071C99z32cKOQ/5eTFGMqmHFyXOSEap2IxcU25h2FFy4F Vf0fVPobzSwE2Nwyn5dmJLT9Dic7qFH1N1bpER+o+K9tj6SSjs7ZBVALgquSApiALtHp 3t2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776853052; x=1777457852; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=p/Vl2py7bAr3MMXnnVGwEiFMxjfl+Vi5CKcG3JxQvlI=; b=KSp7Q0dSWUIH3FsLQlDvc+Ro7ygaovWyg63lOHe7h/lw7suZdUKKIaKBvHFp4d0vBl AHCm5BWBAZGYRMUnjdv6YOnmTnqjbDCgRdH9OsuffYZO4IWzW+eGfT4pv9fHo1+q+G3p 25w+VkNZMtjjRxCDujYdJOVQx1f6KVbZOUUEN65sBoUG1Zn1mTL7Mse3V7GbUuEILRML ltLZ+ASB+ApHLAY5el+g8yqpyCCMUP1k62ZSe4uM1Lj0NXSVcEMyAcwBIonq4qVLJPFe JbYKh3CnD+Ueslm6wP3Yaa54z8M9OVer6Gc4dxdVZz5nBGd8CGhqjXPZYxoE08DGl59v rLYA== X-Gm-Message-State: AOJu0YyZ1pqB4EfKG/S0RdsC2fSUkvcTHwbUmMk8xeOh8/lFwxXxk9pP 9N8Qgh7i2EFRWoEPWjaP8bgqedqorRn06l4mpvPaD6tro1KFPdclySdEYJfn35eEf9w= X-Gm-Gg: AeBDies9yxV9Tf0vGMMWUistFB5fRih89t0TLBbGWGcdtfg8Mj1axtiHQW4TgL/q0Z9 90JXkttoFOEp/AzsSSgoREPdUVvV+NdUoxm4QXV/NRR8l/hnUgvgE1Isa5E0CtwxVsDcjN9njtt DNiDI2dG97qFjyoDersN+hB2hhcy18CdwQ5XSgolgOqreIKe620xw2sxM4b0xtliS9R6N5xsWjU A/sl0+i9Cy0DZxLFyTbsPCNAQTBvTvAUeXN9TSoYtBsRlxmjb0ROp4qptXqNLWxS0j27m28+YaD KsZDg5nXwLhMfv53ANx5IyHmCO3+2/OF0lNTXWHK+m5fkUykR3ZjrCUF/GpeUfZOIzDjUBJve8B ltWleByfsgyJBdcijrZyqhSeEMtXBDFp9rZ6IVEJo3B+P6QYhQGuZLR/N4cftmASMiafYIqKGTl Au3tOTxySy7DdTjn82irCQ+cizaHeYWnVCZVcS5L7plNd2 X-Received: by 2002:a05:600c:1e09:b0:48a:592c:e655 with SMTP id 5b1f17b1804b1-48a592ce7c2mr51094795e9.17.1776853051719; Wed, 22 Apr 2026 03:17:31 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , Mohamed Mediouni , kvm@vger.kernel.org, Pedro Barbuda , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v2 28/31] target/arm: hoist event broadcast code into a helper Date: Wed, 22 Apr 2026 11:10:39 +0100 Message-ID: <20260422101043.1234229-29-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260422101043.1234229-1-alex.bennee@linaro.org> References: <20260422101043.1234229-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1776853123011154100 We will shortly call it from more places. Signed-off-by: Alex Benn=C3=A9e --- target/arm/internals.h | 19 +++++++++++++++++++ target/arm/tcg/op_helper.c | 9 +-------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index dc593f1fec8..089f679ac0a 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -682,6 +682,25 @@ bool arm_is_psci_call(ARMCPU *cpu, int excp_type); /* Actually handle a PSCI call */ void arm_handle_psci_call(ARMCPU *cpu); =20 +/** + * arm_broadcast_event: set the event_register for all PEs + * + * This kicks all PEs which will up which are waiting on the event + * register. + */ +static inline void arm_broadcast_event(void) +{ + CPUState *cs; + + CPU_FOREACH(cs) { + ARMCPU *target_cpu =3D ARM_CPU(cs); + target_cpu->env.event_register =3D true; + if (!qemu_cpu_is_self(cs)) { + qemu_cpu_kick(cs); + } + } +} + /** * arm_clear_exclusive: clear the exclusive monitor * @env: CPU env diff --git a/target/arm/tcg/op_helper.c b/target/arm/tcg/op_helper.c index 655e3f96e78..6a2be85fcaa 100644 --- a/target/arm/tcg/op_helper.c +++ b/target/arm/tcg/op_helper.c @@ -474,14 +474,7 @@ void HELPER(wfit)(CPUARMState *env, uint32_t rd) =20 void HELPER(sev)(CPUARMState *env) { - CPUState *cs =3D env_cpu(env); - CPU_FOREACH(cs) { - ARMCPU *target_cpu =3D ARM_CPU(cs); - target_cpu->env.event_register =3D true; - if (!qemu_cpu_is_self(cs)) { - qemu_cpu_kick(cs); - } - } + arm_broadcast_event(); } =20 void HELPER(wfe)(CPUARMState *env) --=20 2.47.3 From nobody Sat May 30 20:12:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1776853167; cv=none; d=zohomail.com; s=zohoarc; b=n5BC6u6v5IUt8gR8nueMq1wGKWG3JkEIelTg/uf1mBtFORQSrDCOrCBczhVWmMgC36yW6pK3dYfc9/6o4e326ttVAE7TKNqy2E8pGkH5KjuLmosPqnkVjip+b+YwPwkU6furylLXLwBUEnootlq9vRCTZ54BFf7pZlkiFCZHNlc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776853167; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=gSYzG4w2krdb3nT01JqHA9xtpgh1UWf3StMYQUTc4bg=; b=NkHUiujbIXiRwNtNoC5pcKdXNLej1chs1h+i6C9OLhTg+zH+B58gEAX/IEfOJqbEbVI4/ioddBPC9hYVwEEp1pfEQJcGP12HMZQnlOkFWhRCwWfAY2IFUT/ucLaepihpSHaSg8zMW0fNMLqn7/qH3zJUzhQRPZqR5ReegnmxzBo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776853167267970.4439339151943; Wed, 22 Apr 2026 03:19:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wFUey-0007W8-Vm; Wed, 22 Apr 2026 06:18:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wFUeM-0006yv-7w for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:17:43 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wFUeD-0002Ne-LZ for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:17:36 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-4891d7164ddso20264915e9.3 for ; Wed, 22 Apr 2026 03:17:31 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43fe4e4d5b1sm48556196f8f.30.2026.04.22.03.17.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 03:17:28 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id CF1A4616F5; Wed, 22 Apr 2026 11:10:45 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1776853051; x=1777457851; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gSYzG4w2krdb3nT01JqHA9xtpgh1UWf3StMYQUTc4bg=; b=fArmz0PbBkq28AMLdMgSbpAv/cUpBHGo4I/DAj22+KywMjndnEotuLki9TrydBg3wx 6oQbjZ0Q1bNxDT/Ip8XE0wPNABBNb8cd1mjKOTnq/nAxGI6rI+yOUqU7fpXlEEJfZ5Ll kV/iHmo6R22URvemdRe9EJSKI18NdXhj3wpQLmOqnvYNfGKNvqF2hg/59iGnEnOl8kUP 9oivF8WWIJginRd3SuRU/GkP5dy0RCXWceDhBKB2bXCCoOJ7JBIlW7q0O7ZltCYGMv23 JSw6fqpUvlgYvXctAALT5pnE4S4EyhA8aFsEgx2TG1qyZQZsR9M1pksaz1rQD7FUTjsq BvFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776853051; x=1777457851; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=gSYzG4w2krdb3nT01JqHA9xtpgh1UWf3StMYQUTc4bg=; b=qsZDOd1OiJAW4/s6F0H/Oa7dvXFzsLYmw+xGzOiWz4kNIJ+bcb6+f2zpFIjdiLP1ct eM5u1bQ6G/ZAwR6+LiFLPFljCT96aOBQMJhYjpmYJVcYG7huzEtQA5laTpfNbB8kwePu GawANUlaTee4nCh7NTqdjOR4/IAm4IKos11DmfEZrm0bU81emHe8vGwiTvL/w7t+5J0B K4f4RIt6EwTZ9IjwfVntPKYR2z84jLETl9WP+jRBya0FBJt0RwWkLxwYPhgLR2usmGA7 WmAiW+/8tg7gF6bxxcfhSjgtvztP7Ul4T+xFsVBxfSGqNd3XVIpeD8x0TceDMx4HoMea 6VkA== X-Gm-Message-State: AOJu0Ywai4dw4KxvoFbNnMlQqgpfJgY+ykOIexhu1QeuV8ypto4A+LO+ FEhuNrF3rriz1MITrCmKi9M9Bi+fkggE0eBcGwfYOO8AaFh78XUnuMAv+QcaksonLmw= X-Gm-Gg: AeBDiesoqjK3YFs2ZyJhuDG7EIBaElJ3GpgR2qG8g9RBUqbGBu1NK8GlMuQ2nX3hFhD xEtvhfUniX5T2DFaHh0exB6opiq7A60rbTxDgNAHSdwG/rIm8ZsunY9iIf1yGhiVC7wEBL0v53X kfz7QEH9R8knzGwbge8vOhe9q51WWvrre6NIWB8RXfV2Ai9RrS+X9oJ/x2A0zTlxfOSWEWxUnUX 8Np3gmH7eqq4pPI2Og/ERLOK5rRS6iBvldb342UCMTyhykkP5B7FmmRw0x95F1MI0AMzl4d03zL YxmNNbpKqJCu2HonjtpT6BHoidYLwI1R/08osEcN03Nuda8HY4JPyZLJXF6uxd5V3uchtZgSC5Z 4yu5iFLqcSPbNJuFOGzg/AyPI/SGfW5BhdbjUdnjqf1IwFl/27FS72tZbHV7lM4zCqWW1pJa3XR eYSUGurpVLIHV3wte9KkkpxsgLZzSN9JGSjg== X-Received: by 2002:a05:600c:3e1a:b0:489:1ca2:eafd with SMTP id 5b1f17b1804b1-4891ca2ee65mr169059005e9.11.1776853050447; Wed, 22 Apr 2026 03:17:30 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , Mohamed Mediouni , kvm@vger.kernel.org, Pedro Barbuda , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v2 29/31] target/arm: implement global monitor events Date: Wed, 22 Apr 2026 11:10:40 +0100 Message-ID: <20260422101043.1234229-30-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260422101043.1234229-1-alex.bennee@linaro.org> References: <20260422101043.1234229-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1776853167709158500 Moving from Exclusive to Open Access should generate event stream events. Technically a non-exclusive store to any address range covered by the global monitor should also trigger such an event but we can only detect that after the event by seeing if memory doesn't match cpu_exclusive_val when processing the eventual store exclusive. The CLREX instruction has the same effect as do other operations clearing the exclusive state (such as eret). We special case STLR/STL (Store Release) instructions to generate events because their use is a suggested pattern for clearing locks that might be sleeping. We only trigger the event if we detect an exclusive instruction is running. Signed-off-by: Alex Benn=C3=A9e --- v2 - add gen_global_event_reg() and use that - add handling for STL/STLR --- target/arm/internals.h | 1 + target/arm/tcg/translate.h | 14 ++++++++++++++ target/arm/tcg/translate-a64.c | 23 +++++++++++++++++++++++ target/arm/tcg/translate.c | 20 ++++++++++++++++++++ 4 files changed, 58 insertions(+) diff --git a/target/arm/internals.h b/target/arm/internals.h index 089f679ac0a..7045b4a56bd 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -709,6 +709,7 @@ static inline void arm_broadcast_event(void) static inline void arm_clear_exclusive(CPUARMState *env) { env->exclusive_addr =3D -1; + arm_broadcast_event(); } =20 /** diff --git a/target/arm/tcg/translate.h b/target/arm/tcg/translate.h index 9bf2701a56b..01053060af4 100644 --- a/target/arm/tcg/translate.h +++ b/target/arm/tcg/translate.h @@ -882,6 +882,20 @@ static inline void gen_event_reg(void) #endif } =20 +/* + * Some events affect all PEs in the same shareability domain. In + * practice as we currently model SMP systems as single SoC devices so + * we signal them all. + */ +static inline void gen_global_event_reg(void) +{ +#ifndef CONFIG_USER_ONLY + /* re-use the SEV helper */ + gen_helper_sev(tcg_env); +#endif +} + + /* * Helpers for implementing sets of trans_* functions. * Defer the implementation of NAME to FUNC, with optional extra arguments. diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index f30df5dbfed..a1b0cc9508e 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -2253,6 +2253,7 @@ static bool trans_CHKFEAT(DisasContext *s, arg_CHKFEA= T *a) static bool trans_CLREX(DisasContext *s, arg_CLREX *a) { tcg_gen_movi_i64(cpu_exclusive_addr, -1); + gen_global_event_reg(); return true; } =20 @@ -3407,6 +3408,14 @@ static void gen_store_exclusive(DisasContext *s, int= rd, int rt, int rt2, tcg_gen_setcond_i64(TCG_COND_NE, tmp, tmp, cpu_exclusive_val); } tcg_gen_mov_i64(cpu_reg(s, rd), tmp); + + /* + * On a successful StoreExcl the global monitor transitions from + * Exclusive to Open Access and at that point generate an Event + * for PEs in the same memory sharing domain. + */ + gen_global_event_reg(); + tcg_gen_br(done_label); =20 gen_set_label(fail_label); @@ -3544,6 +3553,7 @@ static bool trans_STLR(DisasContext *s, arg_stlr *a) TCGv_i64 clean_addr; MemOp memop; bool iss_sf =3D ldst_iss_sf(a->sz, false, false); + TCGLabel *skip_monitor_event =3D gen_new_label(); =20 /* * StoreLORelease is the same as Store-Release for QEMU, but @@ -3562,6 +3572,19 @@ static bool trans_STLR(DisasContext *s, arg_stlr *a) true, a->rn !=3D 31, memop); do_gpr_st(s, cpu_reg(s, a->rt), clean_addr, memop, true, a->rt, iss_sf, a->lasr); + + /* + * We don't fully model the global monitor as it would be very + * expensive for every memory access. However in the Arm ARM "Use + * of Wait for Event (WFE) and Send Event (SEV) with lock" it does + * give the example of using STLR to clear a lock. So if a lock is + * active trigger the global event register so we don't deadlock + * while sleeping. + */ + tcg_gen_brcondi_i64(TCG_COND_EQ, cpu_exclusive_addr, -1, skip_monitor_= event); + gen_global_event_reg(); + gen_set_label(skip_monitor_event); + return true; } =20 diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c index 59925151fc3..18d64620e40 100644 --- a/target/arm/tcg/translate.c +++ b/target/arm/tcg/translate.c @@ -2116,6 +2116,12 @@ static void gen_store_exclusive(DisasContext *s, int= rd, int rt, int rt2, tcg_gen_setcond_i32(TCG_COND_NE, t0, t0, t2); } tcg_gen_mov_i32(cpu_R[rd], t0); + /* + * On a successful StoreExcl the global monitor transitions from + * Exclusive to Open Access and at that point generate an Event + * for PEs in the same memory sharing domain. + */ + gen_global_event_reg(); tcg_gen_br(done_label); =20 gen_set_label(fail_label); @@ -4218,6 +4224,7 @@ static bool trans_STLEXH(DisasContext *s, arg_STREX *= a) static bool op_stl(DisasContext *s, arg_STL *a, MemOp mop) { TCGv_i32 addr, tmp; + TCGLabel *skip_monitor_event; =20 if (!ENABLE_ARCH_8) { return false; @@ -4230,10 +4237,23 @@ static bool op_stl(DisasContext *s, arg_STL *a, Mem= Op mop) =20 addr =3D load_reg(s, a->rn); tmp =3D load_reg(s, a->rt); + skip_monitor_event =3D gen_new_label(); tcg_gen_mb(TCG_MO_ALL | TCG_BAR_STRL); gen_aa32_st_i32(s, tmp, addr, get_mem_index(s), mop | MO_ALIGN); disas_set_da_iss(s, mop, a->rt | ISSIsAcqRel | ISSIsWrite); =20 + /* + * We don't fully model the global monitor as it would be very + * expensive for every memory access. However in the Arm ARM "Use + * of Wait for Event (WFE) and Send Event (SEV) with lock" it does + * give the example of using STL to clear a lock. So if a lock is + * active trigger the global event register so we don't deadlock + * while sleeping. + */ + tcg_gen_brcondi_i64(TCG_COND_EQ, cpu_exclusive_addr, -1, skip_monitor_= event); + gen_global_event_reg(); + gen_set_label(skip_monitor_event); + return true; } =20 --=20 2.47.3 From nobody Sat May 30 20:12:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1776853164; cv=none; d=zohomail.com; s=zohoarc; b=KWRyaWbaimtHy7NZiWJ9FtLsVmnoLfjYVzSsymPsCxfrMV/h4qz6Fwkfeuy3w24jrUMzpuWpcHjjDfjEVX+WCsiN5veBzeGznZsqdoGJYviYlrNLiVeyoLKH+rTQUhShJFJtfvnhUuSKrQoycHPAUzYGna1kXcR0j1ERH3HMTpY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776853164; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ChBMLZB7W3RWggGvPxQhi9T29Aee3H3wmNETcHJ/8uM=; b=M/1kamSDKa2MZ9v7uChgHJk24ps5mmgbLQ57yGHu8S9fyefawb/re5OWNMSC8rXgh5EG58Erf7T/DVfxmzPjQunLZlD6HpDMKgMiyJpqQ8WhuAZCggN4BEX1aPg5LuVRghJu3QXhTnmI4jbLtynNlw1Ycwk7VafCZQ4IlPnoD/U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776853164871377.82024206869767; Wed, 22 Apr 2026 03:19:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wFUeq-0007If-75; Wed, 22 Apr 2026 06:18:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wFUeM-0006yp-6G for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:17:43 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wFUeD-0002Nk-Nf for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:17:38 -0400 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-43d572f7437so3490190f8f.1 for ; Wed, 22 Apr 2026 03:17:32 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43fe4e46898sm46561003f8f.27.2026.04.22.03.17.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 03:17:28 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id E594E617C4; Wed, 22 Apr 2026 11:10:45 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1776853051; x=1777457851; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ChBMLZB7W3RWggGvPxQhi9T29Aee3H3wmNETcHJ/8uM=; b=mtqyEhjHSjE1wVWOnX40jX5ur3YCGsNHdrEYRM/0bqMJys5p5i7q/3KFHkl3mExxsc DjoIP6gZt8NrL2pwrqSMgNzDCo/fN4pPKNpRvF7xWILVCWasEK5vNNbBVGfmsKjfcUZu CrSv88B3G3cS7JumbBnwYqXsm+224xgvECN4X2i8x2aA9aITaVgaWs/FySstvfbQ0+bJ nJJ80V3bv/udDCgCgo7ROPCc7rA+7+UfAtYQr3X0u36BMdlPqDmYE0O5xvrcwHL6581W u6lJcSRr7TPGEGdChXdVVosdTEGcEozZjjppyf8OTyt8axD20XVTHTak9xE6SsUAt3KO DQ+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776853051; x=1777457851; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ChBMLZB7W3RWggGvPxQhi9T29Aee3H3wmNETcHJ/8uM=; b=jmeSKjHNxUbmx95AsdwCJw1TcE8NnbW1pPx77vJRGffjjd1TdssCwMSWoq4hgEUNAb oSFsIDALBZf9rpO5ztWmeWpFCY4O6TF9AQWI5i2hQJh9XHoTXR7xDzB2BFdMAvh8dsbv r0oRnpdm+OXgMRVjbOI79kXMTymFUJwMTPUBvHmCG4oMIEDd3UxRmfrKFNrH/uUrjQp4 p9KdeY6OTO38JLVTUdIhFOW0m8s4PiVmbvoLRIyRFyOiYdL0eGbsUoVAZqjns03Lg1r4 rMgJ84Ujtx6W0bHGIhx7cK8NVCt2vyEKAoHZRhxHwrMbXwhrzUUPEeLUFxaxiSOvrGQE XHTA== X-Gm-Message-State: AOJu0Yzws4/yBwKCl61I/etz7n3oSlLB+tVVJTLTOXolYKQU1oxuDTmd adjG4IldKcgXx+nvHAgq7XTbdqgKw2LYmUi/zAsCGXZj0qXpGjoeTEOC8HfZA8IqHLc= X-Gm-Gg: AeBDievV9o6ORsdP2fIImraZViv2xHSkIijJlHNx3Tu/EzAFh1EUC89IYHWWWlmty/9 1dbjQKWcOqvd2b4WJ7MRQOy/k/5kTcRjeqCY+QHIBFJc5KqemrFlbHKd4JXeo0p0T5Z3nVZr+ux Q3WXYxZB+kEEljnw6j/OwYpBIXqHPLQE5ZoBPJKC/B8SBW7UcXj6UTcqhmHu942bcgNeml6FxyA Po+Jrg6W3LygRgP73RlIhZMRCu5Lg46I8LQK+A68t3lNY0htBJzz6d7s3DoRx0PFfUeoWlFR8n9 wmIxkOvDcUa1gf4yfK6Ar9DiHFq8+791cuADbZ4IaBVVOXoiE8J9D5s635WiP9HUHReKogxiQ1v gUfqW9XLELo7CW7yEMhzQpwC6WxqzyV4iAT6l1KAox4m+cPBGelE3nxjyfjYkkyrFOdVm57nQnb 6uXmbq/x3ZsIt7JR2XABohA3SxBW2TuXbP6A== X-Received: by 2002:a05:6000:1a8e:b0:43d:3004:5fef with SMTP id ffacd0b85a97d-43fe3dbeaf2mr32935858f8f.7.1776853051221; Wed, 22 Apr 2026 03:17:31 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , Mohamed Mediouni , kvm@vger.kernel.org, Pedro Barbuda , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v2 30/31] target/arm: enable event stream on WFE instructions Date: Wed, 22 Apr 2026 11:10:41 +0100 Message-ID: <20260422101043.1234229-31-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260422101043.1234229-1-alex.bennee@linaro.org> References: <20260422101043.1234229-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x435.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1776853167776154100 Two generic timers (K and H) are capable of generating timer event stream events. Provide a helper to calculate when the nearest one will happen. Now we can calculate when the next event stream event is we can re-use the wfxt_timer and configure it to fire as we enter a WFE that is going to sleep. Reverse the M-profile logic so we can enter a sleep state in both profiles. Signed-off-by: Alex Benn=C3=A9e --- v2 - merged target/arm: add gt_calc_next_event_stream - update to use halt_reason - made arm_wfxt_timer_cb atomically consume halt_reason --- target/arm/cpu.c | 13 ++++ target/arm/tcg/op_helper.c | 129 +++++++++++++++++++++++++++++++------ 2 files changed, 122 insertions(+), 20 deletions(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 124be8c401e..7a6ad45ae08 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -799,10 +799,23 @@ bool arm_cpu_exec_halt(CPUState *cs) } #endif =20 +/* + * Unlike almost everything else that messes with the halt_reason and + * event_register details the timer callbacks are not in the vCPU + * context. + * + * To prevent races we atomically consume a HALT_WFE and set the event + * register. Either way we trigger the an exit event. + */ static void arm_wfxt_timer_cb(void *opaque) { ARMCPU *cpu =3D opaque; CPUState *cs =3D CPU(cpu); + CPUARMState *env =3D &cpu->env; + + if (qatomic_cmpxchg(&env->halt_reason, HALT_WFE, NOT_HALTED)) { + qatomic_set(&env->event_register, true); + } =20 /* * We expect the CPU to be halted; this will cause arm_cpu_is_work() diff --git a/target/arm/tcg/op_helper.c b/target/arm/tcg/op_helper.c index 6a2be85fcaa..030209360e8 100644 --- a/target/arm/tcg/op_helper.c +++ b/target/arm/tcg/op_helper.c @@ -477,6 +477,97 @@ void HELPER(sev)(CPUARMState *env) arm_broadcast_event(); } =20 +#ifndef CONFIG_USER_ONLY +/* + * Event Stream events don't do anything apart from wake up sleeping + * cores. These helpers calculate the next event stream event time so + * the WFE helper can decide when its next wake up tick will be. + */ +static int64_t gt_recalc_one_evt(CPUARMState *env, uint32_t control, uint6= 4_t offset) +{ + ARMCPU *cpu =3D env_archcpu(env); + bool evnten =3D FIELD_EX32(control, CNTxCTL, EVNTEN); + + if (evnten) { + int evnti =3D FIELD_EX32(control, CNTxCTL, EVNTI); + bool evntis =3D FIELD_EX32(control, CNTxCTL, EVNTIS); + bool evntdir =3D FIELD_EX32(control, CNTxCTL, EVNTDIR); + /* + * To figure out when the next event timer should fire we need + * to calculate which bit of the counter we want to flip and + * which transition counts. + * + * So we calculate 1 << bit - current lower bits and then add + * 1 << bit if the bit needs to flip twice to meet evntdir + */ + int bit =3D evntis ? evnti + 8 : evnti; + uint64_t count =3D gt_get_countervalue(env) - offset; + uint64_t target_bit =3D BIT_ULL(bit); + uint64_t lower_bits =3D MAKE_64BIT_MASK(0, bit - 1); + uint64_t next_tick =3D target_bit - (count & lower_bits); + uint64_t abstick; + + /* do we need to bit flip twice? */ + if (((count & target_bit) !=3D 0) ^ evntdir) { + next_tick +=3D target_bit; + } + + /* + * Note that the desired next expiry time might be beyond the + * signed-64-bit range of a QEMUTimer -- in this case we just + * set the timer for as far in the future as possible. When the + * timer expires we will reset the timer for any remaining period. + */ + if (uadd64_overflow(next_tick, offset, &abstick)) { + abstick =3D UINT64_MAX; + } + if (abstick > INT64_MAX / gt_cntfrq_period_ns(cpu)) { + return INT64_MAX; + } else { + return abstick; + } + } + + return -1; +} + +/* + * Calculate the next event stream time and return it. Returns -1 if + * no event streams are enabled. It is up to the WFE helpers to decide + * on the next time. + */ +static int64_t gt_calc_next_event_stream(CPUARMState *env) +{ + ARMCPU *cpu =3D env_archcpu(env); + uint64_t hcr =3D arm_hcr_el2_eff(env); + int64_t next_time =3D -1; + uint64_t offset; + + /* Unless we are missing EL2 this can generate events */ + if (arm_feature(env, ARM_FEATURE_EL2)) { + offset =3D gt_direct_access_timer_offset(env, GTIMER_PHYS); + next_time =3D gt_recalc_one_evt(env, env->cp15.cnthctl_el2, offset= ); + } + + /* Event stream events from virtual counter enabled? */ + if (!cpu_isar_feature(aa64_vh, cpu) || + !((hcr & (HCR_E2H | HCR_TGE)) =3D=3D (HCR_E2H | HCR_TGE))) { + int64_t next_virt_time; + offset =3D gt_direct_access_timer_offset(env, GTIMER_VIRT); + next_virt_time =3D gt_recalc_one_evt(env, env->cp15.c14_cntkctl, o= ffset); + + /* is this earlier than the next physical event? */ + if (next_virt_time > 0) { + if (next_time < 0 || next_virt_time < next_time) { + next_time =3D next_virt_time; + } + } + } + + return next_time; +} +#endif + void HELPER(wfe)(CPUARMState *env) { #ifdef CONFIG_USER_ONLY @@ -489,32 +580,30 @@ void HELPER(wfe)(CPUARMState *env) #else /* * WFE (Wait For Event) is a hint instruction. - * For Cortex-M (M-profile), we implement the strict architectural beh= avior: + * * 1. Check the Event Register (set by SEV or SEVONPEND). * 2. If set, clear it and continue (consume the event). */ - if (arm_feature(env, ARM_FEATURE_M)) { - CPUState *cs =3D env_cpu(env); + CPUState *cs =3D env_cpu(env); + ARMCPU *cpu =3D ARM_CPU(cs); =20 - if (env->event_register) { - env->event_register =3D false; - return; - } + if (env->event_register) { + env->event_register =3D false; + return; + } =20 - env->halt_reason =3D HALT_WFE; - cs->exception_index =3D EXCP_HLT; - cs->halted =3D 1; - cpu_loop_exit(cs); - } else { - /* - * For A-profile and others, we rely on the existing "yield" behav= ior. - * Don't actually halt the CPU, just yield back to top - * level loop. This is not going into a "low power state" - * (ie halting until some event occurs), so we never take - * a configurable trap to a different exception level - */ - HELPER(yield)(env); + /* For A-profile we also can be woken by the event stream */ + if (arm_feature(env, ARM_FEATURE_AARCH64) && cpu->wfxt_timer) { + int64_t next_event =3D gt_calc_next_event_stream(env); + if (next_event > 0) { + timer_mod(cpu->wfxt_timer, next_event); + } } + + env->halt_reason =3D HALT_WFE; + cs->exception_index =3D EXCP_HLT; + cs->halted =3D 1; + cpu_loop_exit(cs); #endif } =20 --=20 2.47.3 From nobody Sat May 30 20:12:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1776853175; cv=none; d=zohomail.com; s=zohoarc; b=ZY29ri2NNZsv4DnQK6JpJKwgOeCQZAWopRwpLkFW8GC4NzaO6wTYKe9P7Amu8KZF1siHSxAbpRCQjdUSrRI2pOw+9TmoxSKsS8byk0ZUJC0QCRWMNCasyAydkFoII/tT6YELenbj3jR7ZNvlTfDMSB+RILk8VLQ6wSXTmrxrnkw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1776853175; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=v9TGxTsXQ4q7KQiokEaw8AGBMMJRUq1ldJ+z5GAXPms=; b=XYBMqDlasq4OR2trpl6PouvHWKbVkeL/deWTzDWiJ1eIu3uIp35SIt0LNdKvNuozAvCU0ZU8lcK7zbzaMpTzkOUQpftfL4A+tP3272KgrdJPIPWi2ywy1TKf77PonavP8i3JuBpIW0MhLQQTF31SJQjaETzMQRvJoI5HJ7CvpsY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1776853175348705.612608829002; Wed, 22 Apr 2026 03:19:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wFUen-0007DH-CN; Wed, 22 Apr 2026 06:18:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wFUeM-0006yw-7v for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:17:43 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wFUeD-0002MU-QL for qemu-devel@nongnu.org; Wed, 22 Apr 2026 06:17:39 -0400 Received: by mail-wm1-x341.google.com with SMTP id 5b1f17b1804b1-483487335c2so52369385e9.2 for ; Wed, 22 Apr 2026 03:17:26 -0700 (PDT) Received: from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48a55dc9f58sm266229045e9.6.2026.04.22.03.17.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2026 03:17:24 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 06F3C617D8; Wed, 22 Apr 2026 11:10:46 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1776853045; x=1777457845; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=v9TGxTsXQ4q7KQiokEaw8AGBMMJRUq1ldJ+z5GAXPms=; b=TzAuik/PUnqDFYwFHFKKGIETYkLHGw1i072RRMtsvIBNcZLzdJ1gG6Tn/nQl1OR7o0 1K6jebO9egLjsQBpq0Iu4pV7XnVyEPqOoQ/S4tYzC9V9iH/bIe+ajeXhEMbuLY8BL/FL G87EQgK6Q0TKC6X8MpMC4FNlaWaA+OAJW9ewMQOAn6k1piIP5sYLjjsu9yg8saQc5FvE J8VgStHzfS9MvYnhQJydMsXzY5UM4fD/OM/hjNqHwuyed4JACPOnoPHb/OPi8M92vAz/ NxnCdstKjdsgiWPxE+byHsR0VHy1ept2IarBYteygDE7HLe7iRjsxi6TeIXet1rzEz+W PHtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776853045; x=1777457845; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=v9TGxTsXQ4q7KQiokEaw8AGBMMJRUq1ldJ+z5GAXPms=; b=SPZB+UYVYVzP7CVByEzQgKHi6kdzjepnYDnBI2ni5ctcl1iUMxwHGYPJed8Bgp/nq+ GRortpeZT8K2h30uyU1JK+fvq7p4oW55LxWKJxd6n9Yx5PvJjxOgx+ILQDH9LUvkJU/e oe3rpwF7u/AgyWzB1wNobOjAHe76knZ3zKtKnSlUSh0An3MDm/Jnd8mIcRKSrPYWrMZ+ eW7Lz07Pa79WoSb48dcG5MLiz3+oiuyXa9SdORcw8A5+CBUxOSZ7/nIpUpfQd1+rkLhH f/8PMpGcz2AHD8bRUZ1aeiBFeIST+VM+jYT/3Qo3Fi6+gRvxOP6MFJw98U5yhaCVV2IU sfSA== X-Gm-Message-State: AOJu0YwH8FNZjcgQ3UWrDd4x4vDrZsOnHQTWbse+5+pA1qarzdDEh08e f+GQDOZnJY3tSuYTS4ohFwfcYgbxVNzksgK6B3ktQqm+v7pyUjXJgIE0JAXEyOhQglU= X-Gm-Gg: AeBDiety6dvOWpQblshqwjyntNiYZ7gAbXdJ+oSDgeubXSZMBBAmwg6HIoOe+UI6Cfg 5YGIOlfW0o41v6znmdbhJUGmv100EBDyLsT4BYT3l9ZORdsE+48HNFJs0HvgNs9oaAMi8kCnVHp FoCLfPotR6Hz50auU+SWoHCaCH5dFWjNdPHr7iGyYPFJ5GOaTxb3GVDsTZI49Jc3ng3y4SeDw4J Wrh2K00rcNeLFJhIL87XFK5CJjM9/OKf7NbfS+dfOY6Q6cugwNTeUsF4lUPrDF30NR2ZqJD9jXq 1BJeq7PkJz8OQ/bAkZf+phmWxPhmnqBI38j3RUDW5xjxYNoaWNcI89//LB7z2Frk9mE2iFUXmwI sFyPsn3+rfscuY7KMKZsOr0rCw3EwgTIzyvyEqABl8oaqL8WkCmoiN1LcHCw7DJtfVL1i2ljBc9 C8UxnOT+Rd/SYKyuoHJjleW2ul7J55fkLBCw== X-Received: by 2002:a05:600c:a31a:b0:488:b239:77ec with SMTP id 5b1f17b1804b1-488fb778db4mr234699655e9.17.1776853045332; Wed, 22 Apr 2026 03:17:25 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Alexander Graf , qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , Mohamed Mediouni , kvm@vger.kernel.org, Pedro Barbuda , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH v2 31/31] target/arm: implement WFET Date: Wed, 22 Apr 2026 11:10:42 +0100 Message-ID: <20260422101043.1234229-32-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260422101043.1234229-1-alex.bennee@linaro.org> References: <20260422101043.1234229-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::341; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x341.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1776853176239154101 Now we have the event stream and SEV/SEVL implemented we can finally enable WFET for Aarch64. Signed-off-by: Alex Benn=C3=A9e --- v2 - fix exception syndrome by using enum value - use env->halt_reason --- target/arm/tcg/helper-defs.h | 1 + target/arm/tcg/op_helper.c | 80 ++++++++++++++++++++++++++++++++++ target/arm/tcg/translate-a64.c | 15 ++++--- 3 files changed, 89 insertions(+), 7 deletions(-) diff --git a/target/arm/tcg/helper-defs.h b/target/arm/tcg/helper-defs.h index a05f2258f29..31ffcbc6448 100644 --- a/target/arm/tcg/helper-defs.h +++ b/target/arm/tcg/helper-defs.h @@ -56,6 +56,7 @@ DEF_HELPER_1(setend, void, env) DEF_HELPER_2(wfi, void, env, i32) DEF_HELPER_1(wfe, void, env) DEF_HELPER_2(wfit, void, env, i32) +DEF_HELPER_2(wfet, void, env, i32) DEF_HELPER_1(yield, void, env) DEF_HELPER_1(pre_hvc, void, env) DEF_HELPER_2(pre_smc, void, env, i32) diff --git a/target/arm/tcg/op_helper.c b/target/arm/tcg/op_helper.c index 030209360e8..0c7f069a369 100644 --- a/target/arm/tcg/op_helper.c +++ b/target/arm/tcg/op_helper.c @@ -607,6 +607,86 @@ void HELPER(wfe)(CPUARMState *env) #endif } =20 +void HELPER(wfet)(CPUARMState *env, uint32_t rd) +{ +#ifdef CONFIG_USER_ONLY + /* + * As for WFIT make it NOP here, because trying to raise EXCP_HLT + * would trigger an abort. + */ + return; +#else + ARMCPU *cpu =3D env_archcpu(env); + CPUState *cs =3D env_cpu(env); + uint32_t excp; + int target_el =3D check_wfx_trap(env, false, &excp); + /* The WFET should time out when CNTVCT_EL0 >=3D the specified value. = */ + uint64_t cntval =3D gt_get_countervalue(env); + uint64_t timeout =3D env->xregs[rd]; + /* + * We want the value that we would get if we read CNTVCT_EL0 from + * the current exception level, so the direct_access offset, not + * the indirect_access one. Compare the pseudocode LocalTimeoutEvent(), + * which calls VirtualCounterTimer(). + */ + uint64_t offset =3D gt_direct_access_timer_offset(env, GTIMER_VIRT); + uint64_t cntvct =3D cntval - offset; + uint64_t nexttick; + int64_t next_event; + + /* + * As for WFE if the event register is already set we can consume + * the event and return immediately. + */ + if (env->event_register) { + env->event_register =3D false; + return; + } + + + if (cpu_has_work(cs) || cntvct >=3D timeout) { + /* + * Don't bother to go into our "low power state" if + * we would just wake up immediately. + */ + return; + } + + /* We might sleep, so now we check to see if we should trap */ + if (target_el) { + env->pc -=3D 4; + raise_exception(env, excp, syn_wfx(1, 0xe, rd, true, WFET, false),= target_el); + } + + /* + * Finally work out if the timeout or event stream will kick in + * earlier. + */ + if (uadd64_overflow(timeout, offset, &nexttick)) { + nexttick =3D UINT64_MAX; + } + if (nexttick > INT64_MAX / gt_cntfrq_period_ns(cpu)) { + nexttick =3D INT64_MAX; + } + + next_event =3D gt_calc_next_event_stream(env); + if (next_event > 0 && next_event < nexttick) { + timer_mod(cpu->wfxt_timer, next_event); + } else { + if (nexttick =3D=3D INT64_MAX) { + timer_mod_ns(cpu->wfxt_timer, INT64_MAX); + } else { + timer_mod(cpu->wfxt_timer, nexttick); + } + } + + env->halt_reason =3D HALT_WFE; + cs->exception_index =3D EXCP_HLT; + cs->halted =3D 1; + cpu_loop_exit(cs); +#endif +} + void HELPER(yield)(CPUARMState *env) { CPUState *cs =3D env_cpu(env); diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c index a1b0cc9508e..19e00573979 100644 --- a/target/arm/tcg/translate-a64.c +++ b/target/arm/tcg/translate-a64.c @@ -2093,14 +2093,15 @@ static bool trans_WFET(DisasContext *s, arg_WFET *a) return false; } =20 - /* - * We rely here on our WFE implementation being a NOP, so we - * don't need to do anything different to handle the WFET timeout - * from what trans_WFE does. - */ - if (!(tb_cflags(s->base.tb) & CF_PARALLEL)) { - s->base.is_jmp =3D DISAS_WFE; + if (s->ss_active) { + /* Act like a NOP under architectural singlestep */ + return true; } + + gen_a64_update_pc(s, 4); + gen_helper_wfet(tcg_env, tcg_constant_i32(a->rd)); + /* Go back to the main loop to check for interrupts */ + s->base.is_jmp =3D DISAS_EXIT; return true; } =20 --=20 2.47.3