From 5f8d632657d71d086bd55deaeea99f13bfbdf8d8 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Tue, 5 Oct 2021 14:40:32 +0200 Subject: arm: kdump: Add DT properties to crash dump kernel's DTB Pass the following properties to the crash dump kernel, to provide a modern DT interface between kexec and the crash dump kernel: - linux,elfcorehdr: ELF core header segment, similar to the "elfcorehdr=" kernel parameter. - linux,usable-memory-range: Usable memory reserved for the crash dump kernel. This makes the memory reservation explicit, so Linux no longer needs to mask the program counter, and rely on the "mem=" kernel parameter to obtain the start and size of usable memory. For backwards compatibility, the "elfcorehdr=" and "mem=" kernel parameters are still appended to the kernel command line. Loosely based on the ARM64 version by Akashi Takahiro. Signed-off-by: Geert Uytterhoeven Signed-off-by: Simon Horman --- kexec/arch/arm/crashdump-arm.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'kexec/arch/arm/crashdump-arm.c') diff --git a/kexec/arch/arm/crashdump-arm.c b/kexec/arch/arm/crashdump-arm.c index daa4788..1ec1826 100644 --- a/kexec/arch/arm/crashdump-arm.c +++ b/kexec/arch/arm/crashdump-arm.c @@ -54,7 +54,7 @@ struct memory_ranges usablemem_rgns = { }; /* The boot-time physical memory range reserved for crashkernel region */ -static struct memory_range crash_kernel_mem; +struct memory_range crash_kernel_mem; /* reserved regions */ #define CRASH_MAX_RESERVED_RANGES 2 @@ -64,6 +64,8 @@ static struct memory_ranges crash_reserved_rgns = { .ranges = crash_reserved_ranges, }; +struct memory_range elfcorehdr_mem; + static struct crash_elf_info elf_info = { .class = ELFCLASS32, .data = ELFDATANATIVE, @@ -307,7 +309,11 @@ int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline) crash_kernel_mem.start, crash_kernel_mem.end, -1, 0); - dbgprintf("elfcorehdr: %#lx\n", elfcorehdr); + elfcorehdr_mem.start = elfcorehdr; + elfcorehdr_mem.end = elfcorehdr + bufsz - 1; + + dbgprintf("elfcorehdr 0x%llx-0x%llx\n", elfcorehdr_mem.start, + elfcorehdr_mem.end); cmdline_add_elfcorehdr(mod_cmdline, elfcorehdr); /* -- cgit