xref: /linux/arch/arm64/include/asm/vdso/compat_barrier.h (revision 03ab8e6297acd1bc0eedaa050e2a1635c576fd11)
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 with
11  * ENABLE_COMPAT_VDSO only.
12  */
13 #ifndef ENABLE_COMPAT_VDSO
14 #error This header is meant to be used with ENABLE_COMPAT_VDSO only
15 #endif
16 
17 #ifdef dmb
18 #undef dmb
19 #endif
20 
21 #define dmb(option) __asm__ __volatile__ ("dmb " #option : : : "memory")
22 
23 #define aarch32_smp_mb()	dmb(ish)
24 #define aarch32_smp_rmb()	dmb(ishld)
25 #define aarch32_smp_wmb()	dmb(ishst)
26 
27 #undef smp_mb
28 #undef smp_rmb
29 #undef smp_wmb
30 
31 #define smp_mb()	aarch32_smp_mb()
32 #define smp_rmb()	aarch32_smp_rmb()
33 #define smp_wmb()	aarch32_smp_wmb()
34 
35 #endif /* !__ASSEMBLY__ */
36 
37 #endif /* __COMPAT_BARRIER_H */
38