csky: syscache: Fixup duplicate cache flush
authorGuo Ren <guoren@linux.alibaba.com>
Tue, 4 May 2021 06:08:44 +0000 (14:08 +0800)
committerGuo Ren <guoren@linux.alibaba.com>
Sun, 4 Jul 2021 09:39:54 +0000 (17:39 +0800)
The current csky logic of sys_cacheflush is wrong, it'll cause
icache flush call dcache flush again. Now fixup it with a
conditional "break & fallthrough".

Fixes: 997153b9a75c ("csky: Add flush_icache_mm to defer flush icache all")
Fixes: 0679d29d3e23 ("csky: fix syscache.c fallthrough warning")
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Co-Developed-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
Cc: Arnd Bergmann <arnd@arndb.de>
arch/csky/mm/syscache.c

index 4e51d63..cd847ad 100644 (file)
@@ -12,15 +12,17 @@ SYSCALL_DEFINE3(cacheflush,
                int, cache)
 {
        switch (cache) {
-       case ICACHE:
        case BCACHE:
-               flush_icache_mm_range(current->mm,
-                               (unsigned long)addr,
-                               (unsigned long)addr + bytes);
-               fallthrough;
        case DCACHE:
                dcache_wb_range((unsigned long)addr,
                                (unsigned long)addr + bytes);
+               if (cache != BCACHE)
+                       break;
+               fallthrough;
+       case ICACHE:
+               flush_icache_mm_range(current->mm,
+                               (unsigned long)addr,
+                               (unsigned long)addr + bytes);
                break;
        default:
                return -EINVAL;