mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
To: mst@redhat.com, jasowang@redhat.com,
	virtualization@lists.linux-foundation.org,
	catalin.marinas@arm.com, will@kernel.org, maz@kernel.org
Cc: linux-kernel@vger.kernel.org, linux-imx@nxp.com,
	van.freenix@gmail.com, Peng Fan <peng.fan@nxp.com>
Subject: [PATCH 3/3] tools/virtio: add barrier for aarch64
Date: Wed,  9 Dec 2020 16:42:05 +0800	[thread overview]
Message-ID: <20201209084205.24062-4-peng.fan@oss.nxp.com> (raw)
In-Reply-To: <20201209084205.24062-1-peng.fan@oss.nxp.com>

From: Peng Fan <peng.fan@nxp.com>

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

Signed-off-by: Peng Fan <peng.fan@nxp.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


      parent reply	other threads:[~2020-12-09  8:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-09  8:42 [PATCH 0/3] tools/virtio: support aarch64 cross compiling Peng Fan (OSS)
2020-12-09  8:42 ` [PATCH 1/3] tools/virtio: include asm/bug.h Peng Fan (OSS)
2020-12-09  8:42 ` [PATCH 2/3] tools/virtio: add krealloc_array Peng Fan (OSS)
2020-12-09  8:42 ` Peng Fan (OSS) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201209084205.24062-4-peng.fan@oss.nxp.com \
    --to=peng.fan@oss.nxp.com \
    --cc=catalin.marinas@arm.com \
    --cc=jasowang@redhat.com \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=mst@redhat.com \
    --cc=peng.fan@nxp.com \
    --cc=van.freenix@gmail.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®