Message ID | 20211228193806.1198496-17-danielhb413@gmail.com |
---|---|
State | Accepted, archived |
Headers | show |
Series | ppc/pnv: enable pnv-phb4 user devices | expand |
On 12/28/21 20:38, Daniel Henrique Barboza wrote: > This change has the same motivation as the one done for pnv-phb3-root-bus > buses previously. Defaulting every bus to 'root-bus' makes it impossible to attach > root ports to specific buses and it doesn't allow for custom bus > naming because we're ignoring the 'id' value when registering the root > bus. > > After this patch, creating pnv-phb4 devices with 'id' being set will > result in the following qtree: > > qemu-system-ppc64 -m 4G -machine powernv9,accel=tcg \ > -device pnv-phb4,chip-id=0,index=0,id=pcie.0 \ > -device pnv-phb4,chip-id=1,index=4,id=pcie.1 > > bus: main-system-bus > type System > dev: pnv-phb4, id "pcie.1" > index = 4 (0x4) > chip-id = 1 (0x1) > version = 704374636546 (0xa400000002) > device-id = 1217 (0x4c1) > x-config-reg-migration-enabled = true > bypass-iommu = false > bus: pcie.1 > type pnv-phb4-root-bus > dev: pnv-phb4, id "pcie.0" > index = 0 (0x0) > chip-id = 0 (0x0) > version = 704374636546 (0xa400000002) > device-id = 1217 (0x4c1) > x-config-reg-migration-enabled = true > bypass-iommu = false > bus: pcie.0 > type pnv-phb4-root-bus > > And without setting any ids: > > qemu-system-ppc64 -m 4G -machine powernv9,accel=tcg \ > -device pnv-phb4,chip-id=0,index=0,id=pcie.0 \ > -device pnv-phb4,chip-id=1,index=4,id=pcie.1 > > bus: main-system-bus > type System > dev: pnv-phb4, id "" > index = 4 (0x4) > chip-id = 1 (0x1) > version = 704374636546 (0xa400000002) > device-id = 1217 (0x4c1) > x-config-reg-migration-enabled = true > bypass-iommu = false > bus: pnv-phb4-root-bus.1 > type pnv-phb4-root-bus > dev: pnv-phb4, id "" > index = 0 (0x0) > chip-id = 0 (0x0) > version = 704374636546 (0xa400000002) > device-id = 1217 (0x4c1) > x-config-reg-migration-enabled = true > bypass-iommu = false > bus: pnv-phb4-root-bus.0 > type pnv-phb4-root-bus > > Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com> Reviewed-by: Cédric Le Goater <clg@kaod.org> Thanks, C. > --- > hw/pci-host/pnv_phb4.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c > index 7b53c12b7c..982a61ebc0 100644 > --- a/hw/pci-host/pnv_phb4.c > +++ b/hw/pci-host/pnv_phb4.c > @@ -1354,7 +1354,7 @@ static void pnv_phb4_realize(DeviceState *dev, Error **errp) > memory_region_init(&phb->pci_mmio, OBJECT(phb), name, > PCI_MMIO_TOTAL_SIZE); > > - pci->bus = pci_register_root_bus(dev, "root-bus", > + pci->bus = pci_register_root_bus(dev, dev->id, > pnv_phb4_set_irq, pnv_phb4_map_irq, phb, > &phb->pci_mmio, &phb->pci_io, > 0, 4, TYPE_PNV_PHB4_ROOT_BUS); >
diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c index 7b53c12b7c..982a61ebc0 100644 --- a/hw/pci-host/pnv_phb4.c +++ b/hw/pci-host/pnv_phb4.c @@ -1354,7 +1354,7 @@ static void pnv_phb4_realize(DeviceState *dev, Error **errp) memory_region_init(&phb->pci_mmio, OBJECT(phb), name, PCI_MMIO_TOTAL_SIZE); - pci->bus = pci_register_root_bus(dev, "root-bus", + pci->bus = pci_register_root_bus(dev, dev->id, pnv_phb4_set_irq, pnv_phb4_map_irq, phb, &phb->pci_mmio, &phb->pci_io, 0, 4, TYPE_PNV_PHB4_ROOT_BUS);
This change has the same motivation as the one done for pnv-phb3-root-bus buses previously. Defaulting every bus to 'root-bus' makes it impossible to attach root ports to specific buses and it doesn't allow for custom bus naming because we're ignoring the 'id' value when registering the root bus. After this patch, creating pnv-phb4 devices with 'id' being set will result in the following qtree: qemu-system-ppc64 -m 4G -machine powernv9,accel=tcg \ -device pnv-phb4,chip-id=0,index=0,id=pcie.0 \ -device pnv-phb4,chip-id=1,index=4,id=pcie.1 bus: main-system-bus type System dev: pnv-phb4, id "pcie.1" index = 4 (0x4) chip-id = 1 (0x1) version = 704374636546 (0xa400000002) device-id = 1217 (0x4c1) x-config-reg-migration-enabled = true bypass-iommu = false bus: pcie.1 type pnv-phb4-root-bus dev: pnv-phb4, id "pcie.0" index = 0 (0x0) chip-id = 0 (0x0) version = 704374636546 (0xa400000002) device-id = 1217 (0x4c1) x-config-reg-migration-enabled = true bypass-iommu = false bus: pcie.0 type pnv-phb4-root-bus And without setting any ids: qemu-system-ppc64 -m 4G -machine powernv9,accel=tcg \ -device pnv-phb4,chip-id=0,index=0,id=pcie.0 \ -device pnv-phb4,chip-id=1,index=4,id=pcie.1 bus: main-system-bus type System dev: pnv-phb4, id "" index = 4 (0x4) chip-id = 1 (0x1) version = 704374636546 (0xa400000002) device-id = 1217 (0x4c1) x-config-reg-migration-enabled = true bypass-iommu = false bus: pnv-phb4-root-bus.1 type pnv-phb4-root-bus dev: pnv-phb4, id "" index = 0 (0x0) chip-id = 0 (0x0) version = 704374636546 (0xa400000002) device-id = 1217 (0x4c1) x-config-reg-migration-enabled = true bypass-iommu = false bus: pnv-phb4-root-bus.0 type pnv-phb4-root-bus Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com> --- hw/pci-host/pnv_phb4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)