ia64/xen-unstable

changeset 18459:5ce9459ce872

vtd: Enable pass-through translation for Dom0

If pass-through field in extended capability register is set, set
pass-through translation type for Dom0, that means DMA requests with
Untranslated addresses are processed as pass-through in Dom0, needn't
translate DMA requests through a multi-level page-table.

Signed-off-by: Anthony Xu <anthony.xu@intel.com>
Signed-off-by: Weidong Han <weidong.han@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Sep 09 14:50:29 2008 +0100 (2008-09-09)
parents d57e9b29858b
children 1f89af507e62
files xen/drivers/passthrough/vtd/iommu.c
line diff
     1.1 --- a/xen/drivers/passthrough/vtd/iommu.c	Tue Sep 09 14:47:36 2008 +0100
     1.2 +++ b/xen/drivers/passthrough/vtd/iommu.c	Tue Sep 09 14:50:29 2008 +0100
     1.3 @@ -1090,12 +1090,12 @@ static int domain_context_mapping_one(
     1.4      }
     1.5  
     1.6      spin_lock_irqsave(&iommu->lock, flags);
     1.7 -
     1.8 -#ifdef CONTEXT_PASSTHRU
     1.9      if ( ecap_pass_thru(iommu->ecap) && (domain->domain_id == 0) )
    1.10 +    {
    1.11          context_set_translation_type(*context, CONTEXT_TT_PASS_THRU);
    1.12 +        agaw = level_to_agaw(iommu->nr_pt_levels);
    1.13 +    }
    1.14      else
    1.15 -#endif
    1.16      {
    1.17          /* Ensure we have pagetables allocated down to leaf PTE. */
    1.18          if ( hd->pgd_maddr == 0 )
    1.19 @@ -1459,11 +1459,12 @@ int intel_iommu_map_page(
    1.20      u64 pg_maddr;
    1.21      int pte_present;
    1.22  
    1.23 -#ifdef CONTEXT_PASSTHRU
    1.24 +    drhd = list_entry(acpi_drhd_units.next, typeof(*drhd), list);
    1.25 +    iommu = drhd->iommu;
    1.26 +
    1.27      /* do nothing if dom0 and iommu supports pass thru */
    1.28      if ( ecap_pass_thru(iommu->ecap) && (d->domain_id == 0) )
    1.29          return 0;
    1.30 -#endif
    1.31  
    1.32      pg_maddr = addr_to_dma_page_maddr(d, (paddr_t)gfn << PAGE_SHIFT_4K, 1);
    1.33      if ( pg_maddr == 0 )
    1.34 @@ -1500,11 +1501,9 @@ int intel_iommu_unmap_page(struct domain
    1.35      drhd = list_entry(acpi_drhd_units.next, typeof(*drhd), list);
    1.36      iommu = drhd->iommu;
    1.37  
    1.38 -#ifdef CONTEXT_PASSTHRU
    1.39      /* do nothing if dom0 and iommu supports pass thru */
    1.40      if ( ecap_pass_thru(iommu->ecap) && (d->domain_id == 0) )
    1.41          return 0;
    1.42 -#endif
    1.43  
    1.44      dma_pte_clear_one(d, (paddr_t)gfn << PAGE_SHIFT_4K);
    1.45