From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38711) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLE8a-00014u-W6 for qemu-devel@nongnu.org; Mon, 18 Jan 2016 13:02:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aLE8W-0002Lz-VI for qemu-devel@nongnu.org; Mon, 18 Jan 2016 13:02:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59821) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLE8W-0002Lt-PQ for qemu-devel@nongnu.org; Mon, 18 Jan 2016 13:02:40 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 648A7C077547 for ; Mon, 18 Jan 2016 18:02:40 +0000 (UTC) References: <1453130846-14064-1-git-send-email-marcel@redhat.com> From: Laszlo Ersek Message-ID: <569D28BE.90808@redhat.com> Date: Mon, 18 Jan 2016 19:02:38 +0100 MIME-Version: 1.0 In-Reply-To: <1453130846-14064-1-git-send-email-marcel@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] 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: Marcel Apfelbaum , qemu-devel@nongnu.org Cc: mst@redhat.com On 01/18/16 16:27, Marcel Apfelbaum wrote: > 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 > --- > > Hi, > > This patch follows the discussion: > https://lists.gnu.org/archive/html/qemu-devel/2016-01/msg01484.html > > Thanks, > Marcel > > hw/pci/pci.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/hw/pci/pci.c b/hw/pci/pci.c > index 168b9cc..584f504 100644 > --- a/hw/pci/pci.c > +++ b/hw/pci/pci.c > @@ -850,6 +850,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); > Looks sensible to me (and the commit message actually enlightens me a bit :)), but you could very easily trick me in this area, so I'll leave formal review to others. :) Laszlo