diff options
author | Bernhard Walle <bwalle@suse.de> | 2008-06-20 09:38:22 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-08 06:45:44 -0400 |
commit | 1ecd27657b735128a728ebf0c31fce5e1456718a (patch) | |
tree | f49fba5bd4a7a640b738a0f225ff3304ab9af877 /arch/x86/kernel/setup.c | |
parent | 6236af82d8a989e150a02800c210eb61cb1e17be (diff) |
x86: unify crashkernel reservation for 32 and 64 bit
This patch moves the reserve_crashkernel() to setup.c and removes the
architecture-specific version. Both versions were more or less the same.
I tested it on both x86-64 and i386, with CONFIG_KEXEC on and off (so
that it compiles).
Signed-off-by: Bernhard Walle <bwalle@suse.de>
Cc: yhlu.kernel@gmail.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/setup.c')
-rw-r--r-- | arch/x86/kernel/setup.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index ebb0a2bcdc08..c5330f601b68 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <linux/init.h> | 3 | #include <linux/init.h> |
4 | #include <linux/bootmem.h> | 4 | #include <linux/bootmem.h> |
5 | #include <linux/percpu.h> | 5 | #include <linux/percpu.h> |
6 | #include <linux/kexec.h> | ||
6 | #include <asm/smp.h> | 7 | #include <asm/smp.h> |
7 | #include <asm/percpu.h> | 8 | #include <asm/percpu.h> |
8 | #include <asm/sections.h> | 9 | #include <asm/sections.h> |
@@ -11,6 +12,7 @@ | |||
11 | #include <asm/topology.h> | 12 | #include <asm/topology.h> |
12 | #include <asm/mpspec.h> | 13 | #include <asm/mpspec.h> |
13 | #include <asm/apicdef.h> | 14 | #include <asm/apicdef.h> |
15 | #include <asm/highmem.h> | ||
14 | 16 | ||
15 | #ifdef CONFIG_X86_LOCAL_APIC | 17 | #ifdef CONFIG_X86_LOCAL_APIC |
16 | unsigned int num_processors; | 18 | unsigned int num_processors; |
@@ -404,3 +406,62 @@ EXPORT_SYMBOL(node_to_cpumask); | |||
404 | #endif /* CONFIG_DEBUG_PER_CPU_MAPS */ | 406 | #endif /* CONFIG_DEBUG_PER_CPU_MAPS */ |
405 | 407 | ||
406 | #endif /* X86_64_NUMA */ | 408 | #endif /* X86_64_NUMA */ |
409 | |||
410 | |||
411 | /* | ||
412 | * --------- Crashkernel reservation ------------------------------ | ||
413 | */ | ||
414 | |||
415 | static inline unsigned long long get_total_mem(void) | ||
416 | { | ||
417 | unsigned long long total; | ||
418 | |||
419 | total = max_low_pfn - min_low_pfn; | ||
420 | #ifdef CONFIG_HIGHMEM | ||
421 | total += highend_pfn - highstart_pfn; | ||
422 | #endif | ||
423 | |||
424 | return total << PAGE_SHIFT; | ||
425 | } | ||
426 | |||
427 | #ifdef CONFIG_KEXEC | ||
428 | void __init reserve_crashkernel(void) | ||
429 | { | ||
430 | unsigned long long total_mem; | ||
431 | unsigned long long crash_size, crash_base; | ||
432 | int ret; | ||
433 | |||
434 | total_mem = get_total_mem(); | ||
435 | |||
436 | ret = parse_crashkernel(boot_command_line, total_mem, | ||
437 | &crash_size, &crash_base); | ||
438 | if (ret == 0 && crash_size > 0) { | ||
439 | if (crash_base <= 0) { | ||
440 | printk(KERN_INFO "crashkernel reservation failed - " | ||
441 | "you have to specify a base address\n"); | ||
442 | return; | ||
443 | } | ||
444 | |||
445 | if (reserve_bootmem_generic(crash_base, crash_size, | ||
446 | BOOTMEM_EXCLUSIVE) < 0) { | ||
447 | printk(KERN_INFO "crashkernel reservation failed - " | ||
448 | "memory is in use\n"); | ||
449 | return; | ||
450 | } | ||
451 | |||
452 | printk(KERN_INFO "Reserving %ldMB of memory at %ldMB " | ||
453 | "for crashkernel (System RAM: %ldMB)\n", | ||
454 | (unsigned long)(crash_size >> 20), | ||
455 | (unsigned long)(crash_base >> 20), | ||
456 | (unsigned long)(total_mem >> 20)); | ||
457 | |||
458 | crashk_res.start = crash_base; | ||
459 | crashk_res.end = crash_base + crash_size - 1; | ||
460 | insert_resource(&iomem_resource, &crashk_res); | ||
461 | } | ||
462 | } | ||
463 | #else | ||
464 | void __init reserve_crashkernel(void) | ||
465 | {} | ||
466 | #endif | ||
467 | |||