qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 3/3] spapr_pci: fix "ibm,pe-total-#msi" value


From: Cédric Le Goater
Subject: [Qemu-devel] [PATCH 3/3] spapr_pci: fix "ibm,pe-total-#msi" value
Date: Mon, 10 Sep 2018 13:02:22 +0200

The "ibm,pe-total-#msi" property of the sPAPR PHB defines the number
of allocatable MSI interrupts. This is currently set to XICS_IRQS_SPAPR
which covers the full IRQ number space of the machine. This is wrong.

Fix the definition by using the 'nr_msis' attribute of the sPAPRIrq
class and remove XICS_IRQS_SPAPR which is now unused.

Signed-off-by: Cédric Le Goater <address@hidden>
---
 include/hw/ppc/xics.h | 2 --
 hw/ppc/spapr_irq.c    | 2 +-
 hw/ppc/spapr_pci.c    | 5 +++--
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h
index 9c2916c9b23a..9958443d1984 100644
--- a/include/hw/ppc/xics.h
+++ b/include/hw/ppc/xics.h
@@ -181,8 +181,6 @@ typedef struct XICSFabricClass {
     ICPState *(*icp_get)(XICSFabric *xi, int server);
 } XICSFabricClass;
 
-#define XICS_IRQS_SPAPR               1024
-
 void spapr_dt_xics(int nr_servers, void *fdt, uint32_t phandle);
 
 ICPState *xics_icp_get(XICSFabric *xi, int server);
diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c
index b14d7bce00ea..e77b94cc685e 100644
--- a/hw/ppc/spapr_irq.c
+++ b/hw/ppc/spapr_irq.c
@@ -290,7 +290,7 @@ int spapr_irq_find(sPAPRMachineState *spapr, int num, bool 
align, Error **errp)
     return first + ics->offset;
 }
 
-#define SPAPR_IRQ_XICS_LEGACY_NR_IRQS     XICS_IRQS_SPAPR
+#define SPAPR_IRQ_XICS_LEGACY_NR_IRQS     0x400
 
 sPAPRIrq spapr_irq_xics_legacy = {
     .nr_irqs     = SPAPR_IRQ_XICS_LEGACY_NR_IRQS,
diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index 6bcb4f419b6b..bb736177e76c 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -2121,6 +2121,7 @@ int spapr_populate_pci_dt(sPAPRPHBState *phb,
     sPAPRTCETable *tcet;
     PCIBus *bus = PCI_HOST_BRIDGE(phb)->bus;
     sPAPRFDT s_fdt;
+    sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(qdev_get_machine());
 
     /* Start populating the FDT */
     nodename = g_strdup_printf("address@hidden" PRIx64, phb->buid);
@@ -2138,8 +2139,8 @@ int spapr_populate_pci_dt(sPAPRPHBState *phb,
     _FDT(fdt_setprop(fdt, bus_off, "ranges", &ranges, sizeof_ranges));
     _FDT(fdt_setprop(fdt, bus_off, "reg", &bus_reg, sizeof(bus_reg)));
     _FDT(fdt_setprop_cell(fdt, bus_off, "ibm,pci-config-space-type", 0x1));
-    /* TODO: fine tune the total count of allocatable MSIs per PHB */
-    _FDT(fdt_setprop_cell(fdt, bus_off, "ibm,pe-total-#msi", XICS_IRQS_SPAPR));
+    _FDT(fdt_setprop_cell(fdt, bus_off, "ibm,pe-total-#msi",
+                          smc->irq->nr_msis));
 
     /* Dynamic DMA window */
     if (phb->ddw_enabled) {
-- 
2.17.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]