Commit 69cda7b1f06befb8d6a884b8a663d19dcaef590b
Committed by
Linus Torvalds
1 parent
bf2083050d
Exists in
master
and in
7 other branches
[PATCH] kdump: x86_64: add memmmap command line option
) From: Vivek Goyal <vgoyal@in.ibm.com> - This patch introduces the memmap option for x86_64 similar to i386. - memmap=exactmap enables setting of an exact E820 memory map, as specified by the user. Changes in this version: - Used e820_end_of_ram() to find the max_pfn as suggested by Andi kleen. - removed PFN_UP & PFN_DOWN macros - Printing the user defined map also. Signed-off-by: Murali M Chakravarthy <muralim@in.ibm.com> Signed-off-by: Hariprasad Nellitheertha <nharipra@gmail.com> Signed-off-by: Vivek Goyal <vgoyal@in.ibm.com> Cc: Andi Kleen <ak@muc.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Showing 4 changed files with 50 additions and 1 deletions Side-by-side Diff
Documentation/kernel-parameters.txt
... | ... | @@ -832,7 +832,7 @@ |
832 | 832 | mem=nopentium [BUGS=IA-32] Disable usage of 4MB pages for kernel |
833 | 833 | memory. |
834 | 834 | |
835 | - memmap=exactmap [KNL,IA-32] Enable setting of an exact | |
835 | + memmap=exactmap [KNL,IA-32,X86_64] Enable setting of an exact | |
836 | 836 | E820 memory map, as specified by the user. |
837 | 837 | Such memmap=exactmap lines can be constructed based on |
838 | 838 | BIOS output or other requirements. See the memmap=nn@ss |
arch/x86_64/kernel/e820.c
... | ... | @@ -559,6 +559,27 @@ |
559 | 559 | end_user_pfn >>= PAGE_SHIFT; |
560 | 560 | } |
561 | 561 | |
562 | +void __init parse_memmapopt(char *p, char **from) | |
563 | +{ | |
564 | + unsigned long long start_at, mem_size; | |
565 | + | |
566 | + mem_size = memparse(p, from); | |
567 | + p = *from; | |
568 | + if (*p == '@') { | |
569 | + start_at = memparse(p+1, from); | |
570 | + add_memory_region(start_at, mem_size, E820_RAM); | |
571 | + } else if (*p == '#') { | |
572 | + start_at = memparse(p+1, from); | |
573 | + add_memory_region(start_at, mem_size, E820_ACPI); | |
574 | + } else if (*p == '$') { | |
575 | + start_at = memparse(p+1, from); | |
576 | + add_memory_region(start_at, mem_size, E820_RESERVED); | |
577 | + } else { | |
578 | + end_user_pfn = (mem_size >> PAGE_SHIFT); | |
579 | + } | |
580 | + p = *from; | |
581 | +} | |
582 | + | |
562 | 583 | unsigned long pci_mem_start = 0xaeedbabe; |
563 | 584 | |
564 | 585 | /* |
arch/x86_64/kernel/setup.c
... | ... | @@ -275,6 +275,7 @@ |
275 | 275 | { |
276 | 276 | char c = ' ', *to = command_line, *from = COMMAND_LINE; |
277 | 277 | int len = 0; |
278 | + int userdef = 0; | |
278 | 279 | |
279 | 280 | /* Save unparsed command line copy for /proc/cmdline */ |
280 | 281 | memcpy(saved_command_line, COMMAND_LINE, COMMAND_LINE_SIZE); |
... | ... | @@ -357,6 +358,28 @@ |
357 | 358 | if (!memcmp(from, "mem=", 4)) |
358 | 359 | parse_memopt(from+4, &from); |
359 | 360 | |
361 | + if (!memcmp(from, "memmap=", 7)) { | |
362 | + /* exactmap option is for used defined memory */ | |
363 | + if (!memcmp(from+7, "exactmap", 8)) { | |
364 | +#ifdef CONFIG_CRASH_DUMP | |
365 | + /* If we are doing a crash dump, we | |
366 | + * still need to know the real mem | |
367 | + * size before original memory map is | |
368 | + * reset. | |
369 | + */ | |
370 | + saved_max_pfn = e820_end_of_ram(); | |
371 | +#endif | |
372 | + from += 8+7; | |
373 | + end_pfn_map = 0; | |
374 | + e820.nr_map = 0; | |
375 | + userdef = 1; | |
376 | + } | |
377 | + else { | |
378 | + parse_memmapopt(from+7, &from); | |
379 | + userdef = 1; | |
380 | + } | |
381 | + } | |
382 | + | |
360 | 383 | #ifdef CONFIG_NUMA |
361 | 384 | if (!memcmp(from, "numa=", 5)) |
362 | 385 | numa_setup(from+5); |
... | ... | @@ -402,6 +425,10 @@ |
402 | 425 | if (COMMAND_LINE_SIZE <= ++len) |
403 | 426 | break; |
404 | 427 | *(to++) = c; |
428 | + } | |
429 | + if (userdef) { | |
430 | + printk(KERN_INFO "user-defined physical RAM map:\n"); | |
431 | + e820_print_map("user"); | |
405 | 432 | } |
406 | 433 | *to = '\0'; |
407 | 434 | *cmdline_p = command_line; |
include/asm-x86_64/e820.h