Linux-RISC-V Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Add crashdump support in guest kernel
@ 2026-03-24 11:45 fangyu.yu
  2026-03-24 11:45 ` [PATCH 1/4] riscv: Add kexec trampoline text section to vmlinux.lds.S fangyu.yu
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: fangyu.yu @ 2026-03-24 11:45 UTC (permalink / raw)
  To: pjw, palmer, aou, alex, songshuaishuai, bjorn, ardb, arnd,
	bhelgaas, richard.lyu, tzimmermann, nathan
  Cc: guoren, kvm-riscv, linux-riscv, linux-kernel, Fangyu Yu

From: Fangyu Yu <fangyu.yu@linux.alibaba.com>

In a RISC-V kernel, crashdump needs to hand off execution to the crash
kernel after tearing down the current kernel address space. However,
under virtualization the guest uses two-stage address translation, PC
does not jump to stvec after setting satp to zero.

This patch set introduces a dedicated kexec trampoline text section and
builds a minimal trampoline page table for it. The crash handoff is then
reworked into a two-pass trampoline:

    1. First enter via the kernel VA, install the trampoline page table,
       and jump to the trampoline VA(=PA) of the norelocate code;
    2. Continue execution with trampoline VA(=PA) and directly jump to the
       crash kernel entry point with jr, instead of depending on a stvec
       redirection.

With this, crashdump in RISC-V guests becomes robust against the
two-stage translation.

Fangyu Yu (4):
  riscv: Add kexec trampoline text section to vmlinux.lds.S
  riscv: kexec: Place norelocate trampoline into .kexec.tramp.text
  riscv: kexec: Build trampoline page tables for crash kernel entry
  riscv: kexec: Switch to trampoline page table before norelocate

 arch/riscv/include/asm/kexec.h     |   9 +++
 arch/riscv/kernel/image-vars.h     |  13 ++++
 arch/riscv/kernel/kexec_relocate.S |  34 +++++++--
 arch/riscv/kernel/machine_kexec.c  | 116 ++++++++++++++++++++++++++++-
 arch/riscv/kernel/vmlinux.lds.S    |   1 +
 5 files changed, 166 insertions(+), 7 deletions(-)

-- 
2.50.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-03-24 11:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-24 11:45 [PATCH 0/4] Add crashdump support in guest kernel fangyu.yu
2026-03-24 11:45 ` [PATCH 1/4] riscv: Add kexec trampoline text section to vmlinux.lds.S fangyu.yu
2026-03-24 11:45 ` [PATCH 2/4] riscv: kexec: Place norelocate trampoline into .kexec.tramp.text fangyu.yu
2026-03-24 11:45 ` [PATCH 3/4] riscv: kexec: Build trampoline page tables for crash kernel entry fangyu.yu
2026-03-24 11:45 ` [PATCH 4/4] riscv: kexec: Switch to trampoline page table before norelocate fangyu.yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox