aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2007-12-28 15:26:27 +0000
committerKeir Fraser <keir.fraser@citrix.com>2007-12-28 15:26:27 +0000
commite6bf9545fdafebfce3559fc84aa05382eb9285b6 (patch)
treedb85c1a376ff924a46ce205255bf44ae6ac4fdb8
parent8f8a3b56592acf31ffcbf6b6747e247dd53da355 (diff)
downloadxen-e6bf9545fdafebfce3559fc84aa05382eb9285b6.tar.gz
xen-e6bf9545fdafebfce3559fc84aa05382eb9285b6.tar.bz2
xen-e6bf9545fdafebfce3559fc84aa05382eb9285b6.zip
vt-d: Only setup rmrr identity mappings of the assigned devices
Current implementation setups identity mappings for all the rmrrs whether the assigned device has rmrr or not. It's wasteful and not necessary, because only USB controllers and UMA integarated graphics devices have rmrr. This patch only setups rmrr identity mappings of the assigned devices. If the assigned devices don't have rmrr, needn't to setup rmrr identity mapping for guest. BTW, this patch fixes the VT-d bug (Fail to boot smp Linux guest with VT-d NIC assigned on IA32e platform). Signed-off-by: Weidong Han <weidong.han@intel.com>
-rw-r--r--xen/arch/x86/hvm/vmx/vtd/intel-iommu.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c b/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c
index 239239ed8e..29f8f195de 100644
--- a/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c
+++ b/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c
@@ -1866,14 +1866,17 @@ int assign_device(struct domain *d, u8 bus, u8 devfn)
reassign_device_ownership(dom0, d, bus, devfn);
- /* setup rmrr identify mapping just once per domain */
- for_each_rmrr_device(rmrr, pdev)
- ret = iommu_prepare_rmrr_dev(d, rmrr, pdev);
- if ( ret )
+ /* Setup rmrr identify mapping */
+ for_each_rmrr_device( rmrr, pdev )
+ if ( pdev->bus == bus && pdev->devfn == devfn )
{
- gdprintk(XENLOG_ERR VTDPREFIX,
- "IOMMU: mapping reserved region failed\n");
- return ret;
+ ret = iommu_prepare_rmrr_dev(d, rmrr, pdev);
+ if ( ret )
+ {
+ gdprintk(XENLOG_ERR VTDPREFIX,
+ "IOMMU: mapping reserved region failed\n");
+ return ret;
+ }
}
end_for_each_rmrr_device(rmrr, pdev)