mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-05 06:39:27 +00:00
tools/virtio: use virt_xxx barriers
Fix build after API changes. Reported-by: Kamal Mostafa <kamal@canonical.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
2989be09a8
commit
a7c490333d
@ -1,15 +1,19 @@
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#define barrier() asm volatile("" ::: "memory")
|
||||
#define mb() __sync_synchronize()
|
||||
|
||||
#define smp_mb() mb()
|
||||
# define dma_rmb() barrier()
|
||||
# define dma_wmb() barrier()
|
||||
# define smp_rmb() barrier()
|
||||
# define smp_wmb() barrier()
|
||||
#define virt_mb() __sync_synchronize()
|
||||
#define virt_rmb() barrier()
|
||||
#define virt_wmb() barrier()
|
||||
/* Atomic store should be enough, but gcc generates worse code in that case. */
|
||||
#define virt_store_mb(var, value) do { \
|
||||
typeof(var) virt_store_mb_value = (value); \
|
||||
__atomic_exchange(&(var), &virt_store_mb_value, &virt_store_mb_value, \
|
||||
__ATOMIC_SEQ_CST); \
|
||||
barrier(); \
|
||||
} while (0);
|
||||
/* Weak barriers should be used. If not - it's a bug */
|
||||
# define rmb() abort()
|
||||
# define wmb() abort()
|
||||
# define mb() abort()
|
||||
# define rmb() abort()
|
||||
# define wmb() abort()
|
||||
#else
|
||||
#error Please fill in barrier macros
|
||||
#endif
|
||||
|
9
tools/virtio/linux/compiler.h
Normal file
9
tools/virtio/linux/compiler.h
Normal file
@ -0,0 +1,9 @@
|
||||
#ifndef LINUX_COMPILER_H
|
||||
#define LINUX_COMPILER_H
|
||||
|
||||
#define WRITE_ONCE(var, val) \
|
||||
(*((volatile typeof(val) *)(&(var))) = (val))
|
||||
|
||||
#define READ_ONCE(var) (*((volatile typeof(val) *)(&(var))))
|
||||
|
||||
#endif
|
@ -8,6 +8,7 @@
|
||||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/printk.h>
|
||||
#include <linux/bug.h>
|
||||
|
Loading…
Reference in New Issue
Block a user