]> xenbits.xensource.com Git - people/gdunlap/xen.git/commitdiff
iommu: fix usage of shared EPT/IOMMU page tables on PVH guests
authorRoger Pau Monné <roger.pau@citrix.com>
Mon, 9 Mar 2015 13:01:40 +0000 (14:01 +0100)
committerJan Beulich <jbeulich@suse.com>
Mon, 9 Mar 2015 13:01:40 +0000 (14:01 +0100)
iommu_share_p2m_table should not prevent PVH guests from using a shared page
table between the IOMMU and EPT. Clean the code by removing the asserts in
the vendor specific implementations (amd_iommu_share_p2m, iommu_set_pgd),
and moving the hap_enabled assert to the caller (iommu_share_p2m_table).

Also fix another incorrect usage of is_hvm_domain usage in
arch_iommu_populate_page_table. This has not given problems so far because
all the pages in PVH guests are of type PGT_writable_page.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Tested-by: David Vrabel <david.vrabel@citrix.com>
Reviewed-by: Tim Deegan <tim@xen.org>
Acked-by: Kevin Tian <kevin.tian@intel.com>
xen/drivers/passthrough/amd/iommu_map.c
xen/drivers/passthrough/iommu.c
xen/drivers/passthrough/vtd/iommu.c
xen/drivers/passthrough/x86/iommu.c

index a8c60ec57beed61f30ba2ec77c161351d555ba2d..31dc05d92087ab1931cede44b7f30615884dfdc6 100644 (file)
@@ -785,8 +785,6 @@ void amd_iommu_share_p2m(struct domain *d)
     struct page_info *p2m_table;
     mfn_t pgd_mfn;
 
-    ASSERT( is_hvm_domain(d) && d->arch.hvm_domain.hap_enabled );
-
     if ( !iommu_use_hap_pt(d) )
         return;
 
index cc12735813a173646b42edd74d46940f91d2b1e6..7fcbbb1f86363b775565833e0aac64aef214ab1a 100644 (file)
@@ -332,7 +332,8 @@ void iommu_share_p2m_table(struct domain* d)
 {
     const struct iommu_ops *ops = iommu_get_ops();
 
-    if ( iommu_enabled && is_hvm_domain(d) )
+    ASSERT( hap_enabled(d) );
+    if ( iommu_enabled )
         ops->share_p2m(d);
 }
 
index 1063677dce9c40d81336df1d74bfaeb997292fe9..48676c5b5359af77eb51a19a7d3c3a02ceaa8025 100644 (file)
@@ -1789,8 +1789,6 @@ static void iommu_set_pgd(struct domain *d)
     struct hvm_iommu *hd  = domain_hvm_iommu(d);
     mfn_t pgd_mfn;
 
-    ASSERT( is_hvm_domain(d) && d->arch.hvm_domain.hap_enabled );
-
     if ( !iommu_use_hap_pt(d) )
         return;
 
index 52d89482b89091d51de78f0814990a7ec60ea1c9..9eb8d33db1627832786188a4e6b9f5aad13cfe32 100644 (file)
@@ -56,7 +56,7 @@ int arch_iommu_populate_page_table(struct domain *d)
 
     while ( !rc && (page = page_list_remove_head(&d->page_list)) )
     {
-        if ( is_hvm_domain(d) ||
+        if ( has_hvm_container_domain(d) ||
             (page->u.inuse.type_info & PGT_type_mask) == PGT_writable_page )
         {
             BUG_ON(SHARED_M2P(mfn_to_gmfn(d, page_to_mfn(page))));