]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/xen.git/commitdiff
x86/mm: make {set,clear}_identity_p2m_mapping() work for PV guests
authorJan Beulich <jbeulich@suse.com>
Tue, 1 Sep 2015 14:51:44 +0000 (16:51 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 1 Sep 2015 14:51:44 +0000 (16:51 +0200)
Namely Dom0 suffers from commit 5ae03990c1 ("xen/vtd: create RMRR
mapping") having removed the creation of such mappings for non-
translated guests.

Reported-by: Malcolm Crossley <malcolm.crossley@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
Release-acked-by: Wei Liu <wei.liu2@citrix.com>
xen/arch/x86/mm/p2m.c

index 8fa918b827fd1a4a769befe28ba4d5cb34171927..b2726bd1e9d06aa100aec7cdfce6fba23a46a79e 100644 (file)
@@ -957,7 +957,11 @@ int set_identity_p2m_entry(struct domain *d, unsigned long gfn,
     int ret;
 
     if ( !paging_mode_translate(p2m->domain) )
-        return 0;
+    {
+        if ( !need_iommu(d) )
+            return 0;
+        return iommu_map_page(d, gfn, gfn, IOMMUF_readable|IOMMUF_writable);
+    }
 
     gfn_lock(p2m, gfn, 0);
 
@@ -1028,7 +1032,11 @@ int clear_identity_p2m_entry(struct domain *d, unsigned long gfn)
     int ret;
 
     if ( !paging_mode_translate(d) )
-        return 0;
+    {
+        if ( !need_iommu(d) )
+            return 0;
+        return iommu_unmap_page(d, gfn);
+    }
 
     gfn_lock(p2m, gfn, 0);