lkml.org 
[lkml]   [2018]   [Nov]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v3 22/23] x86: jump_label: introduce asm macros STATIC_KEY_INIT{,_TRUE,_FALSE}
Date
These will be useful when defining the contents of (a struct containing)
a static key in assembly.

Cc: x86@kernel.org
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jason Baron <jbaron@akamai.com>
Signed-off-by: Rasmus Villemoes <linux@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
\
 
 \ /
  Last update: 2018-11-10 00:12    [W:0.190 / U:1.860 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site