1 /* SPDX-License-Identifier: GPL-2.0 */ 2 // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd. 3 4 #ifndef __ABI_CSKY_CACHEFLUSH_H 5 #define __ABI_CSKY_CACHEFLUSH_H 6 7 #include <linux/compiler.h> 8 #include <asm/string.h> 9 #include <asm/cache.h> 10 11 #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 12 extern void flush_dcache_page(struct page *); 13 14 #define flush_cache_mm(mm) cache_wbinv_all() 15 #define flush_cache_page(vma, page, pfn) cache_wbinv_all() 16 #define flush_cache_dup_mm(mm) cache_wbinv_all() 17 18 /* 19 * if (current_mm != vma->mm) cache_wbinv_range(start, end) will be broken. 20 * Use cache_wbinv_all() here and need to be improved in future. 21 */ 22 #define flush_cache_range(vma, start, end) cache_wbinv_all() 23 #define flush_cache_vmap(start, end) cache_wbinv_range(start, end) 24 #define flush_cache_vunmap(start, end) cache_wbinv_range(start, end) 25 26 #define flush_icache_page(vma, page) cache_wbinv_all() 27 #define flush_icache_range(start, end) cache_wbinv_range(start, end) 28 29 #define flush_icache_user_range(vma, pg, adr, len) \ 30 cache_wbinv_range(adr, adr + len) 31 32 #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ 33 do { \ 34 cache_wbinv_all(); \ 35 memcpy(dst, src, len); \ 36 cache_wbinv_all(); \ 37 } while (0) 38 39 #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ 40 do { \ 41 cache_wbinv_all(); \ 42 memcpy(dst, src, len); \ 43 cache_wbinv_all(); \ 44 } while (0) 45 46 #define flush_dcache_mmap_lock(mapping) do {} while (0) 47 #define flush_dcache_mmap_unlock(mapping) do {} while (0) 48 49 #endif /* __ABI_CSKY_CACHEFLUSH_H */ 50