[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20201209084205.24062-4-peng.fan@oss.nxp.com>
Date: Wed, 9 Dec 2020 16:42:05 +0800
From: "Peng Fan (OSS)" <peng.fan@....nxp.com>
To: mst@...hat.com, jasowang@...hat.com,
virtualization@...ts.linux-foundation.org, catalin.marinas@....com,
will@...nel.org, maz@...nel.org
Cc: linux-kernel@...r.kernel.org, linux-imx@....com,
van.freenix@...il.com, Peng Fan <peng.fan@....com>
Subject: [PATCH 3/3] tools/virtio: add barrier for aarch64
From: Peng Fan <peng.fan@....com>
Add barrier for aarch64 for cross compiling, and most are from Linux Kernel.
Signed-off-by: Peng Fan <peng.fan@....com>
---
tools/virtio/asm/barrier.h | 10 ++++++++++
1 file changed, 10 insertions(+)
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
--
2.28.0
Powered by blists - more mailing lists