aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2017-11-29 19:46:28 +1100
committerMichael S. Tsirkin <mst@redhat.com>2017-12-05 19:13:45 +0200
commite492dc5a267e2236b93b8b7192fedd840ef34dc9 (patch)
tree30fc923126d53e8f09753fd9322723975955ec4c
parentfd56e0612b6454a282fa6a953fdb09281a98c589 (diff)
downloadqemu-e492dc5a267e2236b93b8b7192fedd840ef34dc9.zip
qemu-e492dc5a267e2236b93b8b7192fedd840ef34dc9.tar.gz
qemu-e492dc5a267e2236b93b8b7192fedd840ef34dc9.tar.bz2
pci: Eliminate pci_find_primary_bus()
pci_find_primary_bus() only has one user, in pc_xen_hvm_init(). That's inside the machine construction code, so it already has easy access to the machine's primary PCI bus. Get it directly, and thereby remove pci_find_primary_bus(). This removes one of only a handful of users of the ugly pci_host_bridges global. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Marcel Apfelbaum <marcel@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com>
-rw-r--r--hw/i386/pc_piix.c8
-rw-r--r--hw/pci/pci.c16
-rw-r--r--include/hw/pci/pci.h1
3 files changed, 2 insertions, 23 deletions
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 5e47528..2febd0e 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -394,7 +394,7 @@ static void pc_xen_hvm_init_pci(MachineState *machine)
static void pc_xen_hvm_init(MachineState *machine)
{
- PCIBus *bus;
+ PCMachineState *pcms = PC_MACHINE(machine);
if (!xen_enabled()) {
error_report("xenfv machine requires the xen accelerator");
@@ -402,11 +402,7 @@ static void pc_xen_hvm_init(MachineState *machine)
}
pc_xen_hvm_init_pci(machine);
-
- bus = pci_find_primary_bus();
- if (bus != NULL) {
- pci_create_simple(bus, -1, "xen-platform");
- }
+ pci_create_simple(pcms->bus, -1, "xen-platform");
}
#endif
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 567be1b..e8f9fc1 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -331,22 +331,6 @@ static void pci_host_bus_register(DeviceState *host)
QLIST_INSERT_HEAD(&pci_host_bridges, host_bridge, next);
}
-PCIBus *pci_find_primary_bus(void)
-{
- PCIBus *primary_bus = NULL;
- PCIHostState *host;
-
- QLIST_FOREACH(host, &pci_host_bridges, next) {
- if (primary_bus) {
- /* We have multiple root buses, refuse to select a primary */
- return NULL;
- }
- primary_bus = host->bus;
- }
-
- return primary_bus;
-}
-
PCIBus *pci_device_root_bus(const PCIDevice *d)
{
PCIBus *bus = pci_get_bus(d);
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index 597ffb7..15ced96 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -467,7 +467,6 @@ void pci_for_each_bus(PCIBus *bus,
pci_for_each_bus_depth_first(bus, NULL, fn, opaque);
}
-PCIBus *pci_find_primary_bus(void);
PCIBus *pci_device_root_bus(const PCIDevice *d);
const char *pci_root_bus_path(PCIDevice *dev);
PCIDevice *pci_find_device(PCIBus *bus, int bus_num, uint8_t devfn);