guest/pvh: special case the low 1MB
authorRoger Pau Monné <roger.pau@citrix.com>
Mon, 12 Nov 2018 16:14:57 +0000 (17:14 +0100)
committerJan Beulich <jbeulich@suse.com>
Mon, 12 Nov 2018 16:14:57 +0000 (17:14 +0100)
When running as a PVH guest Xen only special cases the trampoline
code in the low 1MB, without also reserving the space used by the
relocated metadata or the trampoline stack.

Fix this by always reserving the low 1MB regardless of whether Xen is
running as a guest or natively.

Reported-by: Sergey Dyasli <sergey.dyasli@citrix.com>
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
xen/arch/x86/mm.c

index 2c450cc2082849ca55e9ee5b33ad04efba4739e5..16c7d88a8e577e021aedb9fa8208a904d68e5599 100644 (file)
@@ -291,16 +291,13 @@ void __init arch_init_memory(void)
     BUG_ON(IS_ERR(dom_cow));
 
     /*
-     * First 1MB of RAM is historically marked as I/O.  If we booted PVH,
-     * reclaim the space.  Irrespective, leave MFN 0 as special for the sake
-     * of 0 being a very common default value. Also reserve the RAM needed by
-     * the trampoline on PVH starting at MFN 1.
+     * First 1MB of RAM is historically marked as I/O.
+     * Note that apart from IO Xen also uses the low 1MB to store the AP boot
+     * trampoline and boot information metadata. Due to this always special
+     * case the low 1MB.
      */
     BUG_ON(pvh_boot && trampoline_phys != 0x1000);
-    for ( i = 0;
-          i < (pvh_boot ? (1 + PFN_UP(trampoline_end - trampoline_start))
-                        : 0x100);
-          i++ )
+    for ( i = 0; i < 0x100; i++ )
         share_xen_page_with_guest(mfn_to_page(_mfn(i)), dom_io, SHARE_rw);
 
     /* Any areas not specified as RAM by the e820 map are considered I/O. */