aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2005-06-25 17:58:04 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-25 19:24:50 -0400
commit5f5609df0c943b005847d3b2765d6dd47b624011 (patch)
treef994509dc8b507b9392bcf632c4df2a0261a9f5f /arch/x86_64
parent5234f5eb04abbbfa306ccfbc2ccbb6e73f515b15 (diff)
[PATCH] crashdump: x86_64: crashkernel option
This is the x86_64 implementation of the crashkernel option. It reserves a window of memory very early in the bootup process, so we never use it for anything but the kernel to switch to when the running kernel panics. In addition to reserving this memory a resource structure is registered so looking at /proc/iomem it is clear what happened to that memory. ISSUES: Is it possible to implement this in a architecture generic way? What should be done with architectures that always use an iommu and thus don't report their RAM memory resources in /proc/iomem? Signed-off-by: Eric Biederman <ebiederm@xmission.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/x86_64')
-rw-r--r--arch/x86_64/kernel/e820.c4
-rw-r--r--arch/x86_64/kernel/setup.c29
2 files changed, 33 insertions, 0 deletions
diff --git a/arch/x86_64/kernel/e820.c b/arch/x86_64/kernel/e820.c
index cf4878309b04..6ded3a50dfe6 100644
--- a/arch/x86_64/kernel/e820.c
+++ b/arch/x86_64/kernel/e820.c
@@ -16,6 +16,7 @@
16#include <linux/bootmem.h> 16#include <linux/bootmem.h>
17#include <linux/ioport.h> 17#include <linux/ioport.h>
18#include <linux/string.h> 18#include <linux/string.h>
19#include <linux/kexec.h>
19#include <asm/page.h> 20#include <asm/page.h>
20#include <asm/e820.h> 21#include <asm/e820.h>
21#include <asm/proto.h> 22#include <asm/proto.h>
@@ -210,6 +211,9 @@ void __init e820_reserve_resources(void)
210 */ 211 */
211 request_resource(res, &code_resource); 212 request_resource(res, &code_resource);
212 request_resource(res, &data_resource); 213 request_resource(res, &data_resource);
214#ifdef CONFIG_KEXEC
215 request_resource(res, &crashk_res);
216#endif
213 } 217 }
214 } 218 }
215} 219}
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
index ca9a915a6d4a..b02d921da4f7 100644
--- a/arch/x86_64/kernel/setup.c
+++ b/arch/x86_64/kernel/setup.c
@@ -41,6 +41,7 @@
41#include <linux/kallsyms.h> 41#include <linux/kallsyms.h>
42#include <linux/edd.h> 42#include <linux/edd.h>
43#include <linux/mmzone.h> 43#include <linux/mmzone.h>
44#include <linux/kexec.h>
44 45
45#include <asm/mtrr.h> 46#include <asm/mtrr.h>
46#include <asm/uaccess.h> 47#include <asm/uaccess.h>
@@ -367,6 +368,27 @@ static __init void parse_cmdline_early (char ** cmdline_p)
367 if (!memcmp(from, "noexec=", 7)) 368 if (!memcmp(from, "noexec=", 7))
368 nonx_setup(from + 7); 369 nonx_setup(from + 7);
369 370
371#ifdef CONFIG_KEXEC
372 /* crashkernel=size@addr specifies the location to reserve for
373 * a crash kernel. By reserving this memory we guarantee
374 * that linux never set's it up as a DMA target.
375 * Useful for holding code to do something appropriate
376 * after a kernel panic.
377 */
378 else if (!memcmp(from, "crashkernel=", 12)) {
379 unsigned long size, base;
380 size = memparse(from+12, &from);
381 if (*from == '@') {
382 base = memparse(from+1, &from);
383 /* FIXME: Do I want a sanity check
384 * to validate the memory range?
385 */
386 crashk_res.start = base;
387 crashk_res.end = base + size - 1;
388 }
389 }
390#endif
391
370 next_char: 392 next_char:
371 c = *(from++); 393 c = *(from++);
372 if (!c) 394 if (!c)
@@ -625,6 +647,13 @@ void __init setup_arch(char **cmdline_p)
625#endif 647#endif
626 648
627 sparse_init(); 649 sparse_init();
650
651#ifdef CONFIG_KEXEC
652 if (crashk_res.start != crashk_res.end) {
653 reserve_bootmem(crashk_res.start,
654 crashk_res.end - crashk_res.start + 1);
655 }
656#endif
628 paging_init(); 657 paging_init();
629 658
630 check_ioapic(); 659 check_ioapic();