forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-09-20 a36159eec6ca17402b0e146b86efaf76568dc353
kernel/arch/mips/include/asm/llsc.h
....@@ -9,20 +9,31 @@
99 #ifndef __ASM_LLSC_H
1010 #define __ASM_LLSC_H
1111
12
+#include <asm/isa-rev.h>
13
+
1214 #if _MIPS_SZLONG == 32
13
-#define SZLONG_LOG 5
14
-#define SZLONG_MASK 31UL
1515 #define __LL "ll "
1616 #define __SC "sc "
1717 #define __INS "ins "
1818 #define __EXT "ext "
1919 #elif _MIPS_SZLONG == 64
20
-#define SZLONG_LOG 6
21
-#define SZLONG_MASK 63UL
2220 #define __LL "lld "
2321 #define __SC "scd "
2422 #define __INS "dins "
2523 #define __EXT "dext "
2624 #endif
2725
26
+/*
27
+ * Using a branch-likely instruction to check the result of an sc instruction
28
+ * works around a bug present in R10000 CPUs prior to revision 3.0 that could
29
+ * cause ll-sc sequences to execute non-atomically.
30
+ */
31
+#ifdef CONFIG_WAR_R10000_LLSC
32
+# define __SC_BEQZ "beqzl "
33
+#elif MIPS_ISA_REV >= 6
34
+# define __SC_BEQZ "beqzc "
35
+#else
36
+# define __SC_BEQZ "beqz "
37
+#endif
38
+
2839 #endif /* __ASM_LLSC_H */