Skip to content

Commit 84c57db

Browse files
James Morsewildea01
authored andcommitted
arm64: kernel: arch_crash_save_vmcoreinfo() should depend on CONFIG_CRASH_CORE
Since commit 23c8509 ("proc/kcore: add vmcoreinfo note to /proc/kcore") the kernel has exported the vmcoreinfo PT_NOTE on /proc/kcore as well as /proc/vmcore. arm64 only exposes it's additional arch information via arch_crash_save_vmcoreinfo() if built with CONFIG_KEXEC, as kdump was previously the only user of vmcoreinfo. Move this weak function to a separate file that is built at the same time as its caller in kernel/crash_core.c. This ensures values like 'kimage_voffset' are always present in the vmcoreinfo PT_NOTE. CC: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Bhupesh Sharma <bhsharma@redhat.com> Signed-off-by: James Morse <james.morse@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
1 parent 13aceef commit 84c57db

3 files changed

Lines changed: 20 additions & 11 deletions

File tree

‎arch/arm64/kernel/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ arm64-obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o \
5454
arm64-obj-$(CONFIG_ARM64_RELOC_TEST) += arm64-reloc-test.o
5555
arm64-reloc-test-y := reloc_test_core.o reloc_test_syms.o
5656
arm64-obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
57+
arm64-obj-$(CONFIG_CRASH_CORE) += crash_core.o
5758
arm64-obj-$(CONFIG_ARM_SDE_INTERFACE) += sdei.o
5859
arm64-obj-$(CONFIG_ARM64_SSBD) += ssbd.o
5960

‎arch/arm64/kernel/crash_core.c‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
/*
3+
* Copyright (C) Linaro.
4+
* Copyright (C) Huawei Futurewei Technologies.
5+
*/
6+
7+
#include <linux/crash_core.h>
8+
#include <asm/memory.h>
9+
10+
void arch_crash_save_vmcoreinfo(void)
11+
{
12+
VMCOREINFO_NUMBER(VA_BITS);
13+
/* Please note VMCOREINFO_NUMBER() uses "%d", not "%x" */
14+
vmcoreinfo_append_str("NUMBER(kimage_voffset)=0x%llx\n",
15+
kimage_voffset);
16+
vmcoreinfo_append_str("NUMBER(PHYS_OFFSET)=0x%llx\n",
17+
PHYS_OFFSET);
18+
vmcoreinfo_append_str("KERNELOFFSET=%lx\n", kaslr_offset());
19+
}

‎arch/arm64/kernel/machine_kexec.c‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -358,14 +358,3 @@ void crash_free_reserved_phys_range(unsigned long begin, unsigned long end)
358358
}
359359
}
360360
#endif /* CONFIG_HIBERNATION */
361-
362-
void arch_crash_save_vmcoreinfo(void)
363-
{
364-
VMCOREINFO_NUMBER(VA_BITS);
365-
/* Please note VMCOREINFO_NUMBER() uses "%d", not "%x" */
366-
vmcoreinfo_append_str("NUMBER(kimage_voffset)=0x%llx\n",
367-
kimage_voffset);
368-
vmcoreinfo_append_str("NUMBER(PHYS_OFFSET)=0x%llx\n",
369-
PHYS_OFFSET);
370-
vmcoreinfo_append_str("KERNELOFFSET=%lx\n", kaslr_offset());
371-
}

0 commit comments

Comments
 (0)