1 /* SPDX-License-Identifier: GPL-2.0 */
2 // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
4 #ifndef __ABI_CSKY_CACHEFLUSH_H
5 #define __ABI_CSKY_CACHEFLUSH_H
8 #include <asm/string.h>
11 #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
12 extern void flush_dcache_page(struct page
*);
14 #define flush_cache_mm(mm) dcache_wbinv_all()
15 #define flush_cache_page(vma, page, pfn) cache_wbinv_all()
16 #define flush_cache_dup_mm(mm) cache_wbinv_all()
18 #define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
19 extern void flush_kernel_dcache_page(struct page
*);
21 #define flush_dcache_mmap_lock(mapping) xa_lock_irq(&mapping->i_pages)
22 #define flush_dcache_mmap_unlock(mapping) xa_unlock_irq(&mapping->i_pages)
24 static inline void flush_kernel_vmap_range(void *addr
, int size
)
28 static inline void invalidate_kernel_vmap_range(void *addr
, int size
)
33 #define ARCH_HAS_FLUSH_ANON_PAGE
34 static inline void flush_anon_page(struct vm_area_struct
*vma
,
35 struct page
*page
, unsigned long vmaddr
)
42 * if (current_mm != vma->mm) cache_wbinv_range(start, end) will be broken.
43 * Use cache_wbinv_all() here and need to be improved in future.
45 extern void flush_cache_range(struct vm_area_struct
*vma
, unsigned long start
, unsigned long end
);
46 #define flush_cache_vmap(start, end) cache_wbinv_all()
47 #define flush_cache_vunmap(start, end) cache_wbinv_all()
49 #define flush_icache_page(vma, page) do {} while (0);
50 #define flush_icache_range(start, end) cache_wbinv_range(start, end)
51 #define flush_icache_mm_range(mm, start, end) cache_wbinv_range(start, end)
52 #define flush_icache_deferred(mm) do {} while (0);
54 #define copy_from_user_page(vma, page, vaddr, dst, src, len) \
56 memcpy(dst, src, len); \
59 #define copy_to_user_page(vma, page, vaddr, dst, src, len) \
61 memcpy(dst, src, len); \
65 #endif /* __ABI_CSKY_CACHEFLUSH_H */