forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/arch/mips/include/asm/jump_label.h
....@@ -11,6 +11,7 @@
1111 #ifndef __ASSEMBLY__
1212
1313 #include <linux/types.h>
14
+#include <asm/isa-rev.h>
1415
1516 #define JUMP_LABEL_NOP_SIZE 4
1617
....@@ -21,15 +22,20 @@
2122 #endif
2223
2324 #ifdef CONFIG_CPU_MICROMIPS
24
-#define B_INSN "b32"
25
+# define B_INSN "b32"
26
+# define J_INSN "j32"
27
+#elif MIPS_ISA_REV >= 6
28
+# define B_INSN "bc"
29
+# define J_INSN "bc"
2530 #else
26
-#define B_INSN "b"
31
+# define B_INSN "b"
32
+# define J_INSN "j"
2733 #endif
2834
2935 static __always_inline bool arch_static_branch(struct static_key *key, bool branch)
3036 {
3137 asm_volatile_goto("1:\t" B_INSN " 2f\n\t"
32
- "2:\tnop\n\t"
38
+ "2:\t.insn\n\t"
3339 ".pushsection __jump_table, \"aw\"\n\t"
3440 WORD_INSN " 1b, %l[l_yes], %0\n\t"
3541 ".popsection\n\t"
....@@ -42,8 +48,7 @@
4248
4349 static __always_inline bool arch_static_branch_jump(struct static_key *key, bool branch)
4450 {
45
- asm_volatile_goto("1:\tj %l[l_yes]\n\t"
46
- "nop\n\t"
51
+ asm_volatile_goto("1:\t" J_INSN " %l[l_yes]\n\t"
4752 ".pushsection __jump_table, \"aw\"\n\t"
4853 WORD_INSN " 1b, %l[l_yes], %0\n\t"
4954 ".popsection\n\t"