aboutsummaryrefslogtreecommitdiff
path: root/tools/virtio/asm/barrier.h
diff options
context:
space:
mode:
authorPeng Fan2020-12-09 16:42:05 +0800
committerMichael S. Tsirkin2020-12-18 16:14:30 -0500
commit1a5514cbb09aaf694d26ef26fd6da5c5d495cc22 (patch)
tree10461dd17d5212d0f5e57f5297e302826740982e /tools/virtio/asm/barrier.h
parentb9ca93bcd186ec4144df91c619f6084cdad500ec (diff)
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>
Diffstat (limited to 'tools/virtio/asm/barrier.h')
-rw-r--r--tools/virtio/asm/barrier.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/virtio/asm/barrier.h b/tools/virtio/asm/barrier.h
index 04d563fc9b95..468435ed64e6 100644
--- a/tools/virtio/asm/barrier.h
+++ b/tools/virtio/asm/barrier.h
@@ -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