render / rpms / qemu

Forked from rpms/qemu 9 months ago
Clone

Blame 2df5c1f5b014126595a26c6797089d284a3b211c.patch

5dc33a
From 2df5c1f5b014126595a26c6797089d284a3b211c Mon Sep 17 00:00:00 2001
5dc33a
From: Harsh Prateek Bora <harshpb@linux.ibm.com>
5dc33a
Date: Wed, 24 Jan 2024 10:30:55 +1000
5dc33a
Subject: [PATCH] ppc/spapr: Introduce SPAPR_IRQ_NR_IPIS to refer IRQ range for
5dc33a
 CPU IPIs.
5dc33a
MIME-Version: 1.0
5dc33a
Content-Type: text/plain; charset=UTF-8
5dc33a
Content-Transfer-Encoding: 8bit
5dc33a
5dc33a
spapr_irq_init currently uses existing macro SPAPR_XIRQ_BASE to refer to
5dc33a
the range of CPU IPIs during initialization of nr-irqs property.
5dc33a
It is more appropriate to have its own define which can be further
5dc33a
reused as appropriate for correct interpretation.
5dc33a
5dc33a
Suggested-by: Cedric Le Goater <clg@kaod.org>
5dc33a
Reviewed-by: Cédric Le Goater <clg@kaod.org>
5dc33a
Tested-by: Kowshik Jois <kowsjois@linux.ibm.com>
5dc33a
Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
5dc33a
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
5dc33a
---
5dc33a
 hw/ppc/spapr_irq.c         |  6 ++++--
5dc33a
 include/hw/ppc/spapr_irq.h | 14 +++++++++++++-
5dc33a
 2 files changed, 17 insertions(+), 3 deletions(-)
5dc33a
5dc33a
diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c
5dc33a
index a0d1e1298e1e..97b2fc42ab03 100644
5dc33a
--- a/hw/ppc/spapr_irq.c
5dc33a
+++ b/hw/ppc/spapr_irq.c
5dc33a
@@ -23,6 +23,8 @@
5dc33a
 
5dc33a
 #include "trace.h"
5dc33a
 
5dc33a
+QEMU_BUILD_BUG_ON(SPAPR_IRQ_NR_IPIS > SPAPR_XIRQ_BASE);
5dc33a
+
5dc33a
 static const TypeInfo spapr_intc_info = {
5dc33a
     .name = TYPE_SPAPR_INTC,
5dc33a
     .parent = TYPE_INTERFACE,
5dc33a
@@ -329,7 +331,7 @@ void spapr_irq_init(SpaprMachineState *spapr, Error **errp)
5dc33a
         int i;
5dc33a
 
5dc33a
         dev = qdev_new(TYPE_SPAPR_XIVE);
5dc33a
-        qdev_prop_set_uint32(dev, "nr-irqs", smc->nr_xirqs + SPAPR_XIRQ_BASE);
5dc33a
+        qdev_prop_set_uint32(dev, "nr-irqs", smc->nr_xirqs + SPAPR_IRQ_NR_IPIS);
5dc33a
         /*
5dc33a
          * 8 XIVE END structures per CPU. One for each available
5dc33a
          * priority
5dc33a
@@ -356,7 +358,7 @@ void spapr_irq_init(SpaprMachineState *spapr, Error **errp)
5dc33a
     }
5dc33a
 
5dc33a
     spapr->qirqs = qemu_allocate_irqs(spapr_set_irq, spapr,
5dc33a
-                                      smc->nr_xirqs + SPAPR_XIRQ_BASE);
5dc33a
+                                      smc->nr_xirqs + SPAPR_IRQ_NR_IPIS);
5dc33a
 
5dc33a
     /*
5dc33a
      * Mostly we don't actually need this until reset, except that not
5dc33a
diff --git a/include/hw/ppc/spapr_irq.h b/include/hw/ppc/spapr_irq.h
5dc33a
index c22a72c9e270..4fd2d5853d8b 100644
5dc33a
--- a/include/hw/ppc/spapr_irq.h
5dc33a
+++ b/include/hw/ppc/spapr_irq.h
5dc33a
@@ -14,9 +14,21 @@
5dc33a
 #include "qom/object.h"
5dc33a
 
5dc33a
 /*
5dc33a
- * IRQ range offsets per device type
5dc33a
+ * The XIVE IRQ backend uses the same layout as the XICS backend but
5dc33a
+ * covers the full range of the IRQ number space. The IRQ numbers for
5dc33a
+ * the CPU IPIs are allocated at the bottom of this space, below 4K,
5dc33a
+ * to preserve compatibility with XICS which does not use that range.
5dc33a
+ */
5dc33a
+
5dc33a
+/*
5dc33a
+ * CPU IPI range (XIVE only)
5dc33a
  */
5dc33a
 #define SPAPR_IRQ_IPI        0x0
5dc33a
+#define SPAPR_IRQ_NR_IPIS    0x1000
5dc33a
+
5dc33a
+/*
5dc33a
+ * IRQ range offsets per device type
5dc33a
+ */
5dc33a
 
5dc33a
 #define SPAPR_XIRQ_BASE      XICS_IRQ_BASE /* 0x1000 */
5dc33a
 #define SPAPR_IRQ_EPOW       (SPAPR_XIRQ_BASE + 0x0000)