Message ID | 20170911171235.29331-16-clg@kaod.org |
---|---|
State | New |
Headers | show |
Series | Guest exploitation of the XIVE interrupt controller (POWER9) | expand |
On Mon, Sep 11, 2017 at 07:12:29PM +0200, Cédric Le Goater wrote: > This adds some flexibility in the definition of the number of > available IRQS used in a sPAPR machine. > > Signed-off-by: Cédric Le Goater <clg@kaod.org> This doesn't seem sensible. You've already stated that the XIVE and XICS need equivalent irq number spaces, so in particular they should have the same number of irqs advertised. > --- > hw/ppc/spapr.c | 2 +- > hw/ppc/spapr_pci.c | 4 ++-- > include/hw/pci-host/spapr.h | 2 +- > 3 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index 3e3ff1fbc988..5d69df928434 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c > @@ -1093,7 +1093,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, XICS_IRQS_SPAPR); > if (ret < 0) { > error_report("couldn't setup PCI devices in fdt"); > exit(1); > diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c > index d84abf1070a0..05b0a067458e 100644 > --- a/hw/ppc/spapr_pci.c > +++ b/hw/ppc/spapr_pci.c > @@ -2073,7 +2073,7 @@ static void spapr_phb_pci_enumerate(sPAPRPHBState *phb) > > int spapr_populate_pci_dt(sPAPRPHBState *phb, > uint32_t xics_phandle, > - void *fdt) > + void *fdt, int nr_irqs) > { > int bus_off, i, j, ret; > char nodename[FDT_NAME_MAX]; > @@ -2142,7 +2142,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", XICS_IRQS_SPAPR)); > + _FDT(fdt_setprop_cell(fdt, bus_off, "ibm,pe-total-#msi", nr_irqs)); > > /* Dynamic DMA window */ > if (phb->ddw_enabled) { > diff --git a/include/hw/pci-host/spapr.h b/include/hw/pci-host/spapr.h > index 38470b2f0e5c..40146f72c103 100644 > --- a/include/hw/pci-host/spapr.h > +++ b/include/hw/pci-host/spapr.h > @@ -115,7 +115,7 @@ PCIHostState *spapr_create_phb(sPAPRMachineState *spapr, int index); > > int spapr_populate_pci_dt(sPAPRPHBState *phb, > uint32_t xics_phandle, > - void *fdt); > + void *fdt, int nr_irqs); > > void spapr_pci_rtas_init(void); >
On 09/19/2017 09:56 AM, David Gibson wrote: > On Mon, Sep 11, 2017 at 07:12:29PM +0200, Cédric Le Goater wrote: >> This adds some flexibility in the definition of the number of >> available IRQS used in a sPAPR machine. >> >> Signed-off-by: Cédric Le Goater <clg@kaod.org> > > This doesn't seem sensible. You've already stated that the XIVE and > XICS need equivalent irq number spaces, so in particular they should > have the same number of irqs advertised. yes. I am adding an argument to spapr_populate_pci_dt() because it is using the XICS_IRQS_SPAPR define directly and I intend to extend that number of irqs with the number of cpus to have room for IPIs. C. >> --- >> hw/ppc/spapr.c | 2 +- >> hw/ppc/spapr_pci.c | 4 ++-- >> include/hw/pci-host/spapr.h | 2 +- >> 3 files changed, 4 insertions(+), 4 deletions(-) >> >> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c >> index 3e3ff1fbc988..5d69df928434 100644 >> --- a/hw/ppc/spapr.c >> +++ b/hw/ppc/spapr.c >> @@ -1093,7 +1093,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, XICS_IRQS_SPAPR); >> if (ret < 0) { >> error_report("couldn't setup PCI devices in fdt"); >> exit(1); >> diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c >> index d84abf1070a0..05b0a067458e 100644 >> --- a/hw/ppc/spapr_pci.c >> +++ b/hw/ppc/spapr_pci.c >> @@ -2073,7 +2073,7 @@ static void spapr_phb_pci_enumerate(sPAPRPHBState *phb) >> >> int spapr_populate_pci_dt(sPAPRPHBState *phb, >> uint32_t xics_phandle, >> - void *fdt) >> + void *fdt, int nr_irqs) >> { >> int bus_off, i, j, ret; >> char nodename[FDT_NAME_MAX]; >> @@ -2142,7 +2142,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", XICS_IRQS_SPAPR)); >> + _FDT(fdt_setprop_cell(fdt, bus_off, "ibm,pe-total-#msi", nr_irqs)); >> >> /* Dynamic DMA window */ >> if (phb->ddw_enabled) { >> diff --git a/include/hw/pci-host/spapr.h b/include/hw/pci-host/spapr.h >> index 38470b2f0e5c..40146f72c103 100644 >> --- a/include/hw/pci-host/spapr.h >> +++ b/include/hw/pci-host/spapr.h >> @@ -115,7 +115,7 @@ PCIHostState *spapr_create_phb(sPAPRMachineState *spapr, int index); >> >> int spapr_populate_pci_dt(sPAPRPHBState *phb, >> uint32_t xics_phandle, >> - void *fdt); >> + void *fdt, int nr_irqs); >> >> void spapr_pci_rtas_init(void); >> >
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 3e3ff1fbc988..5d69df928434 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1093,7 +1093,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, XICS_IRQS_SPAPR); if (ret < 0) { error_report("couldn't setup PCI devices in fdt"); exit(1); diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index d84abf1070a0..05b0a067458e 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -2073,7 +2073,7 @@ static void spapr_phb_pci_enumerate(sPAPRPHBState *phb) int spapr_populate_pci_dt(sPAPRPHBState *phb, uint32_t xics_phandle, - void *fdt) + void *fdt, int nr_irqs) { int bus_off, i, j, ret; char nodename[FDT_NAME_MAX]; @@ -2142,7 +2142,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", XICS_IRQS_SPAPR)); + _FDT(fdt_setprop_cell(fdt, bus_off, "ibm,pe-total-#msi", nr_irqs)); /* Dynamic DMA window */ if (phb->ddw_enabled) { diff --git a/include/hw/pci-host/spapr.h b/include/hw/pci-host/spapr.h index 38470b2f0e5c..40146f72c103 100644 --- a/include/hw/pci-host/spapr.h +++ b/include/hw/pci-host/spapr.h @@ -115,7 +115,7 @@ PCIHostState *spapr_create_phb(sPAPRMachineState *spapr, int index); int spapr_populate_pci_dt(sPAPRPHBState *phb, uint32_t xics_phandle, - void *fdt); + void *fdt, int nr_irqs); void spapr_pci_rtas_init(void);
This adds some flexibility in the definition of the number of available IRQS used in a sPAPR machine. Signed-off-by: Cédric Le Goater <clg@kaod.org> --- hw/ppc/spapr.c | 2 +- hw/ppc/spapr_pci.c | 4 ++-- include/hw/pci-host/spapr.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)