[PATCH v2 05/11] static_call: Make ARCH_ADD_TRAMP_KEY() generic
Josh Poimboeuf
jpoimboe at kernel.org
Tue Mar 21 21:00:11 PDT 2023
There's nothing arch-specific about ARCH_ADD_TRAMP_KEY(). Move it to
the generic static_call.h.
Signed-off-by: Josh Poimboeuf <jpoimboe at kernel.org>
---
arch/x86/include/asm/static_call.h | 6 ------
include/linux/static_call.h | 11 +++++++++--
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/arch/x86/include/asm/static_call.h b/arch/x86/include/asm/static_call.h
index 343b722ccaf2..52abbdfd6106 100644
--- a/arch/x86/include/asm/static_call.h
+++ b/arch/x86/include/asm/static_call.h
@@ -57,12 +57,6 @@
#define ARCH_DEFINE_STATIC_CALL_RET0_TRAMP(name) \
ARCH_DEFINE_STATIC_CALL_TRAMP(name, __static_call_return0)
-#define ARCH_ADD_TRAMP_KEY(name) \
- asm(".pushsection .static_call_tramp_key, \"a\" \n" \
- ".long " STATIC_CALL_TRAMP_STR(name) " - . \n" \
- ".long " STATIC_CALL_KEY_STR(name) " - . \n" \
- ".popsection \n")
-
extern bool __static_call_fixup(void *tramp, u8 op, void *dest);
#endif /* _ASM_STATIC_CALL_H */
diff --git a/include/linux/static_call.h b/include/linux/static_call.h
index abce40166039..013022a8611d 100644
--- a/include/linux/static_call.h
+++ b/include/linux/static_call.h
@@ -213,10 +213,17 @@ extern long __static_call_return0(void);
/* Leave the key unexported, so modules can't change static call targets: */
#define EXPORT_STATIC_CALL_TRAMP(name) \
EXPORT_SYMBOL(STATIC_CALL_TRAMP(name)); \
- ARCH_ADD_TRAMP_KEY(name)
+ __STATIC_CALL_ADD_TRAMP_KEY(name)
#define EXPORT_STATIC_CALL_TRAMP_GPL(name) \
EXPORT_SYMBOL_GPL(STATIC_CALL_TRAMP(name)); \
- ARCH_ADD_TRAMP_KEY(name)
+ __STATIC_CALL_ADD_TRAMP_KEY(name)
+
+/* Unexported key lookup table */
+#define __STATIC_CALL_ADD_TRAMP_KEY(name) \
+ asm(".pushsection .static_call_tramp_key, \"a\" \n" \
+ ".long " STATIC_CALL_TRAMP_STR(name) " - . \n" \
+ ".long " STATIC_CALL_KEY_STR(name) " - . \n" \
+ ".popsection \n")
#elif defined(CONFIG_HAVE_STATIC_CALL)
--
2.39.2
More information about the linux-arm-kernel
mailing list