Message ID | 20180910110222.8162-4-clg@kaod.org |
---|---|
State | New |
Headers | show |
Series | spapr: introduce a new sPAPRIrq backend | expand |
On Mon, Sep 10, 2018 at 01:02:22PM +0200, Cédric Le Goater wrote: > 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 <clg@kaod.org> Oh.. right.. I think it makes more sense to just merge this into the first patch. > --- > 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("pci@%" 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) {
On 09/11/2018 03:50 AM, David Gibson wrote: > On Mon, Sep 10, 2018 at 01:02:22PM +0200, Cédric Le Goater wrote: >> 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 <clg@kaod.org> > > Oh.. right.. I think it makes more sense to just merge this into the > first patch. OK. I will also remove XICS_IRQS_SPAPR in the first patch then Thanks, C. >> --- >> 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("pci@%" 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) { >
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("pci@%" 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) {
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 <clg@kaod.org> --- 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(-)