@@ -105,7 +105,11 @@ static void acpi_set_pci_info(void)
}
bsel_is_set = true;
- bus = find_i440fx(); /* TODO: Q35 support */
+ bus = find_i440fx();
+ if (!bus) {
+ bus = find_q35();
+ }
+
if (bus) {
/* Scan all PCI buses. Set property to enable acpi based hotplug. */
pci_for_each_bus_depth_first(bus, acpi_set_bsel, NULL, &bsel_alloc);
@@ -258,6 +258,14 @@ static void q35_host_initfn(Object *obj)
IO_APIC_DEFAULT_ADDRESS - 1);
}
+PCIBus *find_q35(void)
+{
+ PCIHostState *s = OBJECT_CHECK(PCIHostState,
+ object_resolve_path("/machine/q35", NULL),
+ TYPE_PCI_HOST_BRIDGE);
+ return s ? s->bus : NULL;
+}
+
static const TypeInfo q35_host_info = {
.name = TYPE_Q35_HOST_DEVICE,
.parent = TYPE_PCIE_HOST_BRIDGE,
@@ -302,6 +302,9 @@ PCIBus *find_i440fx(void);
extern PCIDevice *piix4_dev;
int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn);
+/* q35.c */
+PCIBus *find_q35(void);
+
/* pc_sysfw.c */
void pc_system_firmware_init(MemoryRegion *rom_memory,
bool isapc_ram_fw);
On Q35 we still need to assign BSEL property to bus(es) for PCI device add/hotplug to work. Extend acpi_set_pci_info() function to support Q35 as well. Previously it was limited to find_i440fx() call, this patch adds new (trivial) function find_q35() which returns root PCIBus object on Q35, in a way similar to what find_i440fx does. Signed-off-by: Alexey Gerasimenko <x1917x@gmail.com> --- hw/acpi/pcihp.c | 6 +++++- hw/pci-host/q35.c | 8 ++++++++ include/hw/i386/pc.h | 3 +++ 3 files changed, 16 insertions(+), 1 deletion(-)