summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Apfelbaum <marcel@redhat.com>2016-01-18 17:27:26 +0200
committerMichael S. Tsirkin <mst@redhat.com>2016-02-06 20:44:08 +0200
commit0144f6f1ce536b2c56a9b16ef189fc81c3bcb82f (patch)
treed170ae01685d6577579b2ec83f241b22703cbd76
parentb5c6eaf173cbeec414b2d837c5703515f979f2af (diff)
downloadqemu-0144f6f1ce536b2c56a9b16ef189fc81c3bcb82f.tar.gz
qemu-0144f6f1ce536b2c56a9b16ef189fc81c3bcb82f.tar.bz2
qemu-0144f6f1ce536b2c56a9b16ef189fc81c3bcb82f.zip
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 d940f79de0..b282120b12 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);