d4a63338a53c49a1085c4c72ce7330f207e3b3bf
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / arch / arm64 / include / asm / barrier.h
1 /*
2 * Based on arch/arm/include/asm/barrier.h
3 *
4 * Copyright (C) 2012 ARM Ltd.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef __ASM_BARRIER_H
19 #define __ASM_BARRIER_H
20
21 #ifndef __ASSEMBLY__
22
23 #define sev() asm volatile("sev" : : : "memory")
24 #define wfe() asm volatile("wfe" : : : "memory")
25 #define wfi() asm volatile("wfi" : : : "memory")
26
27 #define isb() asm volatile("isb" : : : "memory")
28 #define dsb() asm volatile("dsb sy" : : : "memory")
29
30 #define mb() dsb()
31 #define rmb() asm volatile("dsb ld" : : : "memory")
32 #define wmb() asm volatile("dsb st" : : : "memory")
33
34 #ifndef CONFIG_SMP
35 #define smp_mb() barrier()
36 #define smp_rmb() barrier()
37 #define smp_wmb() barrier()
38 #else
39 #define smp_mb() asm volatile("dmb ish" : : : "memory")
40 #define smp_rmb() asm volatile("dmb ishld" : : : "memory")
41 #define smp_wmb() asm volatile("dmb ishst" : : : "memory")
42 #endif
43
44 #define read_barrier_depends() do { } while(0)
45 #define smp_read_barrier_depends() do { } while(0)
46
47 #define set_mb(var, value) do { var = value; smp_mb(); } while (0)
48 #define nop() asm volatile("nop");
49
50 #endif /* __ASSEMBLY__ */
51
52 #endif /* __ASM_BARRIER_H */