]> Git Repo - qemu.git/commitdiff
hw/pci: ensure that only PCI/PCIe bridges can be attached to pxb/pxb-pcie devices
authorMarcel Apfelbaum <[email protected]>
Mon, 18 Jan 2016 15:27:26 +0000 (17:27 +0200)
committerMichael S. Tsirkin <[email protected]>
Sat, 6 Feb 2016 18:44:08 +0000 (20:44 +0200)
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 <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
hw/pci/pci.c

index d940f79de0c144cdffa76a56c3e408ba5ce91b68..b282120b1286451b8fb8f58042e59034f9bdb4cd 100644 (file)
@@ -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);
This page took 0.034213 seconds and 4 git commands to generate.