summaryrefslogtreecommitdiff
path: root/arch/sh/include/asm/barrier.h
diff options
context:
space:
mode:
authorRich Felker <dalias@libc.org>2016-07-28 19:21:10 +0000
committerRich Felker <dalias@libc.org>2016-08-05 03:29:34 +0000
commit2b47d54ed41c33baf5825185168b493317c5572f (patch)
treea42a2098fa73f41d6d5b214e1eeca5712d419551 /arch/sh/include/asm/barrier.h
parent834da197058bebcb343320dafb8b62d416d4038c (diff)
sh: add J2 atomics using the cas.l instruction
Signed-off-by: Rich Felker <dalias@libc.org>
Diffstat (limited to 'arch/sh/include/asm/barrier.h')
-rw-r--r--arch/sh/include/asm/barrier.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/sh/include/asm/barrier.h b/arch/sh/include/asm/barrier.h
index 8a84e05adb2e..3c30b6e166b6 100644
--- a/arch/sh/include/asm/barrier.h
+++ b/arch/sh/include/asm/barrier.h
@@ -29,6 +29,11 @@
#define wmb() mb()
#define ctrl_barrier() __icbi(PAGE_OFFSET)
#else
+#if defined(CONFIG_CPU_J2) && defined(CONFIG_SMP)
+#define __smp_mb() do { int tmp = 0; __asm__ __volatile__ ("cas.l %0,%0,@%1" : "+r"(tmp) : "z"(&tmp) : "memory", "t"); } while(0)
+#define __smp_rmb() __smp_mb()
+#define __smp_wmb() __smp_mb()
+#endif
#define ctrl_barrier() __asm__ __volatile__ ("nop;nop;nop;nop;nop;nop;nop;nop")
#endif