diff options
author | Yinghai Lu <yinghai@kernel.org> | 2009-06-04 22:14:22 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2009-06-11 18:19:13 -0400 |
commit | 8c5dd8f43367f4f266dd616f11658005bc2d20ef (patch) | |
tree | 331d4e75f41cdc8acee8c3d9eedee8b3e41a1608 | |
parent | 512626a04e72aca60effe111fa0333ed0b195d21 (diff) |
x86: handle initrd that extends into unusable memory
On a system where system memory (according e820) is not covered by
mtrr, mtrr_trim_memory converts a portion of memory to reserved, but
bootloader has already put the initrd in that range.
Thus, we need to have 64bit to use relocate_initrd too.
[ Impact: fix using initrd when mtrr_trim_memory happen ]
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: stable@kernel.org
-rw-r--r-- | arch/x86/kernel/setup.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index d1c636bf31a7..be5ae80f897f 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -301,15 +301,13 @@ static void __init reserve_brk(void) | |||
301 | 301 | ||
302 | #ifdef CONFIG_BLK_DEV_INITRD | 302 | #ifdef CONFIG_BLK_DEV_INITRD |
303 | 303 | ||
304 | #ifdef CONFIG_X86_32 | ||
305 | |||
306 | #define MAX_MAP_CHUNK (NR_FIX_BTMAPS << PAGE_SHIFT) | 304 | #define MAX_MAP_CHUNK (NR_FIX_BTMAPS << PAGE_SHIFT) |
307 | static void __init relocate_initrd(void) | 305 | static void __init relocate_initrd(void) |
308 | { | 306 | { |
309 | 307 | ||
310 | u64 ramdisk_image = boot_params.hdr.ramdisk_image; | 308 | u64 ramdisk_image = boot_params.hdr.ramdisk_image; |
311 | u64 ramdisk_size = boot_params.hdr.ramdisk_size; | 309 | u64 ramdisk_size = boot_params.hdr.ramdisk_size; |
312 | u64 end_of_lowmem = max_low_pfn << PAGE_SHIFT; | 310 | u64 end_of_lowmem = max_low_pfn_mapped << PAGE_SHIFT; |
313 | u64 ramdisk_here; | 311 | u64 ramdisk_here; |
314 | unsigned long slop, clen, mapaddr; | 312 | unsigned long slop, clen, mapaddr; |
315 | char *p, *q; | 313 | char *p, *q; |
@@ -365,14 +363,13 @@ static void __init relocate_initrd(void) | |||
365 | ramdisk_image, ramdisk_image + ramdisk_size - 1, | 363 | ramdisk_image, ramdisk_image + ramdisk_size - 1, |
366 | ramdisk_here, ramdisk_here + ramdisk_size - 1); | 364 | ramdisk_here, ramdisk_here + ramdisk_size - 1); |
367 | } | 365 | } |
368 | #endif | ||
369 | 366 | ||
370 | static void __init reserve_initrd(void) | 367 | static void __init reserve_initrd(void) |
371 | { | 368 | { |
372 | u64 ramdisk_image = boot_params.hdr.ramdisk_image; | 369 | u64 ramdisk_image = boot_params.hdr.ramdisk_image; |
373 | u64 ramdisk_size = boot_params.hdr.ramdisk_size; | 370 | u64 ramdisk_size = boot_params.hdr.ramdisk_size; |
374 | u64 ramdisk_end = ramdisk_image + ramdisk_size; | 371 | u64 ramdisk_end = ramdisk_image + ramdisk_size; |
375 | u64 end_of_lowmem = max_low_pfn << PAGE_SHIFT; | 372 | u64 end_of_lowmem = max_low_pfn_mapped << PAGE_SHIFT; |
376 | 373 | ||
377 | if (!boot_params.hdr.type_of_loader || | 374 | if (!boot_params.hdr.type_of_loader || |
378 | !ramdisk_image || !ramdisk_size) | 375 | !ramdisk_image || !ramdisk_size) |
@@ -402,14 +399,8 @@ static void __init reserve_initrd(void) | |||
402 | return; | 399 | return; |
403 | } | 400 | } |
404 | 401 | ||
405 | #ifdef CONFIG_X86_32 | ||
406 | relocate_initrd(); | 402 | relocate_initrd(); |
407 | #else | 403 | |
408 | printk(KERN_ERR "initrd extends beyond end of memory " | ||
409 | "(0x%08llx > 0x%08llx)\ndisabling initrd\n", | ||
410 | ramdisk_end, end_of_lowmem); | ||
411 | initrd_start = 0; | ||
412 | #endif | ||
413 | free_early(ramdisk_image, ramdisk_end); | 404 | free_early(ramdisk_image, ramdisk_end); |
414 | } | 405 | } |
415 | #else | 406 | #else |