]> xenbits.xensource.com Git - xen.git/commitdiff
x86/PVH: allow guest_remove_page to remove p2m_mmio_direct pages
authorRoger Pau Monné <roger.pau@citrix.com>
Fri, 20 Jun 2014 08:38:07 +0000 (10:38 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 20 Jun 2014 08:38:07 +0000 (10:38 +0200)
IF a guest tries to do a foreign/grant mapping in a memory region
marked as p2m_mmio_direct Xen will complain with the following
message:

(XEN) memory.c:241:d0v0 Bad page free for domain 0

Albeit the mapping will succeed. This is specially problematic for PVH
Dom0, in which we map all the e820 holes and memory up to 4GB as
p2m_mmio_direct.

In order to deal with it, add a special casing for p2m_mmio_direct
regions in guest_remove_page if the domain is a hardware domain, that
calls clear_mmio_p2m_entry in order to remove the mappings.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
xen/common/memory.c

index 257f4b03defd87f6d0e7e5f151e881dcd630fd3e..c2dd31bd0d70f4fc2bcab441444bf92683891790 100644 (file)
@@ -204,6 +204,12 @@ int guest_remove_page(struct domain *d, unsigned long gmfn)
         p2m_mem_paging_drop_page(d, gmfn, p2mt);
         return 1;
     }
+    if ( p2mt == p2m_mmio_direct )
+    {
+        clear_mmio_p2m_entry(d, gmfn);
+        put_gfn(d, gmfn);
+        return 1;
+    }
 #else
     mfn = gmfn_to_mfn(d, gmfn);
 #endif