Message ID | 20220624084921.399219-10-danielhb413@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | powernv: introduce pnv-phb base/proxy devices | expand |
On 24/06/2022 10:49, Daniel Henrique Barboza wrote: > We support only a single root port, PNV_PHB_ROOT_PORT. > > Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com> > --- Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com> Fred > hw/pci-host/pnv_phb.c | 7 +------ > hw/ppc/pnv.c | 9 +++++---- > include/hw/ppc/pnv.h | 3 +-- > 3 files changed, 7 insertions(+), 12 deletions(-) > > diff --git a/hw/pci-host/pnv_phb.c b/hw/pci-host/pnv_phb.c > index da729e89e7..cc15a949c9 100644 > --- a/hw/pci-host/pnv_phb.c > +++ b/hw/pci-host/pnv_phb.c > @@ -24,7 +24,6 @@ static void pnv_phb_realize(DeviceState *dev, Error **errp) > PnvPHB *phb = PNV_PHB(dev); > PCIHostState *pci = PCI_HOST_BRIDGE(dev); > g_autofree char *phb_typename = NULL; > - g_autofree char *phb_rootport_typename = NULL; > > if (!phb->version) { > error_setg(errp, "version not specified"); > @@ -34,15 +33,12 @@ static void pnv_phb_realize(DeviceState *dev, Error **errp) > switch (phb->version) { > case 3: > phb_typename = g_strdup(TYPE_PNV_PHB3); > - phb_rootport_typename = g_strdup(TYPE_PNV_PHB_ROOT_PORT); > break; > case 4: > phb_typename = g_strdup(TYPE_PNV_PHB4); > - phb_rootport_typename = g_strdup(TYPE_PNV_PHB_ROOT_PORT); > break; > case 5: > phb_typename = g_strdup(TYPE_PNV_PHB5); > - phb_rootport_typename = g_strdup(TYPE_PNV_PHB_ROOT_PORT); > break; > default: > g_assert_not_reached(); > @@ -73,8 +69,7 @@ static void pnv_phb_realize(DeviceState *dev, Error **errp) > pnv_phb4_bus_init(dev, PNV_PHB4(phb->backend)); > } > > - pnv_phb_attach_root_port(pci, phb_rootport_typename, > - phb->phb_id, phb->chip_id); > + pnv_phb_attach_root_port(pci, phb->phb_id, phb->chip_id); > } > > static const char *pnv_phb_root_bus_path(PCIHostState *host_bridge, > diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c > index 159899103e..5b7cbfc699 100644 > --- a/hw/ppc/pnv.c > +++ b/hw/ppc/pnv.c > @@ -1199,11 +1199,12 @@ static void pnv_chip_icp_realize(Pnv8Chip *chip8, Error **errp) > * QOM id. 'chip_id' is going to be used as PCIE chassis for the > * root port. > */ > -void pnv_phb_attach_root_port(PCIHostState *pci, const char *name, > - int index, int chip_id) > +void pnv_phb_attach_root_port(PCIHostState *pci, int index, int chip_id) > { > - PCIDevice *root = pci_new(PCI_DEVFN(0, 0), name); > - g_autofree char *default_id = g_strdup_printf("%s[%d]", name, index); > + PCIDevice *root = pci_new(PCI_DEVFN(0, 0), TYPE_PNV_PHB_ROOT_PORT); > + g_autofree char *default_id = g_strdup_printf("%s[%d]", > + TYPE_PNV_PHB_ROOT_PORT, > + index); > const char *dev_id = DEVICE(root)->id; > > object_property_add_child(OBJECT(pci->bus), dev_id ? dev_id : default_id, > diff --git a/include/hw/ppc/pnv.h b/include/hw/ppc/pnv.h > index 33b7b52f45..fbad11d6a7 100644 > --- a/include/hw/ppc/pnv.h > +++ b/include/hw/ppc/pnv.h > @@ -190,8 +190,7 @@ DECLARE_INSTANCE_CHECKER(PnvChip, PNV_CHIP_POWER10, > TYPE_PNV_CHIP_POWER10) > > PowerPCCPU *pnv_chip_find_cpu(PnvChip *chip, uint32_t pir); > -void pnv_phb_attach_root_port(PCIHostState *pci, const char *name, > - int index, int chip_id); > +void pnv_phb_attach_root_port(PCIHostState *pci, int index, int chip_id); > > #define TYPE_PNV_MACHINE MACHINE_TYPE_NAME("powernv") > typedef struct PnvMachineClass PnvMachineClass;
diff --git a/hw/pci-host/pnv_phb.c b/hw/pci-host/pnv_phb.c index da729e89e7..cc15a949c9 100644 --- a/hw/pci-host/pnv_phb.c +++ b/hw/pci-host/pnv_phb.c @@ -24,7 +24,6 @@ static void pnv_phb_realize(DeviceState *dev, Error **errp) PnvPHB *phb = PNV_PHB(dev); PCIHostState *pci = PCI_HOST_BRIDGE(dev); g_autofree char *phb_typename = NULL; - g_autofree char *phb_rootport_typename = NULL; if (!phb->version) { error_setg(errp, "version not specified"); @@ -34,15 +33,12 @@ static void pnv_phb_realize(DeviceState *dev, Error **errp) switch (phb->version) { case 3: phb_typename = g_strdup(TYPE_PNV_PHB3); - phb_rootport_typename = g_strdup(TYPE_PNV_PHB_ROOT_PORT); break; case 4: phb_typename = g_strdup(TYPE_PNV_PHB4); - phb_rootport_typename = g_strdup(TYPE_PNV_PHB_ROOT_PORT); break; case 5: phb_typename = g_strdup(TYPE_PNV_PHB5); - phb_rootport_typename = g_strdup(TYPE_PNV_PHB_ROOT_PORT); break; default: g_assert_not_reached(); @@ -73,8 +69,7 @@ static void pnv_phb_realize(DeviceState *dev, Error **errp) pnv_phb4_bus_init(dev, PNV_PHB4(phb->backend)); } - pnv_phb_attach_root_port(pci, phb_rootport_typename, - phb->phb_id, phb->chip_id); + pnv_phb_attach_root_port(pci, phb->phb_id, phb->chip_id); } static const char *pnv_phb_root_bus_path(PCIHostState *host_bridge, diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 159899103e..5b7cbfc699 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -1199,11 +1199,12 @@ static void pnv_chip_icp_realize(Pnv8Chip *chip8, Error **errp) * QOM id. 'chip_id' is going to be used as PCIE chassis for the * root port. */ -void pnv_phb_attach_root_port(PCIHostState *pci, const char *name, - int index, int chip_id) +void pnv_phb_attach_root_port(PCIHostState *pci, int index, int chip_id) { - PCIDevice *root = pci_new(PCI_DEVFN(0, 0), name); - g_autofree char *default_id = g_strdup_printf("%s[%d]", name, index); + PCIDevice *root = pci_new(PCI_DEVFN(0, 0), TYPE_PNV_PHB_ROOT_PORT); + g_autofree char *default_id = g_strdup_printf("%s[%d]", + TYPE_PNV_PHB_ROOT_PORT, + index); const char *dev_id = DEVICE(root)->id; object_property_add_child(OBJECT(pci->bus), dev_id ? dev_id : default_id, diff --git a/include/hw/ppc/pnv.h b/include/hw/ppc/pnv.h index 33b7b52f45..fbad11d6a7 100644 --- a/include/hw/ppc/pnv.h +++ b/include/hw/ppc/pnv.h @@ -190,8 +190,7 @@ DECLARE_INSTANCE_CHECKER(PnvChip, PNV_CHIP_POWER10, TYPE_PNV_CHIP_POWER10) PowerPCCPU *pnv_chip_find_cpu(PnvChip *chip, uint32_t pir); -void pnv_phb_attach_root_port(PCIHostState *pci, const char *name, - int index, int chip_id); +void pnv_phb_attach_root_port(PCIHostState *pci, int index, int chip_id); #define TYPE_PNV_MACHINE MACHINE_TYPE_NAME("powernv") typedef struct PnvMachineClass PnvMachineClass;
We support only a single root port, PNV_PHB_ROOT_PORT. Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com> --- hw/pci-host/pnv_phb.c | 7 +------ hw/ppc/pnv.c | 9 +++++---- include/hw/ppc/pnv.h | 3 +-- 3 files changed, 7 insertions(+), 12 deletions(-)