summaryrefslogtreecommitdiff
path: root/sys/external
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2022-04-09 12:49:36 +0000
committerriastradh <riastradh@NetBSD.org>2022-04-09 12:49:36 +0000
commitbbce2b06a3aa7fa73c6c2fe3ff1ae3b8bec68747 (patch)
tree894eaa39f313eb27f5d88e929e2e9d6ba0b053b1 /sys/external
parent92d3f06fbf25f7af954501f6f95fec82ceac318d (diff)
ena: Fix rmb/wmb/mb to match Linux on x86 and aarch64.
This is not right but it's not worse than it was before.
Diffstat (limited to 'sys/external')
-rw-r--r--sys/external/bsd/ena-com/ena_plat.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/sys/external/bsd/ena-com/ena_plat.h b/sys/external/bsd/ena-com/ena_plat.h
index b280a2adb22..62acc6baaf1 100644
--- a/sys/external/bsd/ena-com/ena_plat.h
+++ b/sys/external/bsd/ena-com/ena_plat.h
@@ -38,7 +38,7 @@
#if 0
__FBSDID("$FreeBSD: head/sys/contrib/ena-com/ena_plat.h 333453 2018-05-10 09:25:51Z mw $");
#endif
-__KERNEL_RCSID(0, "$NetBSD: ena_plat.h,v 1.7 2021/07/19 21:16:33 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ena_plat.h,v 1.8 2022/04/09 12:49:36 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -378,8 +378,23 @@ void prefetch(void *x)
#include "ena_defs/ena_includes.h"
+/*
+ * XXX This is not really right. Need to adjust the driver to use
+ * bus_space_barrier or bus_dmamap_sync.
+ */
+#if defined(__i386__) || defined(__x86_64__)
+#include <x86/cpufunc.h>
+#define rmb() x86_lfence()
+#define wmb() x86_sfence()
+#define mb() x86_mfence()
+#elif defined(__aarch64__)
+#define rmb() __asm __volatile("dsb ld" ::: "memory")
+#define wmb() __asm __volatile("dsb st" ::: "memory")
+#define mb() __asm __volatile("dsb sy" ::: "memory")
+#else
#define rmb() membar_enter()
#define wmb() membar_exit()
#define mb() membar_sync()
+#endif
#endif /* ENA_PLAT_H_ */