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
14 #define JUMP_LABEL_STATIC_KEY_CONSTRAINT "X"
16 #define JUMP_LABEL_STATIC_KEY_CONSTRAINT "jdd"
20 * We use a brcl 0,2 instruction for jump labels at compile time so it
21 * can be easily distinguished from a hotpatch generated instruction.
23 static inline bool arch_static_branch(struct static_key
*key
, bool branch
)
25 asm_volatile_goto("0: brcl 0,"__stringify(JUMP_LABEL_NOP_OFFSET
)"\n"
26 ".pushsection __jump_table,\"aw\"\n"
28 ".long 0b-.,%l[label]-.\n"
31 : : JUMP_LABEL_STATIC_KEY_CONSTRAINT (key
), "i" (branch
) : : label
);
37 static inline bool arch_static_branch_jump(struct static_key
*key
, bool branch
)
39 asm_volatile_goto("0: brcl 15,%l[label]\n"
40 ".pushsection __jump_table,\"aw\"\n"
42 ".long 0b-.,%l[label]-.\n"
45 : : JUMP_LABEL_STATIC_KEY_CONSTRAINT (key
), "i" (branch
) : : label
);
51 #endif /* __ASSEMBLY__ */