diff mbox series

[2/4] riscv: kexec: Place norelocate trampoline into .kexec.tramp.text

Message ID 20260324114527.91494-3-fangyu.yu@linux.alibaba.com
State Handled Elsewhere
Headers show
Series Add crashdump support in guest kernel | expand

Commit Message

fangyu.yu@linux.alibaba.com March 24, 2026, 11:45 a.m. UTC
From: Fangyu Yu <fangyu.yu@linux.alibaba.com>

Move riscv_kexec_norelocate out of the generic .text section and into
a dedicated executable trampoline section, .kexec.tramp.text.

Signed-off-by: Fangyu Yu <fangyu.yu@linux.alibaba.com>
---
 arch/riscv/include/asm/kexec.h     | 9 +++++++++
 arch/riscv/kernel/kexec_relocate.S | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/arch/riscv/include/asm/kexec.h b/arch/riscv/include/asm/kexec.h
index b9ee8346cc8c..315dce0d9ca6 100644
--- a/arch/riscv/include/asm/kexec.h
+++ b/arch/riscv/include/asm/kexec.h
@@ -75,4 +75,13 @@  int load_extra_segments(struct kimage *image, unsigned long kernel_start,
 			unsigned long cmdline_len);
 #endif
 
+#ifndef __ASSEMBLY__
+#ifdef CONFIG_MMU
+#define __kexec_tramp_text __section(".kexec.tramp.text")
+#else
+#define __kexec_tramp_text
+#endif
+#endif
+extern char __kexec_tramp_text_start[];
+
 #endif
diff --git a/arch/riscv/kernel/kexec_relocate.S b/arch/riscv/kernel/kexec_relocate.S
index de0a4b35d01e..af6b99f5b0fd 100644
--- a/arch/riscv/kernel/kexec_relocate.S
+++ b/arch/riscv/kernel/kexec_relocate.S
@@ -147,7 +147,7 @@  riscv_kexec_relocate_end:
 
 
 /* Used for jumping to crashkernel */
-.section ".text"
+.section ".kexec.tramp.text", "ax"
 SYM_CODE_START(riscv_kexec_norelocate)
 	/*
 	 * s0: (const) Phys address to jump to