[RFC PATCH v3 20/22] arm64: Define HAVE_DYNAMIC_FTRACE_WITH_ARGS

madvenka at linux.microsoft.com madvenka at linux.microsoft.com
Wed Feb 1 23:40:34 PST 2023


From: "Madhavan T. Venkataraman" <madvenka at linux.microsoft.com>

	- Define HAVE_DYNAMIC_FTRACE_WITH_ARGS to support livepatch.

	- Supply the arch code for HAVE_DYNAMIC_FTRACE_WITH_ARGS.

Signed-off-by: Madhavan T. Venkataraman <madvenka at linux.microsoft.com>
---
 arch/arm64/Kconfig.debug        |  1 +
 arch/arm64/include/asm/ftrace.h | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/arch/arm64/Kconfig.debug b/arch/arm64/Kconfig.debug
index a50caabdb18e..6d5dc90a0a52 100644
--- a/arch/arm64/Kconfig.debug
+++ b/arch/arm64/Kconfig.debug
@@ -45,6 +45,7 @@ config FRAME_POINTER_VALIDATION
 	bool "Dynamic Frame pointer validation"
 	select UNWINDER_FRAME_POINTER
 	select UNWINDER_ORC
+	select HAVE_DYNAMIC_FTRACE_WITH_ARGS
 	help
 		This invokes objtool on every object file causing it to
 		generate ORC data for the object file. ORC data is in a custom
diff --git a/arch/arm64/include/asm/ftrace.h b/arch/arm64/include/asm/ftrace.h
index 329dbbd4d50b..0bc03ecfb257 100644
--- a/arch/arm64/include/asm/ftrace.h
+++ b/arch/arm64/include/asm/ftrace.h
@@ -78,6 +78,26 @@ static inline unsigned long ftrace_call_adjust(unsigned long addr)
 	return addr;
 }
 
+#ifdef CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS
+
+struct ftrace_regs {
+	struct pt_regs		regs;
+};
+
+static __always_inline struct pt_regs *
+arch_ftrace_get_regs(struct ftrace_regs *fregs)
+{
+	return &fregs->regs;
+}
+
+static __always_inline void ftrace_instruction_pointer_set(
+				struct ftrace_regs *fregs, unsigned long pc)
+{
+	fregs->regs.pc = pc;
+}
+
+#endif
+
 #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
 struct dyn_ftrace;
 struct ftrace_ops;
-- 
2.25.1




More information about the linux-arm-kernel mailing list