]> git.proxmox.com Git - mirror_qemu.git/blame - include/qemu/sys_membarrier.h
Merge tag 'for-upstream' of https://repo.or.cz/qemu/kevin into staging
[mirror_qemu.git] / include / qemu / sys_membarrier.h
CommitLineData
c8d3877e
PB
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
177d9e0d 10#define QEMU_SYS_MEMBARRIER_H
c8d3877e 11
a40161cb
PB
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 */
f703f1ef
PMD
17void smp_mb_global_init(void);
18void smp_mb_global(void);
a40161cb
PB
19#define smp_mb_placeholder() barrier()
20#else
c8d3877e
PB
21/* Keep it simple, execute a real memory barrier on both sides. */
22static inline void smp_mb_global_init(void) {}
23#define smp_mb_global() smp_mb()
24#define smp_mb_placeholder() smp_mb()
a40161cb 25#endif
c8d3877e
PB
26
27#endif