From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=34079 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PfoSo-0002kg-Ew for qemu-devel@nongnu.org; Thu, 20 Jan 2011 01:57:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PfoSm-0005Ne-Gp for qemu-devel@nongnu.org; Thu, 20 Jan 2011 01:57:46 -0500 Received: from mail.valinux.co.jp ([210.128.90.3]:48179) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PfoSm-0005N3-7f for qemu-devel@nongnu.org; Thu, 20 Jan 2011 01:57:44 -0500 From: Isaku Yamahata Date: Thu, 20 Jan 2011 15:57:39 +0900 Message-Id: Subject: [Qemu-devel] [PATCH] pci/pcie: make pci_find_device() ARI aware. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: yamahata@valinux.co.jp, mst@redhat.com make pci_find_device() ARI aware. Signed-off-by: Isaku Yamahata --- hw/pci.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index 8d0e3df..851f350 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -1596,11 +1596,18 @@ PCIBus *pci_find_bus(PCIBus *bus, int bus_num) PCIDevice *pci_find_device(PCIBus *bus, int bus_num, int slot, int function) { + PCIDevice *d; bus = pci_find_bus(bus, bus_num); if (!bus) return NULL; + d = bus->parent_dev; + if (d && pci_is_express(d) && + pcie_cap_get_type(d) == PCI_EXP_TYPE_DOWNSTREAM && + !pcie_cap_is_ari_enabled(d) && slot > 0) { + return NULL; + } return bus->devices[PCI_DEVFN(slot, function)]; } -- 1.7.1.1