[MIPS] Implement flush_anon_page().

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

+29 -3
+15 -1
arch/mips/mm/cache.c
··· 3 3 * License. See the file "COPYING" in the main directory of this archive 4 4 * for more details. 5 5 * 6 - * Copyright (C) 1994 - 2003 by Ralf Baechle 6 + * Copyright (C) 1994 - 2003, 07 by Ralf Baechle (ralf@linux-mips.org) 7 + * Copyright (C) 2007 MIPS Technologies, Inc. 7 8 */ 8 9 #include <linux/init.h> 9 10 #include <linux/kernel.h> ··· 88 87 } 89 88 90 89 EXPORT_SYMBOL(__flush_dcache_page); 90 + 91 + void __flush_anon_page(struct page *page, unsigned long vmaddr) 92 + { 93 + if (pages_do_alias((unsigned long)page_address(page), vmaddr)) { 94 + void *kaddr; 95 + 96 + kaddr = kmap_coherent(page, vmaddr); 97 + flush_data_cache_page((unsigned long)kaddr); 98 + kunmap_coherent(kaddr); 99 + } 100 + } 101 + 102 + EXPORT_SYMBOL(__flush_anon_page); 91 103 92 104 void __update_cache(struct vm_area_struct *vma, unsigned long address, 93 105 pte_t pte)
+2 -2
arch/mips/mm/init.c
··· 123 123 static inline void kmap_coherent_init(void) {} 124 124 #endif 125 125 126 - static inline void *kmap_coherent(struct page *page, unsigned long addr) 126 + void *kmap_coherent(struct page *page, unsigned long addr) 127 127 { 128 128 enum fixed_addresses idx; 129 129 unsigned long vaddr, flags, entrylo; ··· 177 177 178 178 #define UNIQUE_ENTRYHI(idx) (CKSEG0 + ((idx) << (PAGE_SHIFT + 1))) 179 179 180 - static inline void kunmap_coherent(struct page *page) 180 + void kunmap_coherent(struct page *page) 181 181 { 182 182 #ifndef CONFIG_MIPS_MT_SMTC 183 183 unsigned int wired;
+12
include/asm-mips/cacheflush.h
··· 48 48 #define flush_dcache_mmap_lock(mapping) do { } while (0) 49 49 #define flush_dcache_mmap_unlock(mapping) do { } while (0) 50 50 51 + #define ARCH_HAS_FLUSH_ANON_PAGE 52 + extern void __flush_anon_page(struct page *, unsigned long); 53 + static inline void flush_anon_page(struct vm_area_struct *vma, 54 + struct page *page, unsigned long vmaddr) 55 + { 56 + if (cpu_has_dc_aliases && PageAnon(page)) 57 + __flush_anon_page(page, vmaddr); 58 + } 59 + 51 60 static inline void flush_icache_page(struct vm_area_struct *vma, 52 61 struct page *page) 53 62 { ··· 94 85 95 86 /* Run kernel code uncached, useful for cache probing functions. */ 96 87 unsigned long __init run_uncached(void *func); 88 + 89 + extern void *kmap_coherent(struct page *page, unsigned long addr); 90 + extern void kunmap_coherent(struct page *page); 97 91 98 92 #endif /* _ASM_CACHEFLUSH_H */