]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
hw/intc/arm_gic: introduce a first-cpu-index property
authorFrederic Konrad <konrad.frederic@yahoo.fr>
Mon, 26 May 2025 08:55:21 +0000 (10:55 +0200)
committerPeter Maydell <peter.maydell@linaro.org>
Mon, 16 Jun 2025 10:26:25 +0000 (11:26 +0100)
This introduces a first-cpu-index property to the arm-gic, as some SOCs
could have two separate GIC (ie: the zynqmp).

Signed-off-by: Clément Chigot <chigot@adacore.com>
Message-id: 20250526085523.809003-3-chigot@adacore.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
[PMM: slightly expanded comment documenting GIC property]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/intc/arm_gic.c
hw/intc/arm_gic_common.c
include/hw/intc/arm_gic.h
include/hw/intc/arm_gic_common.h

index d18bef40fcc7700bfe5fcc07c680abde535cefbc..899f1333633c674690a46b87c0d6f9823bbc66ce 100644 (file)
@@ -59,7 +59,7 @@ static const uint8_t gic_id_gicv2[] = {
 static inline int gic_get_current_cpu(GICState *s)
 {
     if (!qtest_enabled() && s->num_cpu > 1) {
-        return current_cpu->cpu_index;
+        return current_cpu->cpu_index - s->first_cpu_index;
     }
     return 0;
 }
index 0f0c48d89ab564fb00361cf0f59c8871534ba402..ed5be0564528ea7e03f22ee3c2422e4eeca91518 100644 (file)
@@ -350,6 +350,7 @@ static void arm_gic_common_linux_init(ARMLinuxBootIf *obj,
 
 static const Property arm_gic_common_properties[] = {
     DEFINE_PROP_UINT32("num-cpu", GICState, num_cpu, 1),
+    DEFINE_PROP_UINT32("first-cpu-index", GICState, first_cpu_index, 0),
     DEFINE_PROP_UINT32("num-irq", GICState, num_irq, 32),
     /* Revision can be 1 or 2 for GIC architecture specification
      * versions 1 or 2, or 0 to indicate the legacy 11MPCore GIC.
index 48f6a51a70a97a5174d763959d1badbb330e25e8..be923f7ed8861620d17fbf3d8569c42ae7c95487 100644 (file)
@@ -27,6 +27,9 @@
  *    implement the security extensions
  *  + QOM property "has-virtualization-extensions": set true if the GIC should
  *    implement the virtualization extensions
+ *  + QOM property "first-cpu-index": index of the first cpu attached to the
+ *    GIC (default 0). The CPUs connected to the GIC are assumed to be
+ *    first-cpu-index, first-cpu-index + 1, ... first-cpu-index + num-cpu - 1.
  *  + unnamed GPIO inputs: (where P is number of SPIs, i.e. num-irq - 32)
  *    [0..P-1]  SPIs
  *    [P..P+31] PPIs for CPU 0
index 97fea4102d37d5d0593184de279264aa02e66ad4..93a3cc2bf812880b4200bd0d3df4e2247ffb81f9 100644 (file)
@@ -129,6 +129,8 @@ struct GICState {
     uint32_t num_lrs;
 
     uint32_t num_cpu;
+    /* cpu_index of the first CPU, attached to this GIC.  */
+    uint32_t first_cpu_index;
 
     MemoryRegion iomem; /* Distributor */
     /* This is just so we can have an opaque pointer which identifies