s390/ftrace: move hotpatch trampolines to mcount.S
authorHeiko Carstens <hca@linux.ibm.com>
Mon, 13 Mar 2023 12:50:36 +0000 (13:50 +0100)
committerHeiko Carstens <hca@linux.ibm.com>
Mon, 20 Mar 2023 10:12:46 +0000 (11:12 +0100)
Move the ftrace hotpatch trampolines to mcount.S. This allows to make
use of the standard SYM_CODE macros which again makes sure that the
hotpatch trampolines follow the function alignment rules of the rest
of the kernel.

Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Acked-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/kernel/ftrace.c
arch/s390/kernel/mcount.S

index 416b5a94353db0a45174f8f21f55c85e39b07c25..6f6c44b7af89690e4524eef59cc190aa2daf8f33 100644 (file)
@@ -49,26 +49,6 @@ struct ftrace_insn {
        s32 disp;
 } __packed;
 
-asm(
-       "       .align 16\n"
-       "ftrace_shared_hotpatch_trampoline_br:\n"
-       "       lmg     %r0,%r1,2(%r1)\n"
-       "       br      %r1\n"
-       "ftrace_shared_hotpatch_trampoline_br_end:\n"
-);
-
-#ifdef CONFIG_EXPOLINE
-asm(
-       "       .align 16\n"
-       "ftrace_shared_hotpatch_trampoline_exrl:\n"
-       "       lmg     %r0,%r1,2(%r1)\n"
-       "       exrl    %r0,0f\n"
-       "       j       .\n"
-       "0:     br      %r1\n"
-       "ftrace_shared_hotpatch_trampoline_exrl_end:\n"
-);
-#endif /* CONFIG_EXPOLINE */
-
 #ifdef CONFIG_MODULES
 static char *ftrace_plt;
 #endif /* CONFIG_MODULES */
index 43ff91073d2a41e20d0805bb97b8b54e117dcb14..4c4ee762f51565a6013bdd6cc5f56f602bbcc085 100644 (file)
@@ -135,6 +135,22 @@ SYM_FUNC_END(return_to_handler)
 #endif
 #endif /* CONFIG_FUNCTION_TRACER */
 
+SYM_CODE_START(ftrace_shared_hotpatch_trampoline_br)
+       lmg     %r0,%r1,2(%r1)
+       br      %r1
+SYM_INNER_LABEL(ftrace_shared_hotpatch_trampoline_br_end, SYM_L_GLOBAL)
+SYM_CODE_END(ftrace_shared_hotpatch_trampoline_br)
+
+#ifdef CONFIG_EXPOLINE
+SYM_CODE_START(ftrace_shared_hotpatch_trampoline_exrl)
+       lmg     %r0,%r1,2(%r1)
+       exrl    %r0,0f
+       j       .
+0:     br      %r1
+SYM_INNER_LABEL(ftrace_shared_hotpatch_trampoline_exrl_end, SYM_L_GLOBAL)
+SYM_CODE_END(ftrace_shared_hotpatch_trampoline_exrl)
+#endif /* CONFIG_EXPOLINE */
+
 #ifdef CONFIG_RETHOOK
 
 SYM_FUNC_START(arch_rethook_trampoline)