Message ID | 20220117122753.1655504-2-clg@kaod.org |
---|---|
State | New |
Headers | show |
Series | ppc/pnv: Final refinements on PHB4s | expand |
On 1/17/22 09:27, Cédric Le Goater wrote: > The root port device is currently created and attached to the PHB > early in pnv_phb4_realize(). Do it under pnv_pec_default_phb_realize() > after the PHB is fully realized. It's cleaner and avoids an extra > test on defaults_enabled(). > > Signed-off-by: Cédric Le Goater <clg@kaod.org> > --- Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com> > hw/pci-host/pnv_phb4.c | 7 ------- > hw/pci-host/pnv_phb4_pec.c | 3 +++ > 2 files changed, 3 insertions(+), 7 deletions(-) > > diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c > index 1db815b1aba0..c688976caec9 100644 > --- a/hw/pci-host/pnv_phb4.c > +++ b/hw/pci-host/pnv_phb4.c > @@ -22,7 +22,6 @@ > #include "hw/irq.h" > #include "hw/qdev-properties.h" > #include "qom/object.h" > -#include "sysemu/sysemu.h" > #include "trace.h" > > #define phb_error(phb, fmt, ...) \ > @@ -1639,12 +1638,6 @@ static void pnv_phb4_realize(DeviceState *dev, Error **errp) > pci_setup_iommu(pci->bus, pnv_phb4_dma_iommu, phb); > pci->bus->flags |= PCI_BUS_EXTENDED_CONFIG_SPACE; > > - /* Add a single Root port if running with defaults */ > - if (defaults_enabled()) { > - pnv_phb_attach_root_port(PCI_HOST_BRIDGE(phb), > - TYPE_PNV_PHB4_ROOT_PORT); > - } > - > /* Setup XIVE Source */ > if (phb->big_phb) { > nr_irqs = PNV_PHB4_MAX_INTs; > diff --git a/hw/pci-host/pnv_phb4_pec.c b/hw/pci-host/pnv_phb4_pec.c > index 12aa4596282b..b19e89236a63 100644 > --- a/hw/pci-host/pnv_phb4_pec.c > +++ b/hw/pci-host/pnv_phb4_pec.c > @@ -132,6 +132,9 @@ static void pnv_pec_default_phb_realize(PnvPhb4PecState *pec, > if (!sysbus_realize(SYS_BUS_DEVICE(phb), errp)) { > return; > } > + > + /* Add a single Root port if running with defaults */ > + pnv_phb_attach_root_port(PCI_HOST_BRIDGE(phb), TYPE_PNV_PHB4_ROOT_PORT); > } > > static void pnv_pec_realize(DeviceState *dev, Error **errp)
diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c index 1db815b1aba0..c688976caec9 100644 --- a/hw/pci-host/pnv_phb4.c +++ b/hw/pci-host/pnv_phb4.c @@ -22,7 +22,6 @@ #include "hw/irq.h" #include "hw/qdev-properties.h" #include "qom/object.h" -#include "sysemu/sysemu.h" #include "trace.h" #define phb_error(phb, fmt, ...) \ @@ -1639,12 +1638,6 @@ static void pnv_phb4_realize(DeviceState *dev, Error **errp) pci_setup_iommu(pci->bus, pnv_phb4_dma_iommu, phb); pci->bus->flags |= PCI_BUS_EXTENDED_CONFIG_SPACE; - /* Add a single Root port if running with defaults */ - if (defaults_enabled()) { - pnv_phb_attach_root_port(PCI_HOST_BRIDGE(phb), - TYPE_PNV_PHB4_ROOT_PORT); - } - /* Setup XIVE Source */ if (phb->big_phb) { nr_irqs = PNV_PHB4_MAX_INTs; diff --git a/hw/pci-host/pnv_phb4_pec.c b/hw/pci-host/pnv_phb4_pec.c index 12aa4596282b..b19e89236a63 100644 --- a/hw/pci-host/pnv_phb4_pec.c +++ b/hw/pci-host/pnv_phb4_pec.c @@ -132,6 +132,9 @@ static void pnv_pec_default_phb_realize(PnvPhb4PecState *pec, if (!sysbus_realize(SYS_BUS_DEVICE(phb), errp)) { return; } + + /* Add a single Root port if running with defaults */ + pnv_phb_attach_root_port(PCI_HOST_BRIDGE(phb), TYPE_PNV_PHB4_ROOT_PORT); } static void pnv_pec_realize(DeviceState *dev, Error **errp)
The root port device is currently created and attached to the PHB early in pnv_phb4_realize(). Do it under pnv_pec_default_phb_realize() after the PHB is fully realized. It's cleaner and avoids an extra test on defaults_enabled(). Signed-off-by: Cédric Le Goater <clg@kaod.org> --- hw/pci-host/pnv_phb4.c | 7 ------- hw/pci-host/pnv_phb4_pec.c | 3 +++ 2 files changed, 3 insertions(+), 7 deletions(-)