2 * Copyright (C) 2003 Microtronix Datacom Ltd.
3 * Copyright (C) 2000-2002 Greg Ungerer <gerg@snapgear.com>
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive
10 #ifndef _ASM_NIOS2_CACHEFLUSH_H
11 #define _ASM_NIOS2_CACHEFLUSH_H
13 #include <linux/mm_types.h>
16 * This flag is used to indicate that the page pointed to by a pte is clean
17 * and does not require cleaning before returning it to the user.
19 #define PG_dcache_clean PG_arch_1
23 extern void flush_cache_all(void);
24 extern void flush_cache_mm(struct mm_struct
*mm
);
25 extern void flush_cache_dup_mm(struct mm_struct
*mm
);
26 extern void flush_cache_range(struct vm_area_struct
*vma
, unsigned long start
,
28 extern void flush_cache_page(struct vm_area_struct
*vma
, unsigned long vmaddr
,
30 #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
31 void flush_dcache_page(struct page
*page
);
32 void flush_dcache_folio(struct folio
*folio
);
33 #define flush_dcache_folio flush_dcache_folio
35 extern void flush_icache_range(unsigned long start
, unsigned long end
);
36 void flush_icache_pages(struct vm_area_struct
*vma
, struct page
*page
,
38 #define flush_icache_pages flush_icache_pages
40 #define flush_cache_vmap(start, end) flush_dcache_range(start, end)
41 #define flush_cache_vmap_early(start, end) do { } while (0)
42 #define flush_cache_vunmap(start, end) flush_dcache_range(start, end)
44 extern void copy_to_user_page(struct vm_area_struct
*vma
, struct page
*page
,
45 unsigned long user_vaddr
,
46 void *dst
, void *src
, int len
);
47 extern void copy_from_user_page(struct vm_area_struct
*vma
, struct page
*page
,
48 unsigned long user_vaddr
,
49 void *dst
, void *src
, int len
);
51 extern void flush_dcache_range(unsigned long start
, unsigned long end
);
52 extern void invalidate_dcache_range(unsigned long start
, unsigned long end
);
54 #define flush_dcache_mmap_lock(mapping) xa_lock_irq(&mapping->i_pages)
55 #define flush_dcache_mmap_unlock(mapping) xa_unlock_irq(&mapping->i_pages)
56 #define flush_dcache_mmap_lock_irqsave(mapping, flags) \
57 xa_lock_irqsave(&mapping->i_pages, flags)
58 #define flush_dcache_mmap_unlock_irqrestore(mapping, flags) \
59 xa_unlock_irqrestore(&mapping->i_pages, flags)
61 #endif /* _ASM_NIOS2_CACHEFLUSH_H */