1 /* SPDX-License-Identifier: GPL-2.0 */
2 #if defined(__i386__) || defined(__x86_64__)
3 #define barrier() asm volatile("" ::: "memory")
4 #define virt_mb() __sync_synchronize()
5 #define virt_rmb() barrier()
6 #define virt_wmb() barrier()
7 /* Atomic store should be enough, but gcc generates worse code in that case. */
8 #define virt_store_mb(var, value) do { \
9 typeof(var) virt_store_mb_value = (value); \
10 __atomic_exchange(&(var), &virt_store_mb_value, &virt_store_mb_value, \
14 /* Weak barriers should be used. If not - it's a bug */
16 # define rmb() abort()
17 # define wmb() abort()
19 #error Please fill in barrier macros