1 /* 2 * Process-global memory barriers 3 * 4 * Copyright (c) 2018 Red Hat, Inc. 5 * 6 * Author: Paolo Bonzini <pbonzini@redhat.com> 7 */ 8 9 #ifndef QEMU_SYS_MEMBARRIER_H 10 #define QEMU_SYS_MEMBARRIER_H 11 12 #ifdef CONFIG_MEMBARRIER 13 /* Only block reordering at the compiler level in the performance-critical 14 * side. The slow side forces processor-level ordering on all other cores 15 * through a system call. 16 */ 17 void smp_mb_global_init(void); 18 void smp_mb_global(void); 19 #define smp_mb_placeholder() barrier() 20 #else 21 /* Keep it simple, execute a real memory barrier on both sides. */ 22 static inline void smp_mb_global_init(void) {} 23 #define smp_mb_global() smp_mb() 24 #define smp_mb_placeholder() smp_mb() 25 #endif 26 27 #endif 28