pci: Add root bus parameter to pci_nic_init()

At present, pci_nic_init() and pci_nic_init_nofail() assume that they will
only create a NIC under the primary PCI root.  As we add support for
multiple PCI roots, that may no longer be the case.  This patch adds a root
bus parameter to pci_nic_init() (and updates callers accordingly) to allow
the machine init code using it to specify the right PCI root for NICs
created by old-style -net nic parameters.  NICs created new-style, with
-device can of course be put anywhere.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
David Gibson 2013-06-06 18:48:51 +10:00 committed by Michael S. Tsirkin
parent 85c6e4fabb
commit 29b358f93a
17 changed files with 36 additions and 26 deletions

View file

@ -59,7 +59,7 @@ static void realview_init(QEMUMachineInitArgs *args,
qemu_irq *irqp;
qemu_irq pic[64];
qemu_irq mmc_irq[2];
PCIBus *pci_bus;
PCIBus *pci_bus = NULL;
NICInfo *nd;
i2c_bus *i2c;
int n;
@ -250,7 +250,9 @@ static void realview_init(QEMUMachineInitArgs *args,
}
done_nic = 1;
} else {
pci_nic_init_nofail(nd, "rtl8139", NULL);
if (pci_bus) {
pci_nic_init_nofail(nd, pci_bus, "rtl8139", NULL);
}
}
}