aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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();