Commit b306c5f5 authored by Jinyang He's avatar Jinyang He Committed by Thomas Bogendoerfer

MIPS: Use common way to parse elfcorehdr

"elfcorehdr" can be parsed at kernel/crash_dump.c
Signed-off-by: default avatarJinyang He <hejinyang@loongson.cn>
Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
parent f1b0bf57
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <linux/decompress/generic.h> #include <linux/decompress/generic.h>
#include <linux/of_fdt.h> #include <linux/of_fdt.h>
#include <linux/dmi.h> #include <linux/dmi.h>
#include <linux/crash_dump.h>
#include <asm/addrspace.h> #include <asm/addrspace.h>
#include <asm/bootinfo.h> #include <asm/bootinfo.h>
...@@ -405,34 +406,32 @@ static int __init early_parse_memmap(char *p) ...@@ -405,34 +406,32 @@ static int __init early_parse_memmap(char *p)
} }
early_param("memmap", early_parse_memmap); early_param("memmap", early_parse_memmap);
#ifdef CONFIG_PROC_VMCORE static void __init mips_reserve_vmcore(void)
static unsigned long setup_elfcorehdr, setup_elfcorehdr_size;
static int __init early_parse_elfcorehdr(char *p)
{ {
#ifdef CONFIG_PROC_VMCORE
phys_addr_t start, end; phys_addr_t start, end;
u64 i; u64 i;
setup_elfcorehdr = memparse(p, &p); if (!elfcorehdr_size) {
for_each_mem_range(i, &start, &end) { for_each_mem_range(i, &start, &end) {
if (setup_elfcorehdr >= start && setup_elfcorehdr < end) { if (elfcorehdr_addr >= start && elfcorehdr_addr < end) {
/* /*
* Reserve from the elf core header to the end of * Reserve from the elf core header to the end of
* the memory segment, that should all be kdump * the memory segment, that should all be kdump
* reserved memory. * reserved memory.
*/ */
setup_elfcorehdr_size = end - setup_elfcorehdr; elfcorehdr_size = end - elfcorehdr_addr;
break; break;
} }
} }
/* }
* If we don't find it in the memory map, then we shouldn't
* have to worry about it, as the new kernel won't use it. pr_info("Reserving %ldKB of memory at %ldKB for kdump\n",
*/ (unsigned long)elfcorehdr_size >> 10, (unsigned long)elfcorehdr_addr >> 10);
return 0;
} memblock_reserve(elfcorehdr_addr, elfcorehdr_size);
early_param("elfcorehdr", early_parse_elfcorehdr);
#endif #endif
}
#ifdef CONFIG_KEXEC #ifdef CONFIG_KEXEC
...@@ -654,13 +653,7 @@ static void __init arch_mem_init(char **cmdline_p) ...@@ -654,13 +653,7 @@ static void __init arch_mem_init(char **cmdline_p)
*/ */
memblock_set_current_limit(PFN_PHYS(max_low_pfn)); memblock_set_current_limit(PFN_PHYS(max_low_pfn));
#ifdef CONFIG_PROC_VMCORE mips_reserve_vmcore();
if (setup_elfcorehdr && setup_elfcorehdr_size) {
printk(KERN_INFO "kdump reserved memory at %lx-%lx\n",
setup_elfcorehdr, setup_elfcorehdr_size);
memblock_reserve(setup_elfcorehdr, setup_elfcorehdr_size);
}
#endif
mips_parse_crashkernel(); mips_parse_crashkernel();
#ifdef CONFIG_KEXEC #ifdef CONFIG_KEXEC
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment