1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_S390_JUMP_LABEL_H
3 #define _ASM_S390_JUMP_LABEL_H
5 #define HAVE_JUMP_LABEL_BATCH
9 #include <linux/types.h>
10 #include <linux/stringify.h>
12 #define JUMP_LABEL_NOP_SIZE 6
13 #define JUMP_LABEL_NOP_OFFSET 2
15 #ifdef CONFIG_CC_IS_CLANG
16 #define JUMP_LABEL_STATIC_KEY_CONSTRAINT "i"
18 #define JUMP_LABEL_STATIC_KEY_CONSTRAINT "X"
20 #define JUMP_LABEL_STATIC_KEY_CONSTRAINT "jdd"
24 * We use a brcl 0,2 instruction for jump labels at compile time so it
25 * can be easily distinguished from a hotpatch generated instruction.
27 static __always_inline bool arch_static_branch(struct static_key *key, bool branch)
29 asm_volatile_goto("0: brcl 0,"__stringify(JUMP_LABEL_NOP_OFFSET)"\n"
30 ".pushsection __jump_table,\"aw\"\n"
32 ".long 0b-.,%l[label]-.\n"
35 : : JUMP_LABEL_STATIC_KEY_CONSTRAINT (key), "i" (branch) : : label);
41 static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch)
43 asm_volatile_goto("0: brcl 15,%l[label]\n"
44 ".pushsection __jump_table,\"aw\"\n"
46 ".long 0b-.,%l[label]-.\n"
49 : : JUMP_LABEL_STATIC_KEY_CONSTRAINT (key), "i" (branch) : : label);
55 #endif /* __ASSEMBLY__ */