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 коммит произвёл Michael S. Tsirkin
Родитель b9ca93bcd1
Коммит 1a5514cbb0
1 изменённых файлов: 10 добавлений и 0 удалений

Просмотреть файл

@ -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