x86 has dmb() and mb(), but no rmb() and no wmb(). Drivers that use them
do not build. drivers/usb/dwc3/gadget.c is one of them. It calls wmb()
around the trb setup.

x86 is total store order, so a compiler barrier is enough for normal
memory. The kernel uses lfence and sfence here, but those need SSE2 and
galileo is i586. dmb() is what __iormb() and __iowmb() already use, so
use that.

Reported-by: Marek Vasut <[email protected]>
Signed-off-by: Anders Roxell <[email protected]>
---
 arch/x86/include/asm/io.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index 1390193f09c7..bd6c3bbfd2f3 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -241,6 +241,8 @@ static inline void sync(void)
  */
 #define dmb()          __asm__ __volatile__ ("" : : : "memory")
 #define mb()           __asm__ __volatile__ ("mfence" : : : "memory")
+#define rmb()          dmb()
+#define wmb()          dmb()
 #define __iormb()      dmb()
 #define __iowmb()      dmb()
 
-- 
2.53.0

Reply via email to