These will be useful when defining the contents of (a struct containing)
a static key in assembly.

Cc: x...@kernel.org
Cc: Ingo Molnar <mi...@kernel.org>
Cc: Jason Baron <jba...@akamai.com>
Signed-off-by: Rasmus Villemoes <li...@rasmusvillemoes.dk>
---
 arch/x86/include/asm/jump_label.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/arch/x86/include/asm/jump_label.h 
b/arch/x86/include/asm/jump_label.h
index a5fb34fe56a4..f8b5c77ec96d 100644
--- a/arch/x86/include/asm/jump_label.h
+++ b/arch/x86/include/asm/jump_label.h
@@ -12,6 +12,7 @@
 
 #include <asm/asm.h>
 #include <asm/nops.h>
+#include <asm-generic/jump_label.h>
 
 #ifndef __ASSEMBLY__
 
@@ -64,6 +65,22 @@ static __always_inline bool arch_static_branch_jump(struct 
static_key *key, bool
        .popsection
 .endm
 
+.macro STATIC_KEY_INIT enabled:req type:req
+       .long \enabled    # .enabled
+#ifdef CONFIG_X86_64
+       .long 0           # <padding>
+#endif
+       _ASM_PTR \type    # .type
+.endm
+
+.macro STATIC_KEY_INIT_TRUE
+       STATIC_KEY_INIT 1 JUMP_TYPE_TRUE
+.endm
+
+.macro STATIC_KEY_INIT_FALSE
+       STATIC_KEY_INIT 0 JUMP_TYPE_FALSE
+.endm
+
 #endif /* __ASSEMBLY__ */
 
 #endif
-- 
2.19.1.6.gbde171bbf5

Reply via email to