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 #if __LINUX_ARM_ARCH__ >= 8 24 #define aarch32_smp_mb() dmb(ish) 25 #define aarch32_smp_rmb() dmb(ishld) 26 #define aarch32_smp_wmb() dmb(ishst) 27 #else 28 #define aarch32_smp_mb() dmb(ish) 29 #define aarch32_smp_rmb() aarch32_smp_mb() 30 #define aarch32_smp_wmb() dmb(ishst) 31 #endif 32 33 34 #undef smp_mb 35 #undef smp_rmb 36 #undef smp_wmb 37 38 #define smp_mb() aarch32_smp_mb() 39 #define smp_rmb() aarch32_smp_rmb() 40 #define smp_wmb() aarch32_smp_wmb() 41 42 #endif /* !__ASSEMBLY__ */ 43 44 #endif /* __COMPAT_BARRIER_H */ 45