]> xenbits.xensource.com Git - people/aperard/linux.git/commitdiff
riscv/barrier: Define __{mb,rmb,wmb}
authorEric Chan <ericchancf@google.com>
Sat, 17 Feb 2024 13:12:49 +0000 (13:12 +0000)
committerPalmer Dabbelt <palmer@rivosinc.com>
Wed, 20 Mar 2024 01:52:22 +0000 (18:52 -0700)
Introduce __{mb,rmb,wmb}, and rely on the generic definitions for
{mb,rmb,wmb}. Although KCSAN is not supported yet, the definitions can
be made more consistent with generic instrumentation. Also add a space
to make the changes pass check by checkpatch.pl.
Without the space, the error message is as below:
ERROR: space required after that ',' (ctx:VxV)
26: FILE: arch/riscv/include/asm/barrier.h:23:
+#define __mb()         RISCV_FENCE(iorw,iorw)
                                        ^

Signed-off-by: Eric Chan <ericchancf@google.com>
Reviewed-by: Andrea Parri <parri.andrea@gmail.com>
Reviewed-by: Samuel Holland <samuel.holland@sifive.com>
Tested-by: Samuel Holland <samuel.holland@sifive.com>
Link: https://lore.kernel.org/r/20240217131249.3668103-1-ericchancf@google.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/include/asm/barrier.h

index 110752594228e23125bd7a16b4c0469cbfcda4f5..173b44a989f8bad72e59e267dcffc9849c66ea92 100644 (file)
@@ -20,9 +20,9 @@
        __asm__ __volatile__ ("fence " #p "," #s : : : "memory")
 
 /* These barriers need to enforce ordering on both devices or memory. */
-#define mb()           RISCV_FENCE(iorw,iorw)
-#define rmb()          RISCV_FENCE(ir,ir)
-#define wmb()          RISCV_FENCE(ow,ow)
+#define __mb()         RISCV_FENCE(iorw, iorw)
+#define __rmb()                RISCV_FENCE(ir, ir)
+#define __wmb()                RISCV_FENCE(ow, ow)
 
 /* These barriers do not need to enforce ordering on devices, just memory. */
 #define __smp_mb()     RISCV_FENCE(rw,rw)