xref: /linux/arch/arm64/include/asm/vdso/compat_barrier.h (revision 4b81e2eb9e4db8f6094c077d0c8b27c264901c1b)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (C) 2018 ARM Limited
4  */
5 #ifndef __COMPAT_BARRIER_H
6 #define __COMPAT_BARRIER_H
7 
8 #ifndef __ASSEMBLY__
9 /*
10  * Warning: This code is meant to be used from the compat vDSO only.
11  */
12 #ifdef __arch64__
13 #error This header is meant to be used with from the compat vDSO only
14 #endif
15 
16 #ifdef dmb
17 #undef dmb
18 #endif
19 
20 #define dmb(option) __asm__ __volatile__ ("dmb " #option : : : "memory")
21 
22 #define aarch32_smp_mb()	dmb(ish)
23 #define aarch32_smp_rmb()	dmb(ishld)
24 #define aarch32_smp_wmb()	dmb(ishst)
25 
26 #undef smp_mb
27 #undef smp_rmb
28 #undef smp_wmb
29 
30 #define smp_mb()	aarch32_smp_mb()
31 #define smp_rmb()	aarch32_smp_rmb()
32 #define smp_wmb()	aarch32_smp_wmb()
33 
34 #endif /* !__ASSEMBLY__ */
35 
36 #endif /* __COMPAT_BARRIER_H */
37