[PATCH 2/4] riscv: kexec: Place norelocate trampoline into .kexec.tramp.text
fangyu.yu at linux.alibaba.com
fangyu.yu at linux.alibaba.com
Tue Mar 24 04:45:25 PDT 2026
From: Fangyu Yu <fangyu.yu at 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 at 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 --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
--
2.50.1
More information about the linux-riscv
mailing list