diff options
-rw-r--r-- | arch/mips/mm/cache.c | 16 | ||||
-rw-r--r-- | arch/mips/mm/init.c | 4 | ||||
-rw-r--r-- | include/asm-mips/cacheflush.h | 12 |
3 files changed, 29 insertions, 3 deletions
diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c index 31819c58bffa..4e8f1b683376 100644 --- a/arch/mips/mm/cache.c +++ b/arch/mips/mm/cache.c | |||
@@ -3,7 +3,8 @@ | |||
3 | * License. See the file "COPYING" in the main directory of this archive | 3 | * License. See the file "COPYING" in the main directory of this archive |
4 | * for more details. | 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 | #include <linux/init.h> | 9 | #include <linux/init.h> |
9 | #include <linux/kernel.h> | 10 | #include <linux/kernel.h> |
@@ -88,6 +89,19 @@ void __flush_dcache_page(struct page *page) | |||
88 | 89 | ||
89 | EXPORT_SYMBOL(__flush_dcache_page); | 90 | EXPORT_SYMBOL(__flush_dcache_page); |
90 | 91 | ||
92 | void __flush_anon_page(struct page *page, unsigned long vmaddr) | ||
93 | { | ||
94 | if (pages_do_alias((unsigned long)page_address(page), vmaddr)) { | ||
95 | void *kaddr; | ||
96 | |||
97 | kaddr = kmap_coherent(page, vmaddr); | ||
98 | flush_data_cache_page((unsigned long)kaddr); | ||
99 | kunmap_coherent(kaddr); | ||
100 | } | ||
101 | } | ||
102 | |||
103 | EXPORT_SYMBOL(__flush_anon_page); | ||
104 | |||
91 | void __update_cache(struct vm_area_struct *vma, unsigned long address, | 105 | void __update_cache(struct vm_area_struct *vma, unsigned long address, |
92 | pte_t pte) | 106 | pte_t pte) |
93 | { | 107 | { |
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c index 25abe91da4ac..e9951c0e689f 100644 --- a/arch/mips/mm/init.c +++ b/arch/mips/mm/init.c | |||
@@ -123,7 +123,7 @@ static void __init kmap_coherent_init(void) | |||
123 | static inline void kmap_coherent_init(void) {} | 123 | static inline void kmap_coherent_init(void) {} |
124 | #endif | 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 | enum fixed_addresses idx; | 128 | enum fixed_addresses idx; |
129 | unsigned long vaddr, flags, entrylo; | 129 | unsigned long vaddr, flags, entrylo; |
@@ -177,7 +177,7 @@ static inline void *kmap_coherent(struct page *page, unsigned long addr) | |||
177 | 177 | ||
178 | #define UNIQUE_ENTRYHI(idx) (CKSEG0 + ((idx) << (PAGE_SHIFT + 1))) | 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 | #ifndef CONFIG_MIPS_MT_SMTC | 182 | #ifndef CONFIG_MIPS_MT_SMTC |
183 | unsigned int wired; | 183 | unsigned int wired; |
diff --git a/include/asm-mips/cacheflush.h b/include/asm-mips/cacheflush.h index 0ddada3bb0b6..28d907d4347a 100644 --- a/include/asm-mips/cacheflush.h +++ b/include/asm-mips/cacheflush.h | |||
@@ -48,6 +48,15 @@ static inline void flush_dcache_page(struct page *page) | |||
48 | #define flush_dcache_mmap_lock(mapping) do { } while (0) | 48 | #define flush_dcache_mmap_lock(mapping) do { } while (0) |
49 | #define flush_dcache_mmap_unlock(mapping) do { } while (0) | 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 | static inline void flush_icache_page(struct vm_area_struct *vma, | 60 | static inline void flush_icache_page(struct vm_area_struct *vma, |
52 | struct page *page) | 61 | struct page *page) |
53 | { | 62 | { |
@@ -86,4 +95,7 @@ extern void (*flush_data_cache_page)(unsigned long addr); | |||
86 | /* Run kernel code uncached, useful for cache probing functions. */ | 95 | /* Run kernel code uncached, useful for cache probing functions. */ |
87 | unsigned long __init run_uncached(void *func); | 96 | unsigned long __init run_uncached(void *func); |
88 | 97 | ||
98 | extern void *kmap_coherent(struct page *page, unsigned long addr); | ||
99 | extern void kunmap_coherent(struct page *page); | ||
100 | |||
89 | #endif /* _ASM_CACHEFLUSH_H */ | 101 | #endif /* _ASM_CACHEFLUSH_H */ |