Export MIPS architecture-specific struct offsets needed by the vmcore-tasks tool, including signal frame layouts and register context structures used to reconstruct user-space register state from a vmcore dump.
Signed-off-by: Pnina Feder <[email protected]> --- .../admin-guide/kdump/vmcoreinfo.rst | 34 +++++++++++++++++++ arch/mips/kernel/Makefile | 1 + arch/mips/kernel/signal.c | 8 +++++ arch/mips/kernel/vmcore_info.c | 22 ++++++++++++ 4 files changed, 65 insertions(+) create mode 100644 arch/mips/kernel/vmcore_info.c diff --git a/Documentation/admin-guide/kdump/vmcoreinfo.rst b/Documentation/admin-guide/kdump/vmcoreinfo.rst index 3c364434b846..4af32ddf5615 100644 --- a/Documentation/admin-guide/kdump/vmcoreinfo.rst +++ b/Documentation/admin-guide/kdump/vmcoreinfo.rst @@ -494,6 +494,40 @@ Used to get the vmalloc_start address from the high_memory symbol. The maximum number of CPUs. +MIPS +==== + +(rt_sigframe, rs_uc) +-------------------- + +Offset of the ucontext member within the MIPS rt_sigframe structure. +Used to locate the signal context within a signal frame on the user +stack. + +(sigcontext, sc_regs) +--------------------- + +Offset of the saved register array within struct sigcontext. Used to +extract user-space register state from signal frames in a vmcore dump. + +PAGE_SHIFT +---------- + +The base-2 logarithm of the page size. Used for page frame number +calculations during address translation. + +_PFN_MASK|_PAGE_PRESENT|_PAGE_VALID|_PAGE_GLOBAL +------------------------------------------------- + +Page table entry bit masks and flags. Used for walking MIPS page tables +and translating virtual to physical addresses in a vmcore dump. + +PTRS_PER_PGD|PTRS_PER_PMD|PTRS_PER_PTE +--------------------------------------- + +Number of entries per page table level. Used for page table walking +during virtual-to-physical address translation. + powerpc ======= diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile index 95a1e674fd67..99f2961f6ee1 100644 --- a/arch/mips/kernel/Makefile +++ b/arch/mips/kernel/Makefile @@ -24,6 +24,7 @@ CFLAGS_REMOVE_perf_event_mipsxx.o = $(CC_FLAGS_FTRACE) endif obj-$(CONFIG_CEVT_BCM1480) += cevt-bcm1480.o +obj-$(CONFIG_VMCORE_INFO) += vmcore_info.o obj-$(CONFIG_CEVT_R4K) += cevt-r4k.o obj-$(CONFIG_CEVT_DS1287) += cevt-ds1287.o obj-$(CONFIG_CEVT_GT641XX) += cevt-gt641xx.o diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c index 4a10f18a8806..f2241f52fa17 100644 --- a/arch/mips/kernel/signal.c +++ b/arch/mips/kernel/signal.c @@ -26,6 +26,7 @@ #include <linux/syscalls.h> #include <linux/uaccess.h> #include <linux/resume_user_mode.h> +#include <linux/vmcore_info.h> #include <asm/abi.h> #include <asm/asm.h> @@ -62,6 +63,13 @@ struct rt_sigframe { struct ucontext rs_uc; }; +#ifdef CONFIG_VMCORE_INFO +void mips_rt_signal_frame(void) +{ + VMCOREINFO_OFFSET(rt_sigframe, rs_uc); +} +#endif + #ifdef CONFIG_MIPS_FP_SUPPORT /* diff --git a/arch/mips/kernel/vmcore_info.c b/arch/mips/kernel/vmcore_info.c new file mode 100644 index 000000000000..5d7fdc662065 --- /dev/null +++ b/arch/mips/kernel/vmcore_info.c @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0-only + +#include <linux/vmcore_info.h> + +#include <asm/pgtable.h> +#include <asm/sigcontext.h> + +extern void mips_rt_signal_frame(void); + +void arch_crash_save_vmcoreinfo(void) +{ + mips_rt_signal_frame(); + VMCOREINFO_OFFSET(sigcontext, sc_regs); + VMCOREINFO_NUMBER(PAGE_SHIFT); + VMCOREINFO_NUMBER(_PFN_MASK); + VMCOREINFO_NUMBER(_PAGE_PRESENT); + VMCOREINFO_NUMBER(_PAGE_VALID); + VMCOREINFO_NUMBER(_PAGE_GLOBAL); + VMCOREINFO_NUMBER(PTRS_PER_PGD); + VMCOREINFO_NUMBER(PTRS_PER_PMD); + VMCOREINFO_NUMBER(PTRS_PER_PTE); +} -- 2.43.0
