summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Apfelbaum <marcel@redhat.com>2016-01-18 17:27:26 +0200
committerTimothy Pearson <tpearson@raptorengineering.com>2019-11-29 19:31:48 -0600
commit5be1340043dc3d11ab773d755e5bccab690e1920 (patch)
tree5954979ef9369193846699d0abd1637ec18fa5af
parentefef1821abe59a356abecb84d7e60b197d5316ce (diff)
downloadhqemu-5be1340043dc3d11ab773d755e5bccab690e1920.zip
hqemu-5be1340043dc3d11ab773d755e5bccab690e1920.tar.gz
hw/pci: ensure that only PCI/PCIe bridges can be attached to pxb/pxb-pcie devices
PCI devices can't be plugged directly into PCI extra root bridges because their resources can't be computed by firmware before the ACPI tables are loaded. Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-rw-r--r--hw/pci/pci.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index d940f79..b282120 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -851,6 +851,13 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
DeviceState *dev = DEVICE(pci_dev);
pci_dev->bus = bus;
+ /* Only pci bridges can be attached to extra PCI root buses */
+ if (pci_bus_is_root(bus) && bus->parent_dev && !pc->is_bridge) {
+ error_setg(errp,
+ "PCI: Only PCI/PCIe bridges can be plugged into %s",
+ bus->parent_dev->name);
+ return NULL;
+ }
if (devfn < 0) {
for(devfn = bus->devfn_min ; devfn < ARRAY_SIZE(bus->devices);
OpenPOWER on IntegriCloud