powerpc/ftrace: Implement ftrace_replace_code()
authorNaveen N Rao <naveen@kernel.org>
Mon, 19 Jun 2023 09:47:33 +0000 (15:17 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 21 Aug 2023 14:09:06 +0000 (00:09 +1000)
commitc91c5a828685563c24ab8879d8386de356d9085a
treee680ddcf5488e46f1e2f20a8a733bbb86cae4d67
parenta26ce4272eea2b20d4f39b9d7e56daf0c77151d8
powerpc/ftrace: Implement ftrace_replace_code()

Implement ftrace_replace_code() to consolidate logic from the different
ftrace patching routines: ftrace_make_nop(), ftrace_make_call() and
ftrace_modify_call(). Note that ftrace_make_call() is still required
primarily to handle patching modules during their load time. The other
two routines should no longer be called.

This lays the groundwork to enable better control in patching ftrace
locations, including the ability to nop-out preceding profiling
instructions when ftrace is disabled.

Signed-off-by: Naveen N Rao <naveen@kernel.org>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/c28f852225646b0561bbf3c1d22d03f041ace8e0.1687166935.git.naveen@kernel.org
arch/powerpc/kernel/trace/ftrace.c