From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44693) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRRoz-0006Fd-1g for qemu-devel@nongnu.org; Thu, 04 Feb 2016 16:52:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aRRou-0005Fv-U4 for qemu-devel@nongnu.org; Thu, 04 Feb 2016 16:52:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33533) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRRou-0005FY-OZ for qemu-devel@nongnu.org; Thu, 04 Feb 2016 16:52:08 -0500 Date: Thu, 4 Feb 2016 23:52:04 +0200 From: "Michael S. Tsirkin" Message-ID: <1454612376-7072-18-git-send-email-mst@redhat.com> References: <1454612376-7072-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1454612376-7072-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL 17/49] hw/pci: ensure that only PCI/PCIe bridges can be attached to pxb/pxb-pcie devices List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , Peter Maydell , Eduardo Habkost From: Marcel Apfelbaum 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 Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/pci/pci.c | 7 +++++++ 1 file changed, 7 insertions(+) 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); -- MST