Only pci host bus must be registered as root bus. Signed-off-by: Isaku Yamahata <yamah...@valinux.co.jp> --- hw/pci.c | 8 ++------ hw/pci.h | 1 + hw/piix_pci.c | 1 + 3 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/hw/pci.c b/hw/pci.c index 5dee102..162dcd4 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -207,7 +207,7 @@ static void pci_bus_resetfn(void *opaque) pci_bus_reset(bus); } -static void pci_host_bus_register(int domain, PCIBus *bus) +void pci_host_bus_register(int domain, PCIBus *bus) { struct PCIHostBus *host; host = qemu_mallocz(sizeof(*host)); @@ -254,11 +254,7 @@ void pci_bus_new_inplace(PCIBus *bus, DeviceState *parent, { qbus_create_inplace(&bus->qbus, &pci_bus_info, parent, name); bus->devfn_min = devfn_min; - - /* host bridge */ QLIST_INIT(&bus->child); - pci_host_bus_register(0, bus); /* for now only pci domain 0 is supported */ - vmstate_register(-1, &vmstate_pcibus, bus); qemu_register_reset(pci_bus_resetfn, bus); } @@ -302,6 +298,7 @@ PCIBus *pci_register_bus(DeviceState *parent, const char *name, PCIBus *bus; bus = pci_bus_new(parent, name, devfn_min); + pci_host_bus_register(0, bus); /* for now only pci domain 0 is supported */ pci_bus_irqs(bus, set_irq, map_irq, irq_opaque, nirq); return bus; } @@ -317,7 +314,6 @@ PCIBus *pci_register_secondary_bus(PCIBus *parent, bus->map_irq = map_irq; bus->parent_dev = dev; - QLIST_INIT(&bus->child); QLIST_INSERT_HEAD(&parent->child, bus, sibling); return bus; diff --git a/hw/pci.h b/hw/pci.h index 2a2c8ef..10a63e8 100644 --- a/hw/pci.h +++ b/hw/pci.h @@ -227,6 +227,7 @@ PCIDevice *pci_nic_init_nofail(NICInfo *nd, const char *default_model, const char *default_devaddr); int pci_bus_num(PCIBus *s); void pci_for_each_device(PCIBus *bus, int bus_num, void (*fn)(PCIBus *bus, PCIDevice *d)); +void pci_host_bus_register(int domain, PCIBus *bus); PCIBus *pci_find_root_bus(int domain); int pci_find_domain(const PCIBus *bus); PCIBus *pci_find_bus(PCIBus *bus, int bus_num); diff --git a/hw/piix_pci.c b/hw/piix_pci.c index d14d05e..16645cd 100644 --- a/hw/piix_pci.c +++ b/hw/piix_pci.c @@ -227,6 +227,7 @@ PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix3_devfn, qemu_irq * dev = qdev_create(NULL, "i440FX-pcihost"); s = FROM_SYSBUS(I440FXState, sysbus_from_qdev(dev)); b = pci_bus_new(&s->busdev.qdev, NULL, 0); + pci_host_bus_register(0, b); /* pci domain 0 */ s->bus = b; qdev_init_nofail(dev); -- 1.6.6.1