aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/xen/setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/xen/setup.c')
-rw-r--r--arch/x86/xen/setup.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 38fdffaa71d3..b85dceef56f7 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -182,24 +182,21 @@ char * __init xen_memory_setup(void)
182 for (i = 0; i < memmap.nr_entries; i++) { 182 for (i = 0; i < memmap.nr_entries; i++) {
183 unsigned long long end = map[i].addr + map[i].size; 183 unsigned long long end = map[i].addr + map[i].size;
184 184
185 if (map[i].type == E820_RAM) { 185 if (map[i].type == E820_RAM && end > mem_end) {
186 if (map[i].addr < mem_end && end > mem_end) { 186 /* RAM off the end - may be partially included */
187 /* Truncate region to max_mem. */ 187 u64 delta = min(map[i].size, end - mem_end);
188 u64 delta = end - mem_end;
189 188
190 map[i].size -= delta; 189 map[i].size -= delta;
191 extra_pages += PFN_DOWN(delta); 190 end -= delta;
192 191
193 end = mem_end; 192 extra_pages += PFN_DOWN(delta);
194 }
195 } 193 }
196 194
197 if (end > xen_extra_mem_start) 195 if (map[i].size > 0 && end > xen_extra_mem_start)
198 xen_extra_mem_start = end; 196 xen_extra_mem_start = end;
199 197
200 /* If region is non-RAM or below mem_end, add what remains */ 198 /* Add region if any remains */
201 if ((map[i].type != E820_RAM || map[i].addr < mem_end) && 199 if (map[i].size > 0)
202 map[i].size > 0)
203 e820_add_region(map[i].addr, map[i].size, map[i].type); 200 e820_add_region(map[i].addr, map[i].size, map[i].type);
204 } 201 }
205 202