mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
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@novell.com> Acked-by: Weidong Han <weidong.han@intel.com> xen-unstable changeset: 22348:2dfba250c50b xen-unstable date: Wed Nov 03 08:18:51 2010 +0000
This commit is contained in:
1 parent
951a434ca4
commit
e46ffd24d0
1 file changed
+8
-15
@@ -1367,23 +1367,16 @@ static int domain_context_mapping(struct domain *domain, u8 bus, u8 devfn)
|
||||
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;
|
||||
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.
|
||||
*/
|
||||
/*
|
||||
* 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;
|
||||
|
||||
|
||||