Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / arch / arm / include / asm / barrier.h
blob40f5c410fd8c30300e094f3323adffe63743161d
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __ASM_BARRIER_H
3 #define __ASM_BARRIER_H
5 #ifndef __ASSEMBLY__
7 #define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t");
9 #if __LINUX_ARM_ARCH__ >= 7 || \
10 (__LINUX_ARM_ARCH__ == 6 && defined(CONFIG_CPU_32v6K))
11 #define sev() __asm__ __volatile__ ("sev" : : : "memory")
12 #define wfe() __asm__ __volatile__ ("wfe" : : : "memory")
13 #define wfi() __asm__ __volatile__ ("wfi" : : : "memory")
14 #endif
16 #if __LINUX_ARM_ARCH__ >= 7
17 #define isb(option) __asm__ __volatile__ ("isb " #option : : : "memory")
18 #define dsb(option) __asm__ __volatile__ ("dsb " #option : : : "memory")
19 #define dmb(option) __asm__ __volatile__ ("dmb " #option : : : "memory")
20 #elif defined(CONFIG_CPU_XSC3) || __LINUX_ARM_ARCH__ == 6
21 #define isb(x) __asm__ __volatile__ ("mcr p15, 0, %0, c7, c5, 4" \
22 : : "r" (0) : "memory")
23 #define dsb(x) __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 4" \
24 : : "r" (0) : "memory")
25 #define dmb(x) __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" \
26 : : "r" (0) : "memory")
27 #elif defined(CONFIG_CPU_FA526)
28 #define isb(x) __asm__ __volatile__ ("mcr p15, 0, %0, c7, c5, 4" \
29 : : "r" (0) : "memory")
30 #define dsb(x) __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 4" \
31 : : "r" (0) : "memory")
32 #define dmb(x) __asm__ __volatile__ ("" : : : "memory")
33 #else
34 #define isb(x) __asm__ __volatile__ ("" : : : "memory")
35 #define dsb(x) __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 4" \
36 : : "r" (0) : "memory")
37 #define dmb(x) __asm__ __volatile__ ("" : : : "memory")
38 #endif
40 #ifdef CONFIG_ARM_HEAVY_MB
41 extern void (*soc_mb)(void);
42 extern void arm_heavy_mb(void);
43 #define __arm_heavy_mb(x...) do { dsb(x); arm_heavy_mb(); } while (0)
44 #else
45 #define __arm_heavy_mb(x...) dsb(x)
46 #endif
48 #if defined(CONFIG_ARM_DMA_MEM_BUFFERABLE) || defined(CONFIG_SMP)
49 #define mb() __arm_heavy_mb()
50 #define rmb() dsb()
51 #define wmb() __arm_heavy_mb(st)
52 #define dma_rmb() dmb(osh)
53 #define dma_wmb() dmb(oshst)
54 #else
55 #define mb() barrier()
56 #define rmb() barrier()
57 #define wmb() barrier()
58 #define dma_rmb() barrier()
59 #define dma_wmb() barrier()
60 #endif
62 #define __smp_mb() dmb(ish)
63 #define __smp_rmb() __smp_mb()
64 #define __smp_wmb() dmb(ishst)
66 #include <asm-generic/barrier.h>
68 #endif /* !__ASSEMBLY__ */
69 #endif /* __ASM_BARRIER_H */