From: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>,
qemu-arm@nongnu.org, qemu-devel@nongnu.org
Cc: "Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>,
"Manos Pitsidianakis" <manos.pitsidianakis@linaro.org>
Subject: Re: [PATCH v2 04/77] target/arm: GICv5 cpuif: Implement ICH_APR_EL2
Date: Thu, 03 Dec 2026 13:40:16 +0200 [thread overview]
Message-ID: <tpgwka.2swptygvspll6@linaro.org> (raw)
In-Reply-To: <20261203111118.1380524-5-peter.maydell@linaro.org>
On Thu, 03 Dec 2026 13:10, Peter Maydell <peter.maydell@linaro.org> 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 <peter.maydell@linaro.org>
>---
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
> 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
>
next prev parent reply other threads:[~2026-12-03 11:43 UTC|newest]
Thread overview: 99+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 11:10 [PATCH v2 00/77] hw/intc/arm_gicv5: Implement virtualization support Peter Maydell
2026-12-03 11:10 ` [PATCH v2 01/77] hw/intc/arm_gicv5: Make lpi_cache hash value be L2 ISTE, not pointer to it Peter Maydell
2026-12-03 11:10 ` [PATCH v2 02/77] hw/intc/arm_gicv5: Fix type of "id" in hashtable foreach fns Peter Maydell
2026-12-03 11:32 ` Manos Pitsidianakis
2026-12-03 11:10 ` [PATCH v2 03/77] hw/intc/arm_gicv5: Fix various errors in register definitions Peter Maydell
2026-12-03 11:34 ` Manos Pitsidianakis
2026-12-03 11:10 ` [PATCH v2 04/77] target/arm: GICv5 cpuif: Implement ICH_APR_EL2 Peter Maydell
2026-12-03 11:40 ` Manos Pitsidianakis [this message]
2026-12-03 11:10 ` [PATCH v2 05/77] target/arm: GICv5 cpuif: Implement ICH_PPI_{ENABLE, PEND, ACTIVE} regs Peter Maydell
2026-12-03 11:43 ` Manos Pitsidianakis
2026-12-03 11:10 ` [PATCH v2 06/77] target/arm: GICv5 cpuif: Implement ICH_PPI_PRIORITYR<n>_EL2 Peter Maydell
2026-12-03 11:53 ` Manos Pitsidianakis
2026-12-03 11:10 ` [PATCH v2 07/77] target/arm: GICv5 cpuif: Implement ICH_PPI_DVIR<n>_EL2 Peter Maydell
2026-12-03 11:57 ` Manos Pitsidianakis
2026-12-03 12:14 ` Peter Maydell
2026-12-03 11:10 ` [PATCH v2 08/77] target/arm: GICv5 cpuif: Implement ICH_VCTLR_EL2 and ICH_VCMR_EL2 Peter Maydell
2026-12-03 12:02 ` Manos Pitsidianakis
2026-12-03 11:10 ` [PATCH v2 09/77] target/arm: GICv5 cpuif: Implement GIC fine-grained trap registers Peter Maydell
2026-12-04 6:01 ` Manos Pitsidianakis
2026-12-03 11:10 ` [PATCH v2 10/77] target/arm: GICv5 cpuif: Mark GIC registers for fine-grained traps Peter Maydell
2026-12-04 6:08 ` Manos Pitsidianakis
2026-12-03 11:10 ` [PATCH v2 11/77] target/arm: GICv5 cpuif: Mark GIC insns " Peter Maydell
2026-12-03 11:10 ` [PATCH v2 12/77] target/arm: GICv5 cpuif: Implement ICC_SRE_ELx Peter Maydell
2026-12-04 6:10 ` Manos Pitsidianakis
2026-12-03 11:10 ` [PATCH v2 13/77] target/arm: GICv5 cpuif: Implement ICH_PPI_HVIR<n>_EL2 Peter Maydell
2026-12-03 11:10 ` [PATCH v2 14/77] target/arm: GICv5 cpuif: Implement ICV_APR_EL1 Peter Maydell
2026-12-04 7:32 ` Manos Pitsidianakis
2026-12-03 11:10 ` [PATCH v2 15/77] target/arm: GICv5 cpuif: Implement ICV_CR0_EL1 Peter Maydell
2026-12-04 7:32 ` Manos Pitsidianakis
2026-12-03 11:10 ` [PATCH v2 16/77] target/arm: GICv5 cpuif: Implement ICV_PCR_EL1 Peter Maydell
2026-12-03 11:10 ` [PATCH v2 17/77] target/arm: GICv5 cpuif: Implement ICV_PPI_ENABLER<n>_EL1 Peter Maydell
2026-12-03 11:10 ` [PATCH v2 18/77] target/arm: GICv5 cpuif: Implement ICV_PPI_PRIORITYR<n>_EL1 Peter Maydell
2026-12-03 11:10 ` [PATCH v2 19/77] target/arm: GICv5 cpuif: Add comment about ICV_PPI_HMR<n>_EL1 Peter Maydell
2026-12-03 11:10 ` [PATCH v2 20/77] target/arm: GICv5 cpuif: Implement ICV_PPI_CACTIVER<n>_EL1, ICV_PPI_SACTIVER<n>_EL1 Peter Maydell
2026-12-03 11:10 ` [PATCH v2 21/77] target/arm: GICv5 cpuif: Implement ICV_PPI_CPENDR<n>_EL1, ICV_PPI_SPENDR<n>_EL1 Peter Maydell
2026-12-03 11:10 ` [PATCH v2 22/77] target/arm: GICv5 cpuif: Calculate current virtual PPI HPPI Peter Maydell
2026-12-04 7:47 ` Manos Pitsidianakis
2026-12-04 9:33 ` Peter Maydell
2026-12-03 11:10 ` [PATCH v2 23/77] target/arm: GICv5 cpuif: Add virtual support to IRS/cpuif HPPI APIs Peter Maydell
2026-12-04 7:50 ` Manos Pitsidianakis
2026-12-03 11:10 ` [PATCH v2 24/77] target/arm: GICv5 cpuif: Implement ICV_HPPIR_EL1 Peter Maydell
2026-12-03 11:10 ` [PATCH v2 25/77] target/arm: GICv5 cpuif: Implement gicv5_update_virq_vfiq() Peter Maydell
2026-12-03 11:10 ` [PATCH v2 26/77] target/arm: GICv5 cpuif: Implement ICH_CONTEXTR_EL2 Peter Maydell
2026-12-03 11:10 ` [PATCH v2 27/77] target/arm: GICv5 cpuif: ask the GIC for the virtual HPPI Peter Maydell
2026-12-04 7:52 ` Manos Pitsidianakis
2026-12-04 9:37 ` Peter Maydell
2026-12-03 11:10 ` [PATCH v2 28/77] target/arm: GICv5 cpuif: Handle LD/VD insns when setting domain/virtual args Peter Maydell
2026-12-03 11:10 ` [PATCH v2 29/77] target/arm: GICv5 cpuif: Handle virtual interrupts for GIC CDEOI Peter Maydell
2026-12-03 11:10 ` [PATCH v2 30/77] target/arm: GICv5 cpuif: Handle virtual interrupts for GIC CDDI Peter Maydell
2026-12-03 11:10 ` [PATCH v2 31/77] target/arm: GICv5 cpuif: Handle virtual interrupts for GICR CDIA, CDNMIA Peter Maydell
2026-12-03 11:10 ` [PATCH v2 32/77] target/arm: GICv5 cpuif: Handle GIC VDPEND VM argument Peter Maydell
2026-12-03 11:10 ` [PATCH v2 33/77] target/arm: GICv5 cpuif: Implement GIC VDnnn insns Peter Maydell
2026-12-03 11:10 ` [PATCH v2 34/77] target/arm: GICv5 cpuif: Implement GIC LDnnn insns Peter Maydell
2026-12-03 11:10 ` [PATCH v2 35/77] target/arm: GICv5 cpuif: Handle PPI injection in vPPI pending reads Peter Maydell
2026-12-03 11:10 ` [PATCH v2 36/77] target/arm: GICv5 cpuif: Handle PPI injection in vPPI pending writes Peter Maydell
2026-12-03 11:10 ` [PATCH v2 37/77] target/arm: GICv5 cpuif: Handle injected PPIs in GICR CDIA Peter Maydell
2026-12-03 11:10 ` [PATCH v2 38/77] target/arm: GICv5 cpuif: Update on HCR_EL2.{NV, NV1} and SCR_EL3.NS changes Peter Maydell
2026-12-03 11:10 ` [PATCH v2 39/77] target/arm: GICv5 cpuif: Update VFIQ/VIRQ when direct-injected PPIs change Peter Maydell
2026-12-03 11:10 ` [PATCH v2 40/77] hw/intc: Move GICv5 register and data definitions into a header Peter Maydell
2026-12-04 7:56 ` Manos Pitsidianakis
2026-12-03 11:10 ` [PATCH v2 41/77] hw/intc/arm_gicv5: Correct offset for IRS_VMT_STATUSR Peter Maydell
2026-12-04 7:53 ` Manos Pitsidianakis
2026-12-03 11:10 ` [PATCH v2 42/77] hw/intc/arm_gicv5: Ask CPUs whether IRS needs virtualization support Peter Maydell
2026-12-04 7:56 ` Manos Pitsidianakis
2026-12-03 11:10 ` [PATCH v2 43/77] hw/intc/arm_gicv5: Indicate virtualization in ID registers Peter Maydell
2026-12-03 11:10 ` [PATCH v2 44/77] hw/intc/arm_gicv5: Implement IRS_VMT_BASER and IRS_VMT_STATUSR Peter Maydell
2026-12-03 11:10 ` [PATCH v2 45/77] hw/intc/arm_gicv5: IMplement IRS_VMT_CFGR Peter Maydell
2026-12-03 11:10 ` [PATCH v2 46/77] hw/intc/arm_gicv5: Implement IRS_VMAP_L2_VMTR Peter Maydell
2026-12-03 11:10 ` [PATCH v2 47/77] hw/intc/arm_gicv5: Implement IRS_VMAP_VMR Peter Maydell
2026-12-03 11:10 ` [PATCH v2 48/77] hw/intc/arm_gicv5: Factor out code to fill in a GICv5ISTConfig Peter Maydell
2026-12-03 11:10 ` [PATCH v2 49/77] hw/intc/arm_gicv5: Cache info about valid VMs in a hashtable Peter Maydell
2026-12-03 11:10 ` [PATCH v2 50/77] hw/intc/arm_gicv5: Populate VM cache when VM table becomes valid Peter Maydell
2026-12-03 11:10 ` [PATCH v2 51/77] hw/intc/arm_gicv5: Implement IRS_VMAP_VISTR Peter Maydell
2026-12-03 11:10 ` [PATCH v2 52/77] hw/intc/arm_gicv5: Factor out "make an L2 IST valid" function Peter Maydell
2026-12-03 11:10 ` [PATCH v2 53/77] hw/intc/arm_gicv5: Implement IRS_VMAP_L2_VISTR Peter Maydell
2026-12-03 11:10 ` [PATCH v2 54/77] hw/intc/arm_gicv5: Cache VPE table information Peter Maydell
2026-12-03 11:10 ` [PATCH v2 55/77] hw/intc/arm_gicv5: Implement IRS_VMAP_VPER Peter Maydell
2026-12-03 11:10 ` [PATCH v2 56/77] hw/intc/arm_gicv5: Implement IRS_VPE_SELR and IRS_VPE_STATUSR Peter Maydell
2026-12-03 11:10 ` [PATCH v2 57/77] hw/intc/arm_gicv5: Implement IRS_VPE_DBR Peter Maydell
2026-12-03 11:10 ` [PATCH v2 58/77] hw/intc/arm_gicv5: Implement IRS_VPE_CR0 Peter Maydell
2026-12-03 11:11 ` [PATCH v2 59/77] hw/intc/arm_gicv5: Implement gicv5_set_resident() Peter Maydell
2026-12-03 11:11 ` [PATCH v2 60/77] hw/intc/arm_gicv5: Take cpuidx for stream commands on virtual interrupts Peter Maydell
2026-12-03 11:11 ` [PATCH v2 61/77] hw/intc/arm_gicv5: Handle virtual=true in gicv5_set_priority() Peter Maydell
2026-12-03 11:11 ` [PATCH v2 62/77] hw/intc/arm_gicv5: Handle virtual=true for setting enabled, pending, handling Peter Maydell
2026-12-03 11:11 ` [PATCH v2 63/77] hw/intc/arm_gicv5: Handle virtual=true for setting pending Peter Maydell
2026-12-03 11:11 ` [PATCH v2 64/77] hw/intc/arm_gicv5: Handle virtual=true in gicv5_set_target() Peter Maydell
2026-12-03 11:11 ` [PATCH v2 65/77] hw/intc/arm_gicv5: Handle virtual=true in gicv5_deactivate() Peter Maydell
2026-12-03 11:11 ` [PATCH v2 66/77] hw/intc/arm_gicv5: Handle activation of a virtual interrupt Peter Maydell
2026-12-03 11:11 ` [PATCH v2 67/77] hw/intc/arm_gicv5: Handle virtual=true in gicv5_request_config() Peter Maydell
2026-12-03 11:11 ` [PATCH v2 68/77] hw/intc/arm_gicv5: Implement irs_recalc_vhppi() Peter Maydell
2026-12-03 11:11 ` [PATCH v2 69/77] hw/intc/arm_gicv5: Recalculate vHPPIs on VIST and VPE mapping Peter Maydell
2026-12-03 11:11 ` [PATCH v2 70/77] hw/intc/arm_gicv5: Add virtual support to gicv5_get_hppi() Peter Maydell
2026-12-03 11:11 ` [PATCH v2 71/77] hw/intc/arm_gicv5: Implement IRS_VPE_HPPIR Peter Maydell
2026-12-03 11:11 ` [PATCH v2 72/77] hw/intc/arm_gicv5: Implement ringing doorbells for VPEs Peter Maydell
2026-12-03 11:11 ` [PATCH v2 73/77] hw/intc/arm_gicv5: Handle vHPPIs when IRS_CR0.IRSEN is toggled Peter Maydell
2026-12-03 11:11 ` [PATCH v2 74/77] hw/intc/arm_gicv5: Implement saving virtual interrupt state to guest memory Peter Maydell
2026-12-03 11:11 ` [PATCH v2 75/77] hw/intc/arm_gicv5: Implement reporting of Quiesced state Peter Maydell
2026-12-03 11:11 ` [PATCH v2 76/77] hw/intc/arm_gicv5: Implement no-passthrough IRS_SPI_VMR Peter Maydell
2026-12-03 11:11 ` [PATCH v2 77/77] hw/arm/virt: allow virtualization=on with gicv5 Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tpgwka.2swptygvspll6@linaro.org \
--to=manos.pitsidianakis@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=philmd@oss.qualcomm.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.