x86: Ensure RAM holes really are not mapped in Xen's ongoing 1:1 physmap.
authorKeir Fraser <keir.fraser@citrix.com>
Fri, 25 Jan 2008 16:26:31 +0000 (16:26 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Fri, 25 Jan 2008 16:26:31 +0000 (16:26 +0000)
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
xen/arch/x86/mm.c

index 94dd590cd096ed4be4deb46faff3f6d1d7d3c3ee..177ba93a7a4915e123008b738e3c1c4e331c4643 100644 (file)
@@ -207,7 +207,7 @@ void __init arch_init_memory(void)
 {
     extern void subarch_init_memory(void);
 
-    unsigned long i, pfn, rstart_pfn, rend_pfn;
+    unsigned long i, pfn, rstart_pfn, rend_pfn, ioend_pfn;
 
     /*
      * Initialise our DOMID_XEN domain.
@@ -251,6 +251,20 @@ void __init arch_init_memory(void)
                                PFN_DOWN(e820.map[i].addr + e820.map[i].size));
         }
 
+        /*
+         * Make sure any Xen mappings are blown away.
+         * In particular this ensures that RAM holes are respected even in
+         * the statically-initialised 0-16MB mapping area.
+         */
+        ioend_pfn = rstart_pfn;
+#if defined(CONFIG_X86_32)
+        ioend_pfn = min_t(unsigned long, ioend_pfn,
+                          DIRECTMAP_MBYTES << (20 - PAGE_SHIFT));
+#endif
+        if ( pfn < ioend_pfn )            
+            destroy_xen_mappings((unsigned long)mfn_to_virt(pfn),
+                                 (unsigned long)mfn_to_virt(ioend_pfn));
+
         /* Mark as I/O up to next RAM region. */
         for ( ; pfn < rstart_pfn; pfn++ )
         {
@@ -3901,13 +3915,13 @@ void destroy_xen_mappings(unsigned long s, unsigned long e)
             {
                 /* Empty: zap the L2E and free the L1 page. */
                 l2e_write_atomic(pl2e, l2e_empty());
-                flush_all(FLUSH_TLB_GLOBAL); /* flush before free */
+                flush_area(NULL, FLUSH_TLB_GLOBAL); /* flush before free */
                 free_xen_pagetable(pl1e);
             }
         }
     }
 
-    flush_all(FLUSH_TLB_GLOBAL);
+    flush_area(NULL, FLUSH_TLB_GLOBAL);
 }
 
 void __set_fixmap(