summaryrefslogtreecommitdiffstats
path: root/arch/riscv/include/asm/kexec.h
diff options
context:
space:
mode:
authorNick Kossifidis <mick@ics.forth.gr>2021-04-19 03:55:38 +0300
committerPalmer Dabbelt <palmerdabbelt@google.com>2021-04-26 08:25:23 -0700
commite53d28180d4d0fd12b6d2bde49cb87aa775b6ba8 (patch)
tree9d1a42513601c0eed0654b85a60f4818ae982e41 /arch/riscv/include/asm/kexec.h
parentffe0e526126884cf036a6f724220f1f9b4094fd2 (diff)
downloadlinux-e53d28180d4d0fd12b6d2bde49cb87aa775b6ba8.tar.bz2
RISC-V: Add kdump support
This patch adds support for kdump, the kernel will reserve a region for the crash kernel and jump there on panic. In order for userspace tools (kexec-tools) to prepare the crash kernel kexec image, we also need to expose some information on /proc/iomem for the memory regions used by the kernel and for the region reserved for crash kernel. Note that on userspace the device tree is used to determine the system's memory layout so the "System RAM" on /proc/iomem is ignored. I tested this on riscv64 qemu and works as expected, you may test it by triggering a crash through /proc/sysrq_trigger: echo c > /proc/sysrq_trigger Signed-off-by: Nick Kossifidis <mick@ics.forth.gr> Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
Diffstat (limited to 'arch/riscv/include/asm/kexec.h')
-rw-r--r--arch/riscv/include/asm/kexec.h19
1 files changed, 13 insertions, 6 deletions
diff --git a/arch/riscv/include/asm/kexec.h b/arch/riscv/include/asm/kexec.h
index 86e6e4922d1f..1e954101906a 100644
--- a/arch/riscv/include/asm/kexec.h
+++ b/arch/riscv/include/asm/kexec.h
@@ -23,11 +23,16 @@
#define KEXEC_ARCH KEXEC_ARCH_RISCV
+extern void riscv_crash_save_regs(struct pt_regs *newregs);
+
static inline void
crash_setup_regs(struct pt_regs *newregs,
struct pt_regs *oldregs)
{
- /* Dummy implementation for now */
+ if (oldregs)
+ memcpy(newregs, oldregs, sizeof(struct pt_regs));
+ else
+ riscv_crash_save_regs(newregs);
}
@@ -40,10 +45,12 @@ struct kimage_arch {
const extern unsigned char riscv_kexec_relocate[];
const extern unsigned int riscv_kexec_relocate_size;
-typedef void (*riscv_kexec_do_relocate)(unsigned long first_ind_entry,
- unsigned long jump_addr,
- unsigned long fdt_addr,
- unsigned long hartid,
- unsigned long va_pa_off);
+typedef void (*riscv_kexec_method)(unsigned long first_ind_entry,
+ unsigned long jump_addr,
+ unsigned long fdt_addr,
+ unsigned long hartid,
+ unsigned long va_pa_off);
+
+extern riscv_kexec_method riscv_kexec_norelocate;
#endif