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
14 #ifdef CONFIG_CC_IS_CLANG
15 #define JUMP_LABEL_STATIC_KEY_CONSTRAINT "i"
17 #define JUMP_LABEL_STATIC_KEY_CONSTRAINT "X"
19 #define JUMP_LABEL_STATIC_KEY_CONSTRAINT "jdd"
23 * We use a brcl 0,<offset> instruction for jump labels so it
24 * can be easily distinguished from a hotpatch generated instruction.
26 static __always_inline bool arch_static_branch(struct static_key *key, bool branch)
28 asm goto("0: brcl 0,%l[label]\n"
29 ".pushsection __jump_table,\"aw\"\n"
31 ".long 0b-.,%l[label]-.\n"
34 : : JUMP_LABEL_STATIC_KEY_CONSTRAINT (key), "i" (branch) : : label);
40 static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch)
42 asm goto("0: brcl 15,%l[label]\n"
43 ".pushsection __jump_table,\"aw\"\n"
45 ".long 0b-.,%l[label]-.\n"
48 : : JUMP_LABEL_STATIC_KEY_CONSTRAINT (key), "i" (branch) : : label);
54 #endif /* __ASSEMBLY__ */