From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6E7A4606A32C for ; Thu, 3 Dec 2026 11:43:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=vp1sQZCK Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xZ5Dk-0004eF-Mp; Thu, 03 Dec 2026 06:43:28 -0500 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 1xZ5Dj-0004e1-Bv for qemu-arm@nongnu.org; Thu, 03 Dec 2026 06:43:27 -0500 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 1xZ5Dh-0001sh-IC for qemu-arm@nongnu.org; Thu, 03 Dec 2026 06:43:27 -0500 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4bba5e17cbeso79070485e9.1 for ; Thu, 03 Dec 2026 03:43:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1796298204; x=1796903004; darn=nongnu.org; h=content-type:content-transfer-encoding:mime-version:message-id :in-reply-to:references:user-agent:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to:content-type; bh=3YF/DTZmbc5OoD0fVjSMJcwSB/zm/dZPQX2MwLuY8Fs=; b=vp1sQZCK7qHBr+LMCrO5F4RupvVrZGDlSTJeSxzRkkS3GCYjkI5gIKTBVOqQ+JL5ou nzbPPtmEijewzJKlU4RBwRqhBADcikeAHxgIFF/ZC289G4i3d8yr7JjTp1djSDaFr42b 5OsZaNc4po3Eu7iFQwkfYyj6qNfLrkd2/nCKJAkXG+XZiXjxiY04YXP5VB2yHZqh8G9F 1TA0gmLjWim3zFwrVyUcpNsgTRnfWR5b7n7QnloYjapnj7Byq99aXGwpKC6mNewIjnrm PspFFO3e03GqM4cRkx9nKMZ+nRpPqC5isZa0Ev/fIiPj2V5THyESJ0cVeF+dqnUT7ziY F5lQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796298204; x=1796903004; h=content-type:content-transfer-encoding:mime-version:message-id :in-reply-to:references:user-agent:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=3YF/DTZmbc5OoD0fVjSMJcwSB/zm/dZPQX2MwLuY8Fs=; b=KFr6lYUhaEuAjPqcwB6JgnvZDn/CHlVFMy9LAm4jUDdLgroyiOqqY7zDD4fBLQ527+ s8Oo3G4Fs47t+inWZDjwf0RbrtJYTxHHbmCd95dfLSbibut7Cni6rOwbQC49vDLHdVKr kcXfUTNPYnmjRpZ05FYZtqb/SpDB0PkI47pn3RealVekJcnWW3WxlCrw9MimT0RSDaRf +NKRhAtPZ1NQNEUXSAlD/rptMc+RgZY/gG8O4g38RkgCD8ufR803bVRp4Veif/fq0kgC I0bQuont4DZ/Ilg1CTEd99m5BE2D84/cHOH3crhyXs8osj8aKpeQI0yEuaN6I3gM5g4Z X9Ow== X-Forwarded-Encrypted: i=1; AL+hErFEmClEsjop6in0NG5gOqS1b6ra5tCIP2k6zUIV01kpwv0ntCXQRBSsqs5IFLQhi2/7F2vAnxc5xw==@nongnu.org X-Gm-Message-State: APuU4Z/1t2E2gMNFOy2fiy27lWzvh8nnu1RIRN78x41pZPlWSWz3Ou40 mlqkxBinjaJrjvVYrXubHCZdUG9CLgLRoWOwVc2Gdnvpk7iObySFV/sPsOsSXnXQMuY= X-Gm-Gg: AZFdTZcimF7YYNbnacavF+frsqxjguCrAeJXpPO3eqXAeQLzUo0Y3GjhdOwNjIT6a86 YFOAoWMi+KX7xhWOvMavU8Ai6ikJDVc/6oAR3bDEzEinWS7lZ55mlpv2daqRrDD24u/We6nXbX9 qaGjCzHMw3v7sKkje8M52HtTk2QguDa1opUh1JdGEnsJ4dRMVRVCKTATB0CXmzOyMa+IjvlpEsP FUKHiy1eLZ805S/UJPhbDEonpA1bP1l4YjLBezQ6KZt1RS7nEFNrPDfxHz62XFCj9Lv7G0p0Wa0 Whi8C/QHkWHI+Urp7VyPqF0CepyiCC8/v1lYg+XAPgB7KrLwDP782Eqc3dF8KMriC6DWObrF2FL d5Kj6H3zE66GneYCiun2T8Ayc5wWY3uo1CXDxlsD0QmDNFUdhbVyV18I4KBVZBLLmuPN2hQUGxu 11onr7apYz8BLjxsyey2Dl3zSol9BDZKNMXY4Rr39rAQ89dotwGp8c8mqhwI3O5YRx23NJlR2V7 SE7/FpVMENLBByVk7YJO/rA7UT0eUECd3rsr45NSIQg39dKen4y/mrLs/MRhlbleWJb2QvRZqNh X3F9zXHdhvaJxJ8VBzcWjDfuq62ttXhQXa5kclxjR+pqp398vH7fkGjrq+OcFIASMU8ZoYsnUzn DGgfaqkfl/mxHasC2UmZOsEIAc0EV4CKneQsOXW6OqfaA4VoTf/F5xarqarcCLQBxFgwyyF3b16 sfo5lsv8UT6EwwNH3LbXEswfy4LWBj4hZ+5jsf00YeVO71hOMexlCJDJrZYhboB9ysmK5z X-Received: by 2002:a05:600c:1548:b0:4a1:e00b:a10b with SMTP id 5b1f17b1804b1-4bb88800020mr912925375e9.7.1796298203658; Thu, 03 Dec 2026 03:43:23 -0800 (PST) Received: from meli-email.org (athedsl-4431069.home.otenet.gr. [79.129.140.205]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb906640a2sm734995845e9.0.2026.12.03.03.43.23 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Dec 2026 03:43:23 -0800 (PST) Date: Thu, 03 Dec 2026 13:40:16 +0200 From: Manos Pitsidianakis To: Peter Maydell , qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: Philippe Mathieu-Daud=?UTF-8?B?w6k=?= , Manos Pitsidianakis Subject: Re: [PATCH v2 04/77] target/arm: GICv5 cpuif: Implement ICH_APR_EL2 User-Agent: meli/0.9.0 References: <20261203111118.1380524-1-peter.maydell@linaro.org> <20261203111118.1380524-5-peter.maydell@linaro.org> In-Reply-To: <20261203111118.1380524-5-peter.maydell@linaro.org> Message-ID: X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8"; format=flowed Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=manos.pitsidianakis@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-arm@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-arm-bounces+qemu-arm=archiver.kernel.org@nongnu.org X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Thu, 03 Dec 2026 13:10, Peter Maydell wrote: >Implement the ICH_APR_EL2 register. This is part of the hypervisor >control register interface, and is the hypervisor-facing access to >the state which holds the guest's its active priority register. s/its// > >The only slightly non-straightforward part of this is that because >the GICv5 allows a hypervisor to give its guest a GICv3-compatible >virtual CPU interface, this register has to UNDEF to the inner guest >when legacy-vcpu operation is enabled. We don't implement >GCIE_LEGACY in QEMU yet, but since we expect to do so in future, the >handling for this is implemented here. > >Signed-off-by: Peter Maydell >--- Reviewed-by: Manos Pitsidianakis > target/arm/cpu.h | 2 ++ > target/arm/tcg/gicv5-cpuif.c | 44 ++++++++++++++++++++++++++++++++++++ > 2 files changed, 46 insertions(+) > >diff --git a/target/arm/cpu.h b/target/arm/cpu.h >index b2f393f5018..5985e0a86e1 100644 >--- a/target/arm/cpu.h >+++ b/target/arm/cpu.h >@@ -596,6 +596,8 @@ typedef struct CPUArchState { > > /* Cached highest-priority pending PPI for each domain */ > GICv5PendingIrq ppi_hppi[NUM_GICV5_DOMAINS]; >+ >+ uint64_t ich_apr_el2; > } gicv5_cpuif; > > struct { >diff --git a/target/arm/tcg/gicv5-cpuif.c b/target/arm/tcg/gicv5-cpuif.c >index 46039fe4a4c..a9308d8b2eb 100644 >--- a/target/arm/tcg/gicv5-cpuif.c >+++ b/target/arm/tcg/gicv5-cpuif.c >@@ -90,6 +90,15 @@ static GICv5Common *gicv5_get_gic(CPUARMState *env) > return env->gicv5.gicv5state; > } > >+/* >+ * Return true if GIC virtual interface legacy operation is enabled. >+ * We don't currently implement FEAT_GCIE_LEGACY. >+ */ >+static bool gicv5_legacy_enabled(CPUARMState *env) >+{ >+ return false; >+} >+ > static GICv5Domain gicv5_logical_domain(CPUARMState *env) > { > /* >@@ -696,6 +705,34 @@ static void gic_cddi_write(CPUARMState *env, const ARMCPRegInfo *ri, > } > } > >+static CPAccessResult access_gicv5_ich_reg(CPUARMState *env, >+ const ARMCPRegInfo *ri, >+ bool isread) >+{ >+ /* >+ * accessfn for GICv5 ICH regs. The NV behaviour here is a little >+ * different from usual because of the optional legacy GIC feature. >+ * >+ * At EL1, if GCIE_LEGACY is disabled or not implemented, these >+ * behave like normal EL2 registers, which is that they redirect >+ * to memory if NV2 is enabled and trap to EL2 if not. If legacy >+ * operation is enabled, these registers must UNDEF to EL1 >+ * (because from the inner guest's point of view it has a GICv3 >+ * and this sysreg doesn't exist). >+ * >+ * The UNDEF at EL1 when NV==0 is handled already because of the >+ * .access = PL2_RW setting on the cpreg. >+ */ >+ if (arm_current_el(env) == 1 && gicv5_legacy_enabled(env)) { >+ return CP_ACCESS_UNDEFINED; >+ } >+ /* >+ * continue to either redirect-to-memory, trap-to-EL2 or (if >+ * current EL is 2 or 3) access the register >+ */ >+ return CP_ACCESS_OK; >+} >+ > static const ARMCPRegInfo gicv5_cpuif_reginfo[] = { > /* > * Barrier: wait until the effects of a cpuif system register >@@ -893,6 +930,13 @@ static const ARMCPRegInfo gicv5_cpuif_reginfo[] = { > .writefn = gic_icc_pcr_el1_write, > .resetfn = gic_icc_pcr_el1_reset, > }, >+ { .name = "ICH_APR_EL2", .state = ARM_CP_STATE_AA64, >+ .opc0 = 3, .opc1 = 4, .crn = 12, .crm = 8, .opc2 = 4, >+ .access = PL2_RW, .type = ARM_CP_NO_RAW, >+ .nv2_redirect_offset = 0xb00, >+ .accessfn = access_gicv5_ich_reg, >+ .fieldoffset = offsetof(CPUARMState, gicv5_cpuif.ich_apr_el2), >+ }, > }; > > void define_gicv5_cpuif_regs(ARMCPU *cpu) >-- >2.43.0 >