2018-02-16 10:04:18 +01:00
|
|
|
/*
|
|
|
|
* Process-global memory barriers
|
|
|
|
*
|
|
|
|
* Copyright (c) 2018 Red Hat, Inc.
|
|
|
|
*
|
|
|
|
* Author: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef QEMU_SYS_MEMBARRIER_H
|
2019-03-15 15:51:22 +01:00
|
|
|
#define QEMU_SYS_MEMBARRIER_H
|
2018-02-16 10:04:18 +01:00
|
|
|
|
2018-02-16 10:05:23 +01:00
|
|
|
#ifdef CONFIG_MEMBARRIER
|
|
|
|
/* Only block reordering at the compiler level in the performance-critical
|
|
|
|
* side. The slow side forces processor-level ordering on all other cores
|
|
|
|
* through a system call.
|
|
|
|
*/
|
|
|
|
extern void smp_mb_global_init(void);
|
|
|
|
extern void smp_mb_global(void);
|
|
|
|
#define smp_mb_placeholder() barrier()
|
|
|
|
#else
|
2018-02-16 10:04:18 +01:00
|
|
|
/* Keep it simple, execute a real memory barrier on both sides. */
|
|
|
|
static inline void smp_mb_global_init(void) {}
|
|
|
|
#define smp_mb_global() smp_mb()
|
|
|
|
#define smp_mb_placeholder() smp_mb()
|
2018-02-16 10:05:23 +01:00
|
|
|
#endif
|
2018-02-16 10:04:18 +01:00
|
|
|
|
|
|
|
#endif
|