aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Deegan <tim@xen.org>2011-08-23 10:43:25 +0100
committerTim Deegan <tim@xen.org>2011-08-23 10:43:25 +0100
commitf056ac48ed460637fe8959ac8a8b3615fe3dac88 (patch)
treec3e5b12e93a79f600b567de1b6e350972af7f7d5
parent1b7cb0158a160365c1af526e3db31796b94b522c (diff)
downloadxen-f056ac48ed460637fe8959ac8a8b3615fe3dac88.tar.gz
xen-f056ac48ed460637fe8959ac8a8b3615fe3dac88.tar.bz2
xen-f056ac48ed460637fe8959ac8a8b3615fe3dac88.zip
IOMMU: only try to share IOMMU and HAP tables for domains with P2M.
This makes the check more precise, and brings VTd in line with AMD code. Signed-off-by: Tim Deegan <tim@xen.org> xen-unstable changeset: 23788:9d2a8912597d xen-unstable date: Tue Aug 23 10:43:25 2011 +0100
-rw-r--r--xen/drivers/passthrough/iommu.c2
-rw-r--r--xen/drivers/passthrough/vtd/iommu.c6
-rw-r--r--xen/include/xen/iommu.h3
3 files changed, 7 insertions, 4 deletions
diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index 793aa8225a..13eece0277 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -175,7 +175,7 @@ int assign_device(struct domain *d, u8 bus, u8 devfn)
if ( has_arch_pdevs(d) && !need_iommu(d) )
{
d->need_iommu = 1;
- if ( !iommu_hap_pt_share )
+ if ( !iommu_use_hap_pt(d) )
rc = iommu_populate_page_table(d);
goto done;
}
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index ae45a0de40..d614a1a725 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1622,7 +1622,7 @@ void iommu_domain_teardown(struct domain *d)
if ( list_empty(&acpi_drhd_units) )
return;
- if ( iommu_hap_pt_share )
+ if ( iommu_use_hap_pt(d) )
return;
spin_lock(&hd->mapping_lock);
@@ -1644,7 +1644,7 @@ static int intel_iommu_map_page(
int iommu_domid;
/* Do nothing if VT-d shares EPT page table */
- if ( iommu_hap_pt_share )
+ if ( iommu_use_hap_pt(d) )
return 0;
/* do nothing if dom0 and iommu supports pass thru */
@@ -1769,7 +1769,7 @@ void iommu_set_pgd(struct domain *d)
ASSERT( is_hvm_domain(d) && d->arch.hvm_domain.hap_enabled );
- if ( !iommu_hap_pt_share )
+ if ( !iommu_use_hap_pt(d) )
return;
pgd_mfn = pagetable_get_mfn(p2m_get_pagetable(p2m_get_hostp2m(d)));
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 76925b28f1..8b014c5d53 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -34,6 +34,9 @@ extern bool_t iommu_hap_pt_share;
extern bool_t amd_iommu_debug;
extern bool_t amd_iommu_perdev_intremap;
+/* Does this domain have a P2M table we can use as its IOMMU pagetable? */
+#define iommu_use_hap_pt(d) (paging_mode_hap(d) && iommu_hap_pt_share)
+
extern struct rangeset *mmio_ro_ranges;
#define domain_hvm_iommu(d) (&d->arch.hvm_domain.hvm_iommu)