aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorDavid Vrabel <david.vrabel@citrix.com>2013-08-16 10:42:55 -0400
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2013-08-20 09:46:06 -0400
commit3bc38cbceb85881a8eb789ee1aa56678038b1909 (patch)
tree1f322bdfa670b53764fe934eb8509c38c121b563 /arch/x86
parent0d7febe58413884f6428143221971618fbf3a47d (diff)
x86/xen: do not identity map UNUSABLE regions in the machine E820
If there are UNUSABLE regions in the machine memory map, dom0 will attempt to map them 1:1 which is not permitted by Xen and the kernel will crash. There isn't anything interesting in the UNUSABLE region that the dom0 kernel needs access to so we can avoid making the 1:1 mapping and treat it as RAM. We only do this for dom0, as that is where tboot case shows up. A PV domU could have an UNUSABLE region in its pseudo-physical map and would need to be handled in another patch. This fixes a boot failure on hosts with tboot. tboot marks a region in the e820 map as unusable and the dom0 kernel would attempt to map this region and Xen does not permit unusable regions to be mapped by guests. (XEN) 0000000000000000 - 0000000000060000 (usable) (XEN) 0000000000060000 - 0000000000068000 (reserved) (XEN) 0000000000068000 - 000000000009e000 (usable) (XEN) 0000000000100000 - 0000000000800000 (usable) (XEN) 0000000000800000 - 0000000000972000 (unusable) tboot marked this region as unusable. (XEN) 0000000000972000 - 00000000cf200000 (usable) (XEN) 00000000cf200000 - 00000000cf38f000 (reserved) (XEN) 00000000cf38f000 - 00000000cf3ce000 (ACPI data) (XEN) 00000000cf3ce000 - 00000000d0000000 (reserved) (XEN) 00000000e0000000 - 00000000f0000000 (reserved) (XEN) 00000000fe000000 - 0000000100000000 (reserved) (XEN) 0000000100000000 - 0000000630000000 (usable) Signed-off-by: David Vrabel <david.vrabel@citrix.com> [v1: Altered the patch and description with domU's with UNUSABLE regions] Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/xen/setup.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 94eac5c85cdc..0a9fb7a0b452 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -313,6 +313,17 @@ static void xen_align_and_add_e820_region(u64 start, u64 size, int type)
313 e820_add_region(start, end - start, type); 313 e820_add_region(start, end - start, type);
314} 314}
315 315
316void xen_ignore_unusable(struct e820entry *list, size_t map_size)
317{
318 struct e820entry *entry;
319 unsigned int i;
320
321 for (i = 0, entry = list; i < map_size; i++, entry++) {
322 if (entry->type == E820_UNUSABLE)
323 entry->type = E820_RAM;
324 }
325}
326
316/** 327/**
317 * machine_specific_memory_setup - Hook for machine specific memory setup. 328 * machine_specific_memory_setup - Hook for machine specific memory setup.
318 **/ 329 **/
@@ -353,6 +364,17 @@ char * __init xen_memory_setup(void)
353 } 364 }
354 BUG_ON(rc); 365 BUG_ON(rc);
355 366
367 /*
368 * Xen won't allow a 1:1 mapping to be created to UNUSABLE
369 * regions, so if we're using the machine memory map leave the
370 * region as RAM as it is in the pseudo-physical map.
371 *
372 * UNUSABLE regions in domUs are not handled and will need
373 * a patch in the future.
374 */
375 if (xen_initial_domain())
376 xen_ignore_unusable(map, memmap.nr_entries);
377
356 /* Make sure the Xen-supplied memory map is well-ordered. */ 378 /* Make sure the Xen-supplied memory map is well-ordered. */
357 sanitize_e820_map(map, memmap.nr_entries, &memmap.nr_entries); 379 sanitize_e820_map(map, memmap.nr_entries, &memmap.nr_entries);
358 380