[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] VT-d: fix device assignment failure (regression from Xen c/s 19805:2f1fa2215e60)



# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1288772331 0
# Node ID 2dfba250c50bafac4e333d84450324daedf5ae2c
# Parent  16093532f384eee02518520662a38ad16915b063
VT-d: fix device assignment failure (regression from Xen c/s 19805:2f1fa2215e60)

If the device at <secbus>:00.0 is the device the mapping operation was
initiated for, trying to map it a second time will fail, and hence
this second mapping attempt must be prevented (as was done prior to
said c/s).

While at it, simplify the code a little, too.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
Acked-by: Weidong Han <weidong.han@xxxxxxxxx>
---
 xen/drivers/passthrough/vtd/iommu.c |   25 +++++++++----------------
 1 files changed, 9 insertions(+), 16 deletions(-)

diff -r 16093532f384 -r 2dfba250c50b xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c       Wed Nov 03 08:17:39 2010 +0000
+++ b/xen/drivers/passthrough/vtd/iommu.c       Wed Nov 03 08:18:51 2010 +0000
@@ -1403,23 +1403,16 @@ static int domain_context_mapping(struct
         if ( find_upstream_bridge(&bus, &devfn, &secbus) < 1 )
             break;
 
-        /* PCIe to PCI/PCIx bridge */
-        if ( pdev_type(bus, devfn) == DEV_TYPE_PCIe2PCI_BRIDGE )
-        {
-            ret = domain_context_mapping_one(domain, drhd->iommu, bus, devfn);
-            if ( ret )
-                return ret;
-
-            /*
-             * Devices behind PCIe-to-PCI/PCIx bridge may generate
-             * different requester-id. It may originate from devfn=0
-             * on the secondary bus behind the bridge. Map that id
-             * as well.
-             */
+        ret = domain_context_mapping_one(domain, drhd->iommu, bus, devfn);
+
+        /*
+         * Devices behind PCIe-to-PCI/PCIx bridge may generate different
+         * requester-id. It may originate from devfn=0 on the secondary bus
+         * behind the bridge. Map that id as well if we didn't already.
+         */
+        if ( !ret && pdev_type(bus, devfn) == DEV_TYPE_PCIe2PCI_BRIDGE &&
+             (secbus != pdev->bus || pdev->devfn != 0) )
             ret = domain_context_mapping_one(domain, drhd->iommu, secbus, 0);
-        }
-        else /* Legacy PCI bridge */
-            ret = domain_context_mapping_one(domain, drhd->iommu, bus, devfn);
 
         break;
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.