Skip to contentSkip to conversation

libibverbs: add ARM64 memory barrier macros

PATCH New Steve Wise 1 participant 1 message May 20, 2016 InfiniBand

lore
Share & tools
lore

Steve Wise

author
#0 lore raw

PATCH 1/2 libibverbs: add ARM64 memory barrier macros

The default generic barriers are not correct for ARM64. This results in data corruption. The correct macros are based on the ARM Compiler Toolchain Assembler Reference documenation.

---
 include/infiniband/arch.h |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
include/infiniband/arch.h +8 -0
index bc1738a..3808bb2 100644
@@ -122,6 +122,14 @@ static inline uint64_t ntohll(uint64_t x) { return x; }
 #define wmb()	mb()					/* for s390x */
 #define wc_wmb() wmb()					/* for s390x */
 
+#elif defined(__aarch64__)
+
+/* Perhaps dmb would be sufficient? Let us be conservative for now. */
+#define mb() 	asm volatile("dsb sy" ::: "memory")
+#define rmb()	asm volatile("dsb ld" ::: "memory")
+#define wmb()	asm volatile("dsb st" ::: "memory")
+#define wc_wmb() wmb()
+
 #else
 
 #warning No architecture specific defines found.  Using generic implementation.
Signature · 6 lines
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html