tools/virtio: add barrier for aarch64

Add barrier for aarch64 for cross compiling, and  most are from Linux Kernel.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/20201209084205.24062-4-peng.fan@oss.nxp.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
Peng Fan 2020-12-09 16:42:05 +08:00 committed by Michael S. Tsirkin
parent b9ca93bcd1
commit 1a5514cbb0
1 changed files with 10 additions and 0 deletions

View File

@ -16,6 +16,16 @@
# define mb() abort()
# define dma_rmb() abort()
# define dma_wmb() abort()
#elif defined(__aarch64__)
#define dmb(opt) asm volatile("dmb " #opt : : : "memory")
#define virt_mb() __sync_synchronize()
#define virt_rmb() dmb(ishld)
#define virt_wmb() dmb(ishst)
#define virt_store_mb(var, value) do { WRITE_ONCE(var, value); dmb(ish); } while (0)
/* Weak barriers should be used. If not - it's a bug */
# define mb() abort()
# define dma_rmb() abort()
# define dma_wmb() abort()
#else
#error Please fill in barrier macros
#endif