1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_S390_JUMP_LABEL_H
3 #define _ASM_S390_JUMP_LABEL_H
7 #include <linux/types.h>
8 #include <linux/stringify.h>
10 #define JUMP_LABEL_NOP_SIZE 6
11 #define JUMP_LABEL_NOP_OFFSET 2
13 #ifdef CONFIG_CC_IS_CLANG
14 #define JUMP_LABEL_STATIC_KEY_CONSTRAINT "i"
16 #define JUMP_LABEL_STATIC_KEY_CONSTRAINT "X"
18 #define JUMP_LABEL_STATIC_KEY_CONSTRAINT "jdd"
22 * We use a brcl 0,2 instruction for jump labels at compile time so it
23 * can be easily distinguished from a hotpatch generated instruction.
25 static __always_inline
bool arch_static_branch(struct static_key
*key
, bool branch
)
27 asm_volatile_goto("0: brcl 0,"__stringify(JUMP_LABEL_NOP_OFFSET
)"\n"
28 ".pushsection __jump_table,\"aw\"\n"
30 ".long 0b-.,%l[label]-.\n"
33 : : JUMP_LABEL_STATIC_KEY_CONSTRAINT (key
), "i" (branch
) : : label
);
39 static __always_inline
bool arch_static_branch_jump(struct static_key
*key
, bool branch
)
41 asm_volatile_goto("0: brcl 15,%l[label]\n"
42 ".pushsection __jump_table,\"aw\"\n"
44 ".long 0b-.,%l[label]-.\n"
47 : : JUMP_LABEL_STATIC_KEY_CONSTRAINT (key
), "i" (branch
) : : label
);
53 #endif /* __ASSEMBLY__ */