[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen stable-4.7] x86/EFI: avoid Xen image when looking for module/kexec position



commit 4a1dc280b8c619f2558b7456cafb8d028c3b94e5
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Fri Mar 31 08:56:26 2017 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri Mar 31 08:56:26 2017 +0200

    x86/EFI: avoid Xen image when looking for module/kexec position
    
    When booting straight from EFI, we don't further try to relocate Xen.
    As a result, so far we also didn't avoid the area Xen uses when looking
    for a location to put modules or the kexec area. Introduce a fake
    module slot to deal with that without having to fiddle with a lot of
    code.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    master commit: e22e1c47958a4778cd7baa3980f74e52f525ba28
    master date: 2017-03-20 09:27:12 +0100
---
 xen/arch/x86/efi/efi-boot.h |  6 +++++-
 xen/arch/x86/setup.c        | 22 +++++++++++++++++-----
 2 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h
index 97bb3a0..11ab290 100644
--- a/xen/arch/x86/efi/efi-boot.h
+++ b/xen/arch/x86/efi/efi-boot.h
@@ -13,7 +13,11 @@ static struct file __initdata ucode;
 static multiboot_info_t __initdata mbi = {
     .flags = MBI_MODULES | MBI_LOADERNAME
 };
-static module_t __initdata mb_modules[4];
+/*
+ * The array size needs to be one larger than the number of modules we
+ * support - see __start_xen().
+ */
+static module_t __initdata mb_modules[5];
 
 static void __init edd_put_string(u8 *dst, size_t n, const char *src)
 {
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index c5b39da..d59aceb 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -845,6 +845,17 @@ void __init noreturn __start_xen(unsigned long mbi_p)
         mod[i].reserved = 0;
     }
 
+    if ( efi_enabled )
+    {
+        /*
+         * This needs to remain in sync with xen_in_range() and the
+         * respective reserve_e820_ram() invocation below.
+         */
+        mod[mbi->mods_count].mod_start = PFN_DOWN(mbi->mem_upper);
+        mod[mbi->mods_count].mod_end = __pa(__2M_rwdata_end) -
+                                       (mbi->mem_upper & PAGE_MASK);
+    }
+
     modules_headroom = bzimage_headroom(bootstrap_map(mod), mod->mod_end);
     bootstrap_map(NULL);
 
@@ -1025,8 +1036,9 @@ void __init noreturn __start_xen(unsigned long mbi_p)
             if ( mod[j].reserved )
                 continue;
 
-            /* Don't overlap with other modules. */
-            end = consider_modules(s, e, size, mod, mbi->mods_count, j);
+            /* Don't overlap with other modules (or Xen itself). */
+            end = consider_modules(s, e, size, mod,
+                                   mbi->mods_count + efi_enabled, j);
 
             if ( highmem_start && end > highmem_start )
                 continue;
@@ -1045,9 +1057,9 @@ void __init noreturn __start_xen(unsigned long mbi_p)
         }
 
 #ifdef CONFIG_KEXEC
-        /* Don't overlap with modules. */
-        e = consider_modules(s, e, PAGE_ALIGN(kexec_crash_area.size),
-                             mod, mbi->mods_count, -1);
+        /* Don't overlap with modules (or Xen itself). */
+        e = consider_modules(s, e, PAGE_ALIGN(kexec_crash_area.size), mod,
+                             mbi->mods_count + efi_enabled, -1);
         if ( !kexec_crash_area.start && (s < e) )
         {
             e = (e - kexec_crash_area.size) & PAGE_MASK;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.7

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.