]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
csky: Fixup mb() synchronization problem
authorGuo Ren <ren_guo@c-sky.com>
Tue, 30 Jul 2019 06:08:07 +0000 (14:08 +0800)
committerGuo Ren <ren_guo@c-sky.com>
Wed, 31 Jul 2019 03:04:29 +0000 (11:04 +0800)
The mb() is the superset of dma and smp. Using bar.xxx to implement
mb() 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.

Changes for V2:
 - Use sync.s for all mb, rmb, wmb, dma_wmb, dma_rmb.

Signed-off-by: Guo Ren <ren_guo@c-sky.com>
Cc: Arnd Bergmann <arnd@arndb.de>
arch/csky/include/asm/barrier.h

index 476eb786f22de9e3130d5db47816a32b5371585c..a430e7fddf350cff5e5f24b5719b66b54b3da426 100644 (file)
@@ -9,11 +9,12 @@
 #define nop()  asm volatile ("nop\n":::"memory")
 
 /*
- * sync:        completion barrier
- * 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
- *             other cores
+ * 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:      inherit from sync, but also shareable to other cores
+ * sync.i:      inherit from sync, but also flush cpu pipeline
+ * sync.is:     the same with sync.i + sync.s
  *
  * bar.brwarw:  ordering barrier for all load/store instructions before it
  * bar.brwarws: ordering barrier for all load/store instructions before it
@@ -27,9 +28,7 @@
  */
 
 #ifdef CONFIG_CPU_HAS_CACHEV2
-#define mb()           asm volatile ("bar.brwarw\n":::"memory")
-#define rmb()          asm volatile ("bar.brar\n":::"memory")
-#define wmb()          asm volatile ("bar.bwaw\n":::"memory")
+#define mb()           asm volatile ("sync.s\n":::"memory")
 
 #ifdef CONFIG_SMP
 #define __smp_mb()     asm volatile ("bar.brwarws\n":::"memory")