[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 09/25] pci: Eliminate pci_find_primary_bus()
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 09/25] pci: Eliminate pci_find_primary_bus() |
Date: |
Thu, 21 Dec 2017 16:29:06 +0200 |
From: David Gibson <address@hidden>
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 <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
Reviewed-by: Marcel Apfelbaum <address@hidden>
Reviewed-by: Peter Xu <address@hidden>
---
include/hw/pci/pci.h | 1 -
hw/i386/pc_piix.c | 8 ++------
hw/pci/pci.c | 16 ----------------
3 files changed, 2 insertions(+), 23 deletions(-)
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);
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);
--
MST
- [Qemu-devel] [PULL 00/25] pc, pci, virtio: features, fixes, cleanups, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 01/25] smbios: support setting OEM strings table, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 02/25] qdev-properties: add UUID property type, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 03/25] vmgenid: use UUID property type, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 04/25] tests: add test to check VirtQueue object, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 05/25] pci: Rename root bus initialization functions for clarity, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 06/25] pci: Move bridge data structures from pci_bus.h to pci_bridge.h, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 07/25] pci: Add pci_dev_bus_num() helper, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 10/25] virtio_error: don't invoke status callbacks, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 09/25] pci: Eliminate pci_find_primary_bus(),
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 11/25] tests/pxe-test: Remove unnecessary special case test functions, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 14/25] tests/pxe-test: Add some extra tests, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 08/25] pci: Eliminate redundant PCIDevice::bus pointer, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 12/25] tests/pxe-test: Use table of testcases rather than open-coding, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 13/25] tests/pxe-test: Test net booting over IPv6 in some cases, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 15/25] hw/block/nvme: QOM'ify PCI NVME, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 16/25] hw/pci-host/piix: QOM'ify the IGD Passthrough host bridge, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 17/25] hw/pci-host/xilinx: QOM'ify the AXI-PCIe host bridge, Michael S. Tsirkin, 2017/12/21