]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
x86/e820: do not fixup memmap in copy_e820_map
authorRoger Pau Monne <roger.pau@citrix.com>
Thu, 27 Dec 2018 14:48:40 +0000 (15:48 +0100)
committerRoger Pau Monne <roger.pau@citrix.com>
Thu, 27 Dec 2018 14:48:40 +0000 (15:48 +0100)
And instead introduce a new helper to mark the low 1MB VGA/ROM region
as reserved. Note this might be a slight change from current functionality
where copy_e820_map would just leave a hole in the [640KB, 1MB) region
if it was found to be reported as RAM in the memory map.

No functional change expected overall.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
xen/arch/x86/e820.c

index 2b03c56b93acbff1a8b7dd6ff756ac47ea706b80..7c5b85118ff7e821352f515066e7f8e377078b25 100644 (file)
@@ -320,20 +320,6 @@ static int __init copy_e820_map(struct e820entry * biosmap, int nr_map)
         if (start > end)
             return -1;
 
-        /*
-         * Some BIOSes claim RAM in the 640k - 1M region.
-         * Not right. Fix it up.
-         */
-        if (type == E820_RAM) {
-            if (start < 0x100000ULL && end > 0xA0000ULL) {
-                if (start < 0xA0000ULL)
-                    add_memory_region(start, 0xA0000ULL-start, type);
-                if (end <= 0x100000ULL)
-                    continue;
-                start = 0x100000ULL;
-                size = end - start;
-            }
-        }
         add_memory_region(start, size, type);
     } while (biosmap++,--nr_map);
     return 0;
@@ -510,6 +496,12 @@ static void __init reserve_dmi_region(void)
     }
 }
 
+static void __init reserve_vga_region(void)
+{
+    /* Remove any RAM regions from the VGA hole. */
+    e820_remove_range(&e820, KB(640), MB(1) - 1, E820_RAM, true);
+}
+
 static void __init machine_specific_memory_setup(struct e820map *raw)
 {
     unsigned long mpt_limit, ro_mpt_limit;
@@ -545,6 +537,12 @@ static void __init machine_specific_memory_setup(struct e820map *raw)
 
     reserve_dmi_region();
 
+    /*
+     * Some BIOSes claim RAM in the 640k - 1M region.
+     * Not right. Fix it up.
+     */
+    reserve_vga_region();
+
     top_of_ram = mtrr_top_of_ram();
     if ( top_of_ram )
         clip_to_limit(top_of_ram, "MTRRs do not cover all of memory.");