]> xenbits.xensource.com Git - people/liuw/xen.git/commitdiff
x86/dom0: allow stealing RAM from a region that starts in the low 1MB
authorRoger Pau Monne <roger.pau@citrix.com>
Thu, 27 Dec 2018 15:26:35 +0000 (16:26 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 27 Dec 2018 19:46:46 +0000 (19:46 +0000)
As long as the memory stolen is always above 1MB. This allows the PVH
Dom0 builder to be used on a memory map that only has a single RAM
region starting at 0.

Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Tested-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/hvm/dom0_build.c

index 91dc27dc3eb56efa227408e2ab24bce45e544ad8..24cc15f28be8824d7207129d49cff587fdbec3f5 100644 (file)
@@ -154,12 +154,13 @@ static int __init pvh_steal_ram(struct domain *d, unsigned long size,
     {
         struct e820entry *entry = &d->arch.e820[i];
 
-        if ( entry->type != E820_RAM || entry->addr + entry->size > limit ||
-             entry->addr < MB(1) )
+        if ( entry->type != E820_RAM || entry->addr + entry->size > limit )
             continue;
 
         *addr = (entry->addr + entry->size - size) & ~(align - 1);
-        if ( *addr < entry->addr )
+        if ( *addr < entry->addr ||
+             /* Don't steal from the low 1MB due to the copying done there. */
+             *addr < MB(1) )
             continue;
 
         entry->size = *addr - entry->addr;