Skip to contentSkip to conversation

acpi-build: Walk PCI root buses when building IVHD entries

PATCH New Sairaj Kodilkar 1 participant 1 message Nov 16

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 acpi-build: Walk PCI root buses when building IVHD entries

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")
---
 hw/i386/acpi-build.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/i386/acpi-build.c +1 -1
index 985515434974..84a8b14d83a6 100644
@@ -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;
     }
 
Signature · 1 line
2.34.1