On 26/07/17 03:58, Greg Kurz wrote: > This function is only used when creating the default PHB. Let's rename > it and move it to the core machine code for clarity. > > Signed-off-by: Greg Kurz <gr...@kaod.org> > --- > hw/ppc/spapr.c | 13 ++++++++++++- > hw/ppc/spapr_pci.c | 11 ----------- > include/hw/pci-host/spapr.h | 2 -- > 3 files changed, 12 insertions(+), 14 deletions(-) > > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index 2a3e53d5d58c..53969315ac24 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c > @@ -2142,6 +2142,17 @@ static void spapr_init_cpus(sPAPRMachineState *spapr) > g_free(type); > } > > +static PCIHostState *spapr_create_default_phb(sPAPRMachineState *spapr)
Nit: you could get rid of the *spapr here. Anyway, Reviewed-by: Alexey Kardashevskiy <a...@ozlabs.ru> > +{ > + DeviceState *dev; > + > + dev = qdev_create(NULL, TYPE_SPAPR_PCI_HOST_BRIDGE); > + qdev_prop_set_uint32(dev, "index", 0); > + qdev_init_nofail(dev); > + > + return PCI_HOST_BRIDGE(dev); > +} > + > /* pSeries LPAR / sPAPR hardware init */ > static void ppc_spapr_init(MachineState *machine) > { > @@ -2374,7 +2385,7 @@ static void ppc_spapr_init(MachineState *machine) > /* Set up PCI */ > spapr_pci_rtas_init(); > > - phb = spapr_create_phb(spapr, 0); > + phb = spapr_create_default_phb(spapr); > > for (i = 0; i < nb_nics; i++) { > NICInfo *nd = &nd_table[i]; > diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c > index d84abf1070a0..70a99a032267 100644 > --- a/hw/ppc/spapr_pci.c > +++ b/hw/ppc/spapr_pci.c > @@ -1982,17 +1982,6 @@ static const TypeInfo spapr_phb_info = { > } > }; > > -PCIHostState *spapr_create_phb(sPAPRMachineState *spapr, int index) > -{ > - DeviceState *dev; > - > - dev = qdev_create(NULL, TYPE_SPAPR_PCI_HOST_BRIDGE); > - qdev_prop_set_uint32(dev, "index", index); > - qdev_init_nofail(dev); > - > - return PCI_HOST_BRIDGE(dev); > -} > - > typedef struct sPAPRFDT { > void *fdt; > int node_off; > diff --git a/include/hw/pci-host/spapr.h b/include/hw/pci-host/spapr.h > index 38470b2f0e5c..5a4e9686d562 100644 > --- a/include/hw/pci-host/spapr.h > +++ b/include/hw/pci-host/spapr.h > @@ -111,8 +111,6 @@ static inline qemu_irq spapr_phb_lsi_qirq(struct > sPAPRPHBState *phb, int pin) > return xics_get_qirq(XICS_FABRIC(spapr), phb->lsi_table[pin].irq); > } > > -PCIHostState *spapr_create_phb(sPAPRMachineState *spapr, int index); > - > int spapr_populate_pci_dt(sPAPRPHBState *phb, > uint32_t xics_phandle, > void *fdt); > > -- Alexey