Skip to content

Commit 9704bea

Browse files
Merge patch series "Support VMCOREINFO export for RISCV64"
Add arch_crash_save_vmcoreinfo(), which exports VM layout(MODULES, VMALLOC, VMEMMAP ranges and KERNEL_LINK_ADDR), va bits and ram base for vmcore. * b4-shazam-merge: Documentation: kdump: describe VMCOREINFO export for RISCV64 RISC-V: Add arch_crash_save_vmcoreinfo support Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
2 parents b57c2f1 + c5b4216 commit 9704bea

File tree

3 files changed

+51
-0
lines changed

3 files changed

+51
-0
lines changed

Documentation/admin-guide/kdump/vmcoreinfo.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,3 +595,32 @@ X2TLB
595595
-----
596596

597597
Indicates whether the crashed kernel enabled SH extended mode.
598+
599+
RISCV64
600+
=======
601+
602+
VA_BITS
603+
-------
604+
605+
The maximum number of bits for virtual addresses. Used to compute the
606+
virtual memory ranges.
607+
608+
PAGE_OFFSET
609+
-----------
610+
611+
Indicates the virtual kernel start address of the direct-mapped RAM region.
612+
613+
phys_ram_base
614+
-------------
615+
616+
Indicates the start physical RAM address.
617+
618+
MODULES_VADDR|MODULES_END|VMALLOC_START|VMALLOC_END|VMEMMAP_START|VMEMMAP_END|KERNEL_LINK_ADDR
619+
----------------------------------------------------------------------------------------------
620+
621+
Used to get the correct ranges:
622+
623+
* MODULES_VADDR ~ MODULES_END : Kernel module space.
624+
* VMALLOC_START ~ VMALLOC_END : vmalloc() / ioremap() space.
625+
* VMEMMAP_START ~ VMEMMAP_END : vmemmap space, used for struct page array.
626+
* KERNEL_LINK_ADDR : start address of Kernel link and BPF

arch/riscv/kernel/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ obj-$(CONFIG_KGDB) += kgdb.o
8181
obj-$(CONFIG_KEXEC_CORE) += kexec_relocate.o crash_save_regs.o machine_kexec.o
8282
obj-$(CONFIG_KEXEC_FILE) += elf_kexec.o machine_kexec_file.o
8383
obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
84+
obj-$(CONFIG_CRASH_CORE) += crash_core.o
8485

8586
obj-$(CONFIG_JUMP_LABEL) += jump_label.o
8687

arch/riscv/kernel/crash_core.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// SPDX-License-Identifier: GPL-2.0-only
2+
3+
#include <linux/crash_core.h>
4+
#include <linux/pagemap.h>
5+
6+
void arch_crash_save_vmcoreinfo(void)
7+
{
8+
VMCOREINFO_NUMBER(VA_BITS);
9+
VMCOREINFO_NUMBER(phys_ram_base);
10+
11+
vmcoreinfo_append_str("NUMBER(PAGE_OFFSET)=0x%lx\n", PAGE_OFFSET);
12+
vmcoreinfo_append_str("NUMBER(VMALLOC_START)=0x%lx\n", VMALLOC_START);
13+
vmcoreinfo_append_str("NUMBER(VMALLOC_END)=0x%lx\n", VMALLOC_END);
14+
vmcoreinfo_append_str("NUMBER(VMEMMAP_START)=0x%lx\n", VMEMMAP_START);
15+
vmcoreinfo_append_str("NUMBER(VMEMMAP_END)=0x%lx\n", VMEMMAP_END);
16+
#ifdef CONFIG_64BIT
17+
vmcoreinfo_append_str("NUMBER(MODULES_VADDR)=0x%lx\n", MODULES_VADDR);
18+
vmcoreinfo_append_str("NUMBER(MODULES_END)=0x%lx\n", MODULES_END);
19+
#endif
20+
vmcoreinfo_append_str("NUMBER(KERNEL_LINK_ADDR)=0x%lx\n", KERNEL_LINK_ADDR);
21+
}

0 commit comments

Comments
 (0)