ia64/xen-unstable

changeset 16452:b92239112869

vt-d: Some fixes of Intel iommu

This patch removes a wrong if condition judgement to setup rmrr
identify mapping for guests, and passes page count rather than address
size to iommu_flush_iotlb_psi().

Signed-off-by: Weidong Han <weidong.han@intel.com>
Signed-off-by: Anthony Xu <Anthony.xu@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Sat Nov 24 13:40:23 2007 +0000 (2007-11-24)
parents 483329e219c9
children 2e7fcea74cb1
files xen/arch/x86/hvm/vmx/vtd/intel-iommu.c
line diff
     1.1 --- a/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c	Sat Nov 24 13:39:13 2007 +0000
     1.2 +++ b/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c	Sat Nov 24 13:40:23 2007 +0000
     1.3 @@ -1538,7 +1538,7 @@ int iommu_page_mapping(struct domain *do
     1.4      {
     1.5          iommu = drhd->iommu;
     1.6          if ( cap_caching_mode(iommu->cap) )
     1.7 -            iommu_flush_iotlb_psi(iommu, domain->domain_id, iova, size, 0);
     1.8 +            iommu_flush_iotlb_psi(iommu, domain->domain_id, iova, index, 0);
     1.9          else if ( cap_rwbf(iommu->cap) )
    1.10              iommu_flush_write_buffer(iommu);
    1.11      }
    1.12 @@ -1726,13 +1726,11 @@ static void setup_dom0_rmrr(void)
    1.13  
    1.14      for_each_rmrr_device ( rmrr, pdev )
    1.15          ret = iommu_prepare_rmrr_dev(dom0, rmrr, pdev);
    1.16 -
    1.17 -    if ( ret )
    1.18 -        gdprintk(XENLOG_ERR VTDPREFIX,
    1.19 -                 "IOMMU: mapping reserved region failed\n");
    1.20 -
    1.21 +        if ( ret )
    1.22 +            gdprintk(XENLOG_ERR VTDPREFIX,
    1.23 +                     "IOMMU: mapping reserved region failed\n");
    1.24      end_for_each_rmrr_device ( rmrr, pdev )
    1.25 -        }
    1.26 +}
    1.27  
    1.28  int iommu_setup(void)
    1.29  {
    1.30 @@ -1798,7 +1796,6 @@ int device_assigned(u8 bus, u8 devfn)
    1.31  
    1.32  int assign_device(struct domain *d, u8 bus, u8 devfn)
    1.33  {
    1.34 -    struct hvm_iommu *hd  = domain_hvm_iommu(d);
    1.35      struct acpi_rmrr_unit *rmrr;
    1.36      struct pci_dev *pdev;
    1.37      int ret = 0;
    1.38 @@ -1813,14 +1810,17 @@ int assign_device(struct domain *d, u8 b
    1.39      reassign_device_ownership(dom0, d, bus, devfn);
    1.40  
    1.41      /* setup rmrr identify mapping just once per domain */
    1.42 -    if ( list_empty(&hd->pdev_list) )
    1.43 -        for_each_rmrr_device(rmrr, pdev)
    1.44 -            ret = iommu_prepare_rmrr_dev(d, rmrr, pdev);
    1.45 -    if ( ret )
    1.46 -        gdprintk(XENLOG_ERR VTDPREFIX,
    1.47 -                 "IOMMU: mapping reserved region failed\n");
    1.48 +    for_each_rmrr_device(rmrr, pdev)
    1.49 +        ret = iommu_prepare_rmrr_dev(d, rmrr, pdev);
    1.50 +        if ( ret )
    1.51 +        {
    1.52 +            gdprintk(XENLOG_ERR VTDPREFIX,
    1.53 +                     "IOMMU: mapping reserved region failed\n");
    1.54 +            return ret;
    1.55 +        }
    1.56      end_for_each_rmrr_device(rmrr, pdev)
    1.57 -        return ret;
    1.58 +
    1.59 +    return ret;
    1.60  }
    1.61  
    1.62  void iommu_set_pgd(struct domain *d)