spapr_pci: add an extra 'nr_msis' argument to spapr_populate_pci_dt
authorCédric Le Goater <clg@kaod.org>
Thu, 13 Sep 2018 05:16:05 +0000 (07:16 +0200)
committerDavid Gibson <david@gibson.dropbear.id.au>
Tue, 25 Sep 2018 01:12:25 +0000 (11:12 +1000)
So that we don't have to call qdev_get_machine() to get the machine
class and the sPAPRIrq backend holding the number of MSIs.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Greg Kurz <groug@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
hw/ppc/spapr.c
hw/ppc/spapr_pci.c
include/hw/pci-host/spapr.h

index eba7d60a30a73a5f16e915538099cf76b25056e6..98868d893ad83c73d7537cc24c30cca33e43802a 100644 (file)
@@ -1267,7 +1267,7 @@ static void *spapr_build_fdt(sPAPRMachineState *spapr,
     }
 
     QLIST_FOREACH(phb, &spapr->phbs, list) {
-        ret = spapr_populate_pci_dt(phb, PHANDLE_XICP, fdt);
+        ret = spapr_populate_pci_dt(phb, PHANDLE_XICP, fdt, smc->irq->nr_msis);
         if (ret < 0) {
             error_report("couldn't setup PCI devices in fdt");
             exit(1);
index bb736177e76c9a910a30ebef73720bfe3ad5fe9b..c2271e6ed462df1340e46379b783ef2ba48b9d20 100644 (file)
@@ -2069,9 +2069,8 @@ static void spapr_phb_pci_enumerate(sPAPRPHBState *phb)
 
 }
 
-int spapr_populate_pci_dt(sPAPRPHBState *phb,
-                          uint32_t xics_phandle,
-                          void *fdt)
+int spapr_populate_pci_dt(sPAPRPHBState *phb, uint32_t xics_phandle, void *fdt,
+                          uint32_t nr_msis)
 {
     int bus_off, i, j, ret;
     gchar *nodename;
@@ -2121,7 +2120,6 @@ 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("pci@%" PRIx64, phb->buid);
@@ -2139,8 +2137,7 @@ 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));
-    _FDT(fdt_setprop_cell(fdt, bus_off, "ibm,pe-total-#msi",
-                          smc->irq->nr_msis));
+    _FDT(fdt_setprop_cell(fdt, bus_off, "ibm,pe-total-#msi", nr_msis));
 
     /* Dynamic DMA window */
     if (phb->ddw_enabled) {
index 0fae4fc6a4e5f18cb685ede2a95e0905de3de1f8..7c66c3872f968a1a4b02a6f78c4f19b2077a4130 100644 (file)
@@ -113,9 +113,8 @@ static inline qemu_irq spapr_phb_lsi_qirq(struct sPAPRPHBState *phb, int pin)
 
 PCIHostState *spapr_create_phb(sPAPRMachineState *spapr, int index);
 
-int spapr_populate_pci_dt(sPAPRPHBState *phb,
-                          uint32_t xics_phandle,
-                          void *fdt);
+int spapr_populate_pci_dt(sPAPRPHBState *phb, uint32_t xics_phandle, void *fdt,
+                          uint32_t nr_msis);
 
 void spapr_pci_rtas_init(void);