1 /* SPDX-License-Identifier: GPL-2.0 */
2 // Copyright (C) 2005-2017 Andes Technology Corporation
3 
4 #ifndef __NDS32_CACHEFLUSH_H__
5 #define __NDS32_CACHEFLUSH_H__
6 
7 #include <linux/mm.h>
8 
9 #define PG_dcache_dirty PG_arch_1
10 
11 void flush_icache_range(unsigned long start, unsigned long end);
12 #define flush_icache_range flush_icache_range
13 
14 void flush_icache_page(struct vm_area_struct *vma, struct page *page);
15 #define flush_icache_page flush_icache_page
16 
17 #ifdef CONFIG_CPU_CACHE_ALIASING
18 void flush_cache_mm(struct mm_struct *mm);
19 void flush_cache_dup_mm(struct mm_struct *mm);
20 void flush_cache_range(struct vm_area_struct *vma,
21 		       unsigned long start, unsigned long end);
22 void flush_cache_page(struct vm_area_struct *vma,
23 		      unsigned long addr, unsigned long pfn);
24 void flush_cache_kmaps(void);
25 void flush_cache_vmap(unsigned long start, unsigned long end);
26 void flush_cache_vunmap(unsigned long start, unsigned long end);
27 
28 #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
29 void flush_dcache_page(struct page *page);
30 void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
31 		       unsigned long vaddr, void *dst, void *src, int len);
32 void copy_from_user_page(struct vm_area_struct *vma, struct page *page,
33 			 unsigned long vaddr, void *dst, void *src, int len);
34 
35 #define ARCH_HAS_FLUSH_ANON_PAGE
36 void flush_anon_page(struct vm_area_struct *vma,
37 		     struct page *page, unsigned long vaddr);
38 
39 #define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
40 void flush_kernel_dcache_page(struct page *page);
41 void flush_kernel_vmap_range(void *addr, int size);
42 void invalidate_kernel_vmap_range(void *addr, int size);
43 #define flush_dcache_mmap_lock(mapping)   xa_lock_irq(&(mapping)->i_pages)
44 #define flush_dcache_mmap_unlock(mapping) xa_unlock_irq(&(mapping)->i_pages)
45 
46 #else
47 void flush_icache_user_page(struct vm_area_struct *vma, struct page *page,
48 	                     unsigned long addr, int len);
49 #define flush_icache_user_page flush_icache_user_page
50 
51 #include <asm-generic/cacheflush.h>
52 #endif
53 
54 #endif /* __NDS32_CACHEFLUSH_H__ */
55