From: Guo Ren <ren_guo@xxxxxxxxx> If arch didn't define dma_r/wmb(), linux will use w/rmb instead. Csky use bar.xxx to implement mb() and that will cause problem when sync data with dma device, becasue bar.xxx couldn't guarantee bus transactions finished at outside bus level. We must use sync.s instead of bar.xxx for dma data synchronization and it will guarantee retirement after getting the bus bresponse. Signed-off-by: Guo Ren <ren_guo@xxxxxxxxx> --- arch/csky/include/asm/barrier.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/csky/include/asm/barrier.h b/arch/csky/include/asm/barrier.h index 476eb78..061a633 100644 --- a/arch/csky/include/asm/barrier.h +++ b/arch/csky/include/asm/barrier.h @@ -9,7 +9,9 @@ #define nop() asm volatile ("nop\n":::"memory") /* - * sync: completion barrier + * sync: completion barrier, all sync.xx instructions + * guarantee the last response recieved by bus transaction + * made by ld/st instructions before sync.s * sync.s: completion barrier and shareable to other cores * sync.i: completion barrier with flush cpu pipeline * sync.is: completion barrier with flush cpu pipeline and shareable to @@ -31,6 +33,9 @@ #define rmb() asm volatile ("bar.brar\n":::"memory") #define wmb() asm volatile ("bar.bwaw\n":::"memory") +#define dma_rmb() asm volatile ("sync.s\n":::"memory") +#define dma_wmb() asm volatile ("sync.s\n":::"memory") + #ifdef CONFIG_SMP #define __smp_mb() asm volatile ("bar.brwarws\n":::"memory") #define __smp_rmb() asm volatile ("bar.brars\n":::"memory") -- 2.7.4