Module Name:    src
Committed By:   riastradh
Date:           Sat Apr  9 12:49:37 UTC 2022

Modified Files:
        src/sys/external/bsd/ena-com: ena_plat.h

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/ena-com/ena_plat.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/ena-com/ena_plat.h
diff -u src/sys/external/bsd/ena-com/ena_plat.h:1.7 src/sys/external/bsd/ena-com/ena_plat.h:1.8
--- src/sys/external/bsd/ena-com/ena_plat.h:1.7	Mon Jul 19 21:16:33 2021
+++ src/sys/external/bsd/ena-com/ena_plat.h	Sat Apr  9 12:49:36 2022
@@ -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_ */

Reply via email to