add_ivhd_entries_from_bus() treats every bus with parent_dev set as a
bridge secondary bus and reads PCI_SUBORDINATE_BUS to decide between a
device walk and a leaf range. A pxb-pcie bus is a root bus, but
pxb_register_bus() sets parent_dev and links the bus into pcie.0's
child list. The pxb device is a type-0 host bridge, so offset 0x1a is
a BAR byte rather than the subordinate bus number. The walk currently
selects the devices on that bus only because the BAR byte is 0 and
bus_nr is not. If those values match, the builder emits a range and
skips the devices and bridges under the pxb bus.

Treat pci_bus_is_root() the same as a bus with no parent device.
pcie.0 and pxb-pcie then get a device walk. Bridge secondary buses
still use PCI_SUBORDINATE_BUS for their range entries.

Fixes: f3370c89e1726 ("acpi-build: Create PCI topology using amd iommu root 
bus")
Signed-off-by: Sairaj Kodilkar <[email protected]>
---
 hw/i386/acpi-build.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 985515434974..84a8b14d83a6 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1776,7 +1776,7 @@ static void add_ivhd_entries_from_bus(PCIBus *bus, GArray 
*table_data)
     PCIBus *child_bus;
     PCIDevice *parent_dev;
 
-    if (!bus->parent_dev) {
+    if (!bus->parent_dev || pci_bus_is_root(bus)) {
         goto select_devices;
     }
 
-- 
2.34.1


Reply via email to