public inbox for qemu-devel@nongnu.org
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-arm@nongnu.org, qemu-devel@nongnu.org
Subject: [PATCH 13/65] target/arm: GICv5 cpuif: Initial skeleton and GSB barrier insns
Date: Mon, 23 Feb 2026 17:01:20 +0000	[thread overview]
Message-ID: <20260223170212.441276-14-peter.maydell@linaro.org> (raw)
In-Reply-To: <20260223170212.441276-1-peter.maydell@linaro.org>

In the GICv5 architecture, part of the GIC is implemented inside the
CPU: this is the CPU interface, which presents software with system
instructions and system registers, and communicates with the external
part of the GIC (the Interrupt Routing Service, IRS) via an
architected stream interface where both sides can send commands and
receive responses.

Add the initial source files for the GICv5 CPU interface, with
initial content implementing just the two GSB GIC barrier
instructions, which are no-ops for QEMU.

Since we will not initially implement virtualization or the "legacy
GICv3" interface that can be provided to a VM guest, we don't have
the ICH_VCTLR_EL2 register and do not need to implement an accessfn
for the "trap if at EL1 and EL2 enabled and legacy GICv3 is enabled"
handling.  We will come back and add this later as part of the
legacy-GICv3 code.

(The GICv3 has a similar architecture with part of the GIC being in
the CPU and part external; for QEMU we implemented the CPU interface
in hw/intc/, but in retrospect I think this was something of a design
mistake, and for GICv5 I am going to stick a bit closer to how the
hardware architecture splits things up; hence this code is in
target/arm.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/cpu-features.h    |  6 +++++
 target/arm/helper.c          |  1 +
 target/arm/internals.h       |  3 +++
 target/arm/tcg/gicv5-cpuif.c | 43 ++++++++++++++++++++++++++++++++++++
 target/arm/tcg/meson.build   |  1 +
 5 files changed, 54 insertions(+)
 create mode 100644 target/arm/tcg/gicv5-cpuif.c

diff --git a/target/arm/cpu-features.h b/target/arm/cpu-features.h
index b683c9551a..e391b394ba 100644
--- a/target/arm/cpu-features.h
+++ b/target/arm/cpu-features.h
@@ -280,6 +280,7 @@ FIELD(ID_AA64PFR1, PFAR, 60, 4)
 FIELD(ID_AA64PFR2, MTEPERM, 0, 4)
 FIELD(ID_AA64PFR2, MTESTOREONLY, 4, 4)
 FIELD(ID_AA64PFR2, MTEFAR, 8, 4)
+FIELD(ID_AA64PFR2, GCIE, 12, 4)
 FIELD(ID_AA64PFR2, FPMR, 32, 4)
 
 FIELD(ID_AA64MMFR0, PARANGE, 0, 4)
@@ -1159,6 +1160,11 @@ static inline bool isar_feature_aa64_gcs(const ARMISARegisters *id)
     return FIELD_EX64_IDREG(id, ID_AA64PFR1, GCS) != 0;
 }
 
+static inline bool isar_feature_aa64_gcie(const ARMISARegisters *id)
+{
+    return FIELD_EX64_IDREG(id, ID_AA64PFR2, GCIE) != 0;
+}
+
 static inline bool isar_feature_aa64_tgran4_lpa2(const ARMISARegisters *id)
 {
     return FIELD_SEX64_IDREG(id, ID_AA64MMFR0, TGRAN4) >= 1;
diff --git a/target/arm/helper.c b/target/arm/helper.c
index 6bfab90981..5e7cc039aa 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -6315,6 +6315,7 @@ void register_cp_regs_for_features(ARMCPU *cpu)
     if (tcg_enabled()) {
         define_tlb_insn_regs(cpu);
         define_at_insn_regs(cpu);
+        define_gicv5_cpuif_regs(cpu);
     }
 #endif
 
diff --git a/target/arm/internals.h b/target/arm/internals.h
index 8ec2750847..9bde58cf00 100644
--- a/target/arm/internals.h
+++ b/target/arm/internals.h
@@ -1797,6 +1797,9 @@ void define_pm_cpregs(ARMCPU *cpu);
 /* Add the cpreg definitions for GCS cpregs */
 void define_gcs_cpregs(ARMCPU *cpu);
 
+/* Add the cpreg definitions for the GICv5 CPU interface */
+void define_gicv5_cpuif_regs(ARMCPU *cpu);
+
 /* Effective value of MDCR_EL2 */
 static inline uint64_t arm_mdcr_el2_eff(CPUARMState *env)
 {
diff --git a/target/arm/tcg/gicv5-cpuif.c b/target/arm/tcg/gicv5-cpuif.c
new file mode 100644
index 0000000000..76c2577c09
--- /dev/null
+++ b/target/arm/tcg/gicv5-cpuif.c
@@ -0,0 +1,43 @@
+/*
+ * GICv5 CPU interface
+ *
+ * Copyright (c) 2025 Linaro Limited
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "cpu.h"
+#include "internals.h"
+#include "cpregs.h"
+
+static const ARMCPRegInfo gicv5_cpuif_reginfo[] = {
+    /*
+     * Barrier: wait until the effects of a cpuif system register
+     * write have definitely made it to the IRS (and will thus show up
+     * in cpuif reads from the IRS by this or other CPUs and in the
+     * status of IRQ, FIQ etc). For QEMU we do all interaction with
+     * the IRS synchronously, so we can make this a nop.
+     */
+    {   .name = "GSB_SYS", .state = ARM_CP_STATE_AA64,
+        .opc0 = 1, .opc1 = 0, .crn = 12, .crm = 0, .opc2 = 0,
+        .access = PL1_W, .type = ARM_CP_NOP,
+    },
+    /*
+     * Barrier: wait until the effects of acknowledging an interrupt
+     * (via GICR CDIA or GICR CDNMIA) are visible, including the
+     * effect on the {IRQ,FIQ,vIRQ,vFIQ} pending state. This is
+     * a weaker version of GSB SYS. Again, for QEMU this is a nop.
+     */
+    {   .name = "GSB_ACK", .state = ARM_CP_STATE_AA64,
+        .opc0 = 1, .opc1 = 0, .crn = 12, .crm = 0, .opc2 = 1,
+        .access = PL1_W, .type = ARM_CP_NOP,
+    },
+};
+
+void define_gicv5_cpuif_regs(ARMCPU *cpu)
+{
+    if (cpu_isar_feature(aa64_gcie, cpu)) {
+        define_arm_cp_regs(cpu, gicv5_cpuif_reginfo);
+    }
+}
diff --git a/target/arm/tcg/meson.build b/target/arm/tcg/meson.build
index 5f59156055..a67911f8dc 100644
--- a/target/arm/tcg/meson.build
+++ b/target/arm/tcg/meson.build
@@ -62,6 +62,7 @@ arm_common_ss.add(files(
 arm_common_system_ss.add(files(
   'cpregs-at.c',
   'debug.c',
+  'gicv5-cpuif.c',
   'hflags.c',
   'neon_helper.c',
   'psci.c',
-- 
2.43.0



  parent reply	other threads:[~2026-02-23 17:06 UTC|newest]

Thread overview: 142+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-23 17:01 [PATCH 00/65] arm: Implement an emulation of GICv5 interrupt controller Peter Maydell
2026-02-23 17:01 ` [PATCH 01/65] hw/core: Permit devices to define an array of link properties Peter Maydell
2026-03-06 11:11   ` Jonathan Cameron via qemu development
2026-03-06 11:17     ` Peter Maydell
2026-03-21 15:42   ` Philippe Mathieu-Daudé
2026-03-23 13:26     ` Peter Maydell
2026-02-23 17:01 ` [PATCH 02/65] hw/intc: Skeleton of GICv5 IRS classes Peter Maydell
2026-03-06 11:15   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 03/65] hw/arm/Kconfig: select ARM_GICV5 for ARM_VIRT board Peter Maydell
2026-03-06 11:16   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 04/65] hw/intc/arm_gicv5: Implement skeleton code for IRS register frames Peter Maydell
2026-03-06 11:51   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 05/65] hw/intc/arm_gicv5: Add migration blocker Peter Maydell
2026-03-06 11:52   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 06/65] hw/intc/arm_gicv5: Create and validate QOM properties Peter Maydell
2026-03-06 12:07   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 07/65] hw/intc/arm_gicv5: Create inbound GPIO lines for SPIs Peter Maydell
2026-03-06 14:57   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 08/65] hw/intc/arm_gicv5: Define macros for config frame registers Peter Maydell
2026-03-06 15:53   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 09/65] hw/intc/arm_gicv5: Implement IRS ID regs Peter Maydell
2026-03-06 16:16   ` Jonathan Cameron via qemu development
2026-03-19 13:22     ` Peter Maydell
2026-02-23 17:01 ` [PATCH 10/65] hw/intc/arm_gicv5: Add link property for MemoryRegion for DMA Peter Maydell
2026-03-06 16:17   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 11/65] hw/intc/arm_gicv5: Implement gicv5_class_name() Peter Maydell
2026-03-06 17:00   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 12/65] hw/intc/arm_gicv5: Add defines for GICv5 architected PPIs Peter Maydell
2026-03-06 17:09   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` Peter Maydell [this message]
2026-03-06 17:23   ` [PATCH 13/65] target/arm: GICv5 cpuif: Initial skeleton and GSB barrier insns Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 14/65] target/arm: Set up pointer to GICv5 in each CPU Peter Maydell
2026-03-06 17:29   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 15/65] hw/intc/arm_gicv5: Implement IRS_IST_{BASER, STATUSR, CFGR} Peter Maydell
2026-03-06 17:39   ` Jonathan Cameron via qemu development
2026-03-06 18:27     ` Peter Maydell
2026-02-23 17:01 ` [PATCH 16/65] hw/intc/arm_gicv5: Cache LPI IST config in a struct Peter Maydell
2026-03-06 17:46   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 17/65] hw/intc/arm_gicv5: Implement gicv5_set_priority() Peter Maydell
2026-03-06 18:02   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 18/65] target/arm: GICv5 cpuif: Implement the GIC CDPRI instruction Peter Maydell
2026-03-06 18:05   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 19/65] hw/intc/arm_gicv5: Implement IRS_MAP_L2_ISTR Peter Maydell
2026-03-06 18:10   ` Jonathan Cameron via qemu development
2026-03-06 18:21     ` Peter Maydell
2026-02-23 17:01 ` [PATCH 20/65] hw/intc/arm_gicv5: Implement remaining set-config functions Peter Maydell
2026-03-11 14:15   ` Jonathan Cameron via qemu development
2026-03-19  9:59     ` Peter Maydell
2026-02-23 17:01 ` [PATCH 21/65] target/arm: GICv5 cpuif: Implement GIC CD* insns for setting config Peter Maydell
2026-03-11 14:24   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 22/65] hw/intc/arm_gicv5: Create backing state for SPIs Peter Maydell
2026-03-11 14:30   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 23/65] hw/intc/arm_gicv5: Make gicv5_set_* update SPI state Peter Maydell
2026-03-11 14:35   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 24/65] hw/intc/arm_gicv5: Implement gicv5_request_config() Peter Maydell
2026-03-11 14:44   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 25/65] target/arm: GICv5 cpuif: Implement GIC CDRCFG and ICC_ICSR_EL1 Peter Maydell
2026-03-11 14:51   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 26/65] hw/intc/arm_gicv5: Implement IRS_SPI_{SELR, STATUSR, CFGR, DOMAINR} Peter Maydell
2026-03-11 15:01   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 27/65] hw/intc/arm_gicv5: Update SPI state for CLEAR/SET events Peter Maydell
2026-03-11 15:23   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 28/65] hw/intc/arm_gicv5: Implement IRS_CR0 and IRS_CR1 Peter Maydell
2026-03-11 15:28   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 29/65] hw/intc/arm_gicv5: Implement IRS_SYNCR and IRS_SYNC_STATUSR Peter Maydell
2026-03-11 15:29   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 30/65] hw/intc/arm_gicv5: Implement IRS_PE_{CR0,SELR,STATUSR} Peter Maydell
2026-03-11 15:31   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 31/65] hw/intc/arm_gicv5: Implement CoreSight ID registers Peter Maydell
2026-02-23 17:01 ` [PATCH 32/65] hw/intc/arm_gicv5: Cache pending LPIs in a hash table Peter Maydell
2026-03-11 15:46   ` Jonathan Cameron via qemu development
2026-03-19 10:11     ` Peter Maydell
2026-02-23 17:01 ` [PATCH 33/65] target/arm: GICv5 cpuif: Implement ICC_IAFFIDR_EL1 Peter Maydell
2026-03-11 15:48   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 34/65] target/arm: GICv5 cpuif: Implement ICC_IDR0_EL1 Peter Maydell
2026-03-11 15:50   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 35/65] target/arm: GICv5 cpuif: Implement GICv5 PPI active set/clear registers Peter Maydell
2026-03-11 16:26   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 36/65] target/arm: GICv5 cpuif: Implement PPI handling mode register Peter Maydell
2026-03-11 16:29   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 37/65] target/arm: GICv5 cpuif: Implement PPI pending status registers Peter Maydell
2026-03-11 16:31   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 38/65] target/arm: GICv5 cpuif: Implement PPI enable register Peter Maydell
2026-03-11 16:32   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 39/65] target/arm: GICv5 cpuif: Implement PPI priority registers Peter Maydell
2026-03-11 16:34   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 40/65] target/arm: GICv5 cpuif: Implement ICC_APR_EL1 and ICC_HAPR_EL1 Peter Maydell
2026-03-11 16:41   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 41/65] target/arm: GICv5 cpuif: Calculate the highest priority PPI Peter Maydell
2026-03-11 16:51   ` Jonathan Cameron via qemu development
2026-03-11 17:08     ` Peter Maydell
2026-03-11 17:39       ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 42/65] hw/intc/arm_gicv5: Calculate HPPI in the IRS Peter Maydell
2026-03-11 16:59   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 43/65] target/arm: GICv5 cpuif: Implement ICC_CR0_EL1 Peter Maydell
2026-03-11 17:01   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 44/65] target/arm: GICv5 cpuif: Implement ICC_PCR_EL1 Peter Maydell
2026-03-11 17:04   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 45/65] target/arm: GICv5 cpuif: Implement ICC_HPPIR_EL1 Peter Maydell
2026-03-11 17:14   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 46/65] hw/intc/arm_gicv5: Implement Activate command Peter Maydell
2026-03-11 17:22   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 47/65] target/arm: GICv5 cpuif: Implement GICR CDIA command Peter Maydell
2026-03-11 17:28   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 48/65] target/arm: GICv5 cpuif: Implement GIC CDEOI Peter Maydell
2026-03-11 17:32   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 49/65] hw/intc/arm_gicv5: Implement Deactivate command Peter Maydell
2026-03-11 17:34   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 50/65] target/arm: GICv5 cpuif: Implement GIC CDDI Peter Maydell
2026-03-11 17:35   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 51/65] target/arm: GICv5 cpuif: Signal IRQ or FIQ Peter Maydell
2026-03-11 17:43   ` Jonathan Cameron via qemu development
2026-02-23 17:01 ` [PATCH 52/65] target/arm: Connect internal interrupt sources up as GICv5 PPIs Peter Maydell
2026-03-11 17:48   ` Jonathan Cameron via qemu development
2026-02-23 17:02 ` [PATCH 53/65] target/arm: Add has_gcie property to enable FEAT_GCIE Peter Maydell
2026-03-11 17:51   ` Jonathan Cameron via qemu development
2026-02-23 17:02 ` [PATCH 54/65] hw/intc/arm_gicv3_cpuif: Don't allow GICv3 if CPU has GICv5 cpuif Peter Maydell
2026-03-11 17:52   ` Jonathan Cameron via qemu development
2026-02-23 17:02 ` [PATCH 55/65] hw/arm/virt: Update error message for bad gic-version option Peter Maydell
2026-03-11 17:54   ` Jonathan Cameron via qemu development
2026-03-12  9:12     ` Peter Maydell
2026-02-23 17:02 ` [PATCH 56/65] hw/arm/virt: Remember CPU phandles rather than looking them up by name Peter Maydell
2026-03-11 17:56   ` Jonathan Cameron via qemu development
2026-02-23 17:02 ` [PATCH 57/65] hw/arm/virt: Move MSI controller creation out of create_gic() Peter Maydell
2026-03-11 17:57   ` Jonathan Cameron via qemu development
2026-02-23 17:02 ` [PATCH 58/65] hw/arm/virt: Pull "wire CPU interrupts" " Peter Maydell
2026-03-11 18:01   ` Jonathan Cameron via qemu development
2026-02-23 17:02 ` [PATCH 59/65] hw/arm/virt: Split GICv2 and GICv3/4 creation Peter Maydell
2026-03-12 13:59   ` Jonathan Cameron via qemu development
2026-02-23 17:02 ` [PATCH 60/65] hw/arm/virt: Create and connect GICv5 Peter Maydell
2026-03-12 14:06   ` Jonathan Cameron via qemu development
2026-02-23 17:02 ` [PATCH 61/65] hw/arm/virt: Advertise GICv5 in the DTB Peter Maydell
2026-03-12 14:23   ` Jonathan Cameron via qemu development
2026-02-23 17:02 ` [PATCH 62/65] hw/arm/virt: Handle GICv5 in interrupt bindings for PPIs Peter Maydell
2026-03-12 14:28   ` Jonathan Cameron via qemu development
2026-02-23 17:02 ` [PATCH 63/65] hw/arm/virt: Use correct interrupt type for GICv5 SPIs in the DTB Peter Maydell
2026-03-12 14:29   ` Jonathan Cameron via qemu development
2026-02-23 17:02 ` [PATCH 64/65] hw/arm/virt: Enable GICv5 CPU interface when using GICv5 Peter Maydell
2026-03-12 14:32   ` Jonathan Cameron via qemu development
2026-02-23 17:02 ` [PATCH 65/65] hw/arm/virt: Allow user to select GICv5 Peter Maydell
2026-03-12 14:36   ` Jonathan Cameron via qemu development
2026-02-23 17:24 ` [PATCH 00/65] arm: Implement an emulation of GICv5 interrupt controller 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=20260223170212.441276-14-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox