treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / arch / s390 / include / asm / jump_label.h
blobdcb1bba4f40639ee29a2ebdbd6df756d29ef23e6
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_S390_JUMP_LABEL_H
3 #define _ASM_S390_JUMP_LABEL_H
5 #ifndef __ASSEMBLY__
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"
15 #elif __GNUC__ < 9
16 #define JUMP_LABEL_STATIC_KEY_CONSTRAINT "X"
17 #else
18 #define JUMP_LABEL_STATIC_KEY_CONSTRAINT "jdd"
19 #endif
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"
29 ".balign 8\n"
30 ".long 0b-.,%l[label]-.\n"
31 ".quad %0+%1-.\n"
32 ".popsection\n"
33 : : JUMP_LABEL_STATIC_KEY_CONSTRAINT (key), "i" (branch) : : label);
34 return false;
35 label:
36 return true;
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"
43 ".balign 8\n"
44 ".long 0b-.,%l[label]-.\n"
45 ".quad %0+%1-.\n"
46 ".popsection\n"
47 : : JUMP_LABEL_STATIC_KEY_CONSTRAINT (key), "i" (branch) : : label);
48 return false;
49 label:
50 return true;
53 #endif /* __ASSEMBLY__ */
54 #endif