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 42/77] hw/intc/arm_gicv5: Ask CPUs whether IRS needs virtualization support
Date: Fri, 04 Dec 2026 09:56:36 +0200 [thread overview]
Message-ID: <tpigwn.3o0u95fkwzzfj@linaro.org> (raw)
In-Reply-To: <20261203111118.1380524-43-peter.maydell@linaro.org>
On Thu, 03 Dec 2026 13:10, Peter Maydell <peter.maydell@linaro.org> wrote:
>The GICv5 IRS must support virtualization if any CPU in the system
>has EL2 (by spec rule R_KDSPG). Add a has_virt field to the
>GICv5Common struct to track this, and automatically set it if any
>connected CPU has EL2.
>
>We get the CPU to tell us whether it needs virtualization in the
>return value of gicv5_set_gicv5state(); this allows us to maintain
>the arm's-length relationship between the IRS and the CPU (and in
>particular we don't need to include cpu.h in arm_gicv5_common.c, as
>we would if we directly called arm_feature() there).
>
>We could alternatively have provided a has-virtualization QOM
>property, but then the board code would need to take care to
>explicitly configure the IRS to match the CPUs.
Yes, the approach in this patch sounds better than the QOM prop
alternative.
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
>
>(The GICv3 doesn't have an equivalent to this, because in the GICv3
>design virtualization is handled entirely by the CPU interface and
>software; in GICv5 the IRS has hardware support, to reduce the work
>software needs to do.)
>
>None of the code we are about to add in future commits that tests the
>has_virt flag will be accessible until we remove the check in virt.c
>that prevents creation of a machine with the GICv5 and an EL2 CPU, so
>no behaviour will change until we have completed the entire
>virtualization support feature and allow the user to select it.
>
>Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>---
> include/hw/intc/arm_gicv5_common.h | 2 ++
> include/hw/intc/arm_gicv5_stream.h | 15 +++++++++++----
> hw/intc/arm_gicv5_common.c | 9 ++++++++-
> target/arm/cpu.c | 17 +++++++++++------
> 4 files changed, 32 insertions(+), 11 deletions(-)
>
>diff --git a/include/hw/intc/arm_gicv5_common.h b/include/hw/intc/arm_gicv5_common.h
>index a47f639e84c..d8f6f5d5db9 100644
>--- a/include/hw/intc/arm_gicv5_common.h
>+++ b/include/hw/intc/arm_gicv5_common.h
>@@ -127,6 +127,8 @@ struct GICv5Common {
> uint32_t spi_base;
> uint32_t spi_irs_range;
> uint32_t spi_range;
>+
>+ bool has_virt;
> };
>
> struct GICv5CommonClass {
>diff --git a/include/hw/intc/arm_gicv5_stream.h b/include/hw/intc/arm_gicv5_stream.h
>index f6d32c6beca..ea27d6aec0f 100644
>--- a/include/hw/intc/arm_gicv5_stream.h
>+++ b/include/hw/intc/arm_gicv5_stream.h
>@@ -16,6 +16,12 @@
>
> typedef struct GICv5Common GICv5Common;
>
>+typedef enum GICv5CPUIFStatus {
>+ GICV5_CPUIF_MISSING, /* CPU does not have GICv5 cpuif support */
>+ GICV5_CPUIF_PRESENT, /* CPU has GICv5 cpuif */
>+ GICV5_CPUIF_NEEDS_VIRT, /* CPU has GICv5, and needs virt support in IRS */
>+} GICv5CPUIFStatus;
>+
> /**
> * gicv5_set_gicv5state
> * @cpu: CPU object to tell about its IRS
>@@ -27,11 +33,12 @@ typedef struct GICv5Common GICv5Common;
> * IRS must call this when it is realized, for each CPU it is
> * connected to.
> *
>- * Returns true on success, false if the CPU doesn't implement the
>- * GICv5 CPU interface.
>+ * The return value indicates whether the CPU has a GICv5 CPU
>+ * interface, and if it does whether it needs virtualization support
>+ * from the IRS.
> */
>-bool gicv5_set_gicv5state(ARMCPU *cpu, GICv5Common *cs, uint32_t iaffid,
>- uint32_t cpuidx);
>+GICv5CPUIFStatus gicv5_set_gicv5state(ARMCPU *cpu, GICv5Common *cs,
>+ uint32_t iaffid, uint32_t cpuidx);
>
> /*
> * The architected Stream Protocol is asynchronous; commands can be
>diff --git a/hw/intc/arm_gicv5_common.c b/hw/intc/arm_gicv5_common.c
>index cfadfee4f05..17fd67b5ccd 100644
>--- a/hw/intc/arm_gicv5_common.c
>+++ b/hw/intc/arm_gicv5_common.c
>@@ -176,11 +176,18 @@ static void gicv5_common_realize(DeviceState *dev, Error **errp)
> }
>
> for (int i = 0; i < cs->num_cpus; i++) {
>- if (!gicv5_set_gicv5state(cs->cpus[i], cs, cs->cpu_iaffids[i], i)) {
>+ switch (gicv5_set_gicv5state(cs->cpus[i], cs, cs->cpu_iaffids[i], i)) {
>+ case GICV5_CPUIF_MISSING:
> error_setg(errp,
> "CPU %d (IAFFID 0x%x) does not implement GICv5 CPU interface",
> i, cs->cpu_iaffids[i]);
> return;
>+ case GICV5_CPUIF_PRESENT:
>+ break;
>+ case GICV5_CPUIF_NEEDS_VIRT:
>+ /* R_KDSPG: IRS must implement virtualization if any CPU has EL2 */
>+ cs->has_virt = true;
>+ break;
> }
> }
>
>diff --git a/target/arm/cpu.c b/target/arm/cpu.c
>index dde03ffdd6f..aba81bfcdb0 100644
>--- a/target/arm/cpu.c
>+++ b/target/arm/cpu.c
>@@ -1215,20 +1215,25 @@ static void arm_cpu_dump_state(CPUState *cs, FILE *f, int flags)
> }
>
> #ifndef CONFIG_USER_ONLY
>-bool gicv5_set_gicv5state(ARMCPU *cpu, GICv5Common *cs, uint32_t iaffid,
>- uint32_t cpuidx)
>+GICv5CPUIFStatus gicv5_set_gicv5state(ARMCPU *cpu, GICv5Common *cs,
>+ uint32_t iaffid, uint32_t cpuidx)
> {
> /*
>- * Set this CPU's gicv5state pointer to point to the GIC that we are
>- * connected to, and record our IAFFID and CPU index.
>+ * Set this CPU's gicv5state pointer to point to the GIC that we
>+ * are connected to, record our IAFFID and cpuidx, and let the IRS
>+ * know if it needs to implement virtualization support.
> */
> if (!cpu_isar_feature(aa64_gcie, cpu)) {
>- return false;
>+ return GICV5_CPUIF_MISSING;
> }
> cpu->env.gicv5.gicv5state = cs;
> cpu->env.gicv5.iaffid = iaffid;
> cpu->env.gicv5.cpuidx = cpuidx;
>- return true;
>+ if (arm_feature(&cpu->env, ARM_FEATURE_EL2)) {
>+ return GICV5_CPUIF_NEEDS_VIRT;
>+ } else {
>+ return GICV5_CPUIF_PRESENT;
>+ }
> }
> #endif
>
>--
>2.43.0
>
next prev parent reply other threads:[~2026-12-04 8:01 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
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 [this message]
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=tpigwn.3o0u95fkwzzfj@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.