2008-10-26 01:33:59 +02:00
|
|
|
# HG changeset patch
|
|
|
|
# User Keir Fraser <keir.fraser@citrix.com>
|
|
|
|
# Date 1220968229 -3600
|
|
|
|
# Node ID 5ce9459ce8722a8af89da5a73b0c80a767d5b1ad
|
|
|
|
# Parent d57e9b29858bddf4651efb002cfdadf978da79c0
|
|
|
|
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>
|
|
|
|
|
2008-12-05 15:30:41 +01:00
|
|
|
Index: xen-3.3.1-testing/xen/drivers/passthrough/vtd/iommu.c
|
|
|
|
===================================================================
|
|
|
|
--- xen-3.3.1-testing.orig/xen/drivers/passthrough/vtd/iommu.c
|
|
|
|
+++ xen-3.3.1-testing/xen/drivers/passthrough/vtd/iommu.c
|
|
|
|
@@ -1089,12 +1089,12 @@ static int domain_context_mapping_one(
|
2008-10-26 01:33:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
spin_lock_irqsave(&iommu->lock, flags);
|
|
|
|
-
|
|
|
|
-#ifdef CONTEXT_PASSTHRU
|
|
|
|
if ( ecap_pass_thru(iommu->ecap) && (domain->domain_id == 0) )
|
|
|
|
+ {
|
|
|
|
context_set_translation_type(*context, CONTEXT_TT_PASS_THRU);
|
|
|
|
+ agaw = level_to_agaw(iommu->nr_pt_levels);
|
|
|
|
+ }
|
|
|
|
else
|
|
|
|
-#endif
|
|
|
|
{
|
|
|
|
/* Ensure we have pagetables allocated down to leaf PTE. */
|
|
|
|
if ( hd->pgd_maddr == 0 )
|
2008-12-05 15:30:41 +01:00
|
|
|
@@ -1463,11 +1463,12 @@ int intel_iommu_map_page(
|
2008-10-26 01:33:59 +02:00
|
|
|
u64 pg_maddr;
|
|
|
|
int pte_present;
|
|
|
|
|
|
|
|
-#ifdef CONTEXT_PASSTHRU
|
|
|
|
+ drhd = list_entry(acpi_drhd_units.next, typeof(*drhd), list);
|
|
|
|
+ iommu = drhd->iommu;
|
|
|
|
+
|
|
|
|
/* do nothing if dom0 and iommu supports pass thru */
|
|
|
|
if ( ecap_pass_thru(iommu->ecap) && (d->domain_id == 0) )
|
|
|
|
return 0;
|
|
|
|
-#endif
|
|
|
|
|
|
|
|
pg_maddr = addr_to_dma_page_maddr(d, (paddr_t)gfn << PAGE_SHIFT_4K, 1);
|
|
|
|
if ( pg_maddr == 0 )
|
2008-12-05 15:30:41 +01:00
|
|
|
@@ -1504,11 +1505,9 @@ int intel_iommu_unmap_page(struct domain
|
2008-10-26 01:33:59 +02:00
|
|
|
drhd = list_entry(acpi_drhd_units.next, typeof(*drhd), list);
|
|
|
|
iommu = drhd->iommu;
|
|
|
|
|
|
|
|
-#ifdef CONTEXT_PASSTHRU
|
|
|
|
/* do nothing if dom0 and iommu supports pass thru */
|
|
|
|
if ( ecap_pass_thru(iommu->ecap) && (d->domain_id == 0) )
|
|
|
|
return 0;
|
|
|
|
-#endif
|
|
|
|
|
|
|
|
dma_pte_clear_one(d, (paddr_t)gfn << PAGE_SHIFT_4K);
|
|
|
|
|