ia64/xen-unstable

changeset 16672:c0a9b8ab631c

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>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Dec 28 15:26:27 2007 +0000 (2007-12-28)
parents 19f549449cb5
children 62c38443e9f7
files xen/arch/x86/hvm/vmx/vtd/intel-iommu.c
line diff
     1.1 --- a/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c	Fri Dec 28 15:23:28 2007 +0000
     1.2 +++ b/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c	Fri Dec 28 15:26:27 2007 +0000
     1.3 @@ -1866,14 +1866,17 @@ int assign_device(struct domain *d, u8 b
     1.4  
     1.5      reassign_device_ownership(dom0, d, bus, devfn);
     1.6  
     1.7 -    /* setup rmrr identify mapping just once per domain */
     1.8 -    for_each_rmrr_device(rmrr, pdev)
     1.9 -        ret = iommu_prepare_rmrr_dev(d, rmrr, pdev);
    1.10 -        if ( ret )
    1.11 +    /* Setup rmrr identify mapping */
    1.12 +    for_each_rmrr_device( rmrr, pdev )
    1.13 +        if ( pdev->bus == bus && pdev->devfn == devfn )
    1.14          {
    1.15 -            gdprintk(XENLOG_ERR VTDPREFIX,
    1.16 -                     "IOMMU: mapping reserved region failed\n");
    1.17 -            return ret;
    1.18 +            ret = iommu_prepare_rmrr_dev(d, rmrr, pdev);
    1.19 +            if ( ret )
    1.20 +            {
    1.21 +                gdprintk(XENLOG_ERR VTDPREFIX,
    1.22 +                         "IOMMU: mapping reserved region failed\n");
    1.23 +                return ret;
    1.24 +            }
    1.25          }
    1.26      end_for_each_rmrr_device(rmrr, pdev)
    1.27