diff options
-rw-r--r-- | arch/mips/include/asm/cacheflush.h | 24 | ||||
-rw-r--r-- | arch/mips/mm/c-octeon.c | 6 | ||||
-rw-r--r-- | arch/mips/mm/c-r3k.c | 7 | ||||
-rw-r--r-- | arch/mips/mm/c-r4k.c | 35 | ||||
-rw-r--r-- | arch/mips/mm/c-tx39.c | 7 | ||||
-rw-r--r-- | arch/mips/mm/cache.c | 5 |
6 files changed, 84 insertions, 0 deletions
diff --git a/arch/mips/include/asm/cacheflush.h b/arch/mips/include/asm/cacheflush.h index 40bb9fde205f..69468ded2828 100644 --- a/arch/mips/include/asm/cacheflush.h +++ b/arch/mips/include/asm/cacheflush.h | |||
@@ -114,4 +114,28 @@ unsigned long run_uncached(void *func); | |||
114 | extern void *kmap_coherent(struct page *page, unsigned long addr); | 114 | extern void *kmap_coherent(struct page *page, unsigned long addr); |
115 | extern void kunmap_coherent(void); | 115 | extern void kunmap_coherent(void); |
116 | 116 | ||
117 | #define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE | ||
118 | static inline void flush_kernel_dcache_page(struct page *page) | ||
119 | { | ||
120 | BUG_ON(cpu_has_dc_aliases && PageHighMem(page)); | ||
121 | } | ||
122 | |||
123 | /* | ||
124 | * For now flush_kernel_vmap_range and invalidate_kernel_vmap_range both do a | ||
125 | * cache writeback and invalidate operation. | ||
126 | */ | ||
127 | extern void (*__flush_kernel_vmap_range)(unsigned long vaddr, int size); | ||
128 | |||
129 | static inline void flush_kernel_vmap_range(void *vaddr, int size) | ||
130 | { | ||
131 | if (cpu_has_dc_aliases) | ||
132 | __flush_kernel_vmap_range((unsigned long) vaddr, size); | ||
133 | } | ||
134 | |||
135 | static inline void invalidate_kernel_vmap_range(void *vaddr, int size) | ||
136 | { | ||
137 | if (cpu_has_dc_aliases) | ||
138 | __flush_kernel_vmap_range((unsigned long) vaddr, size); | ||
139 | } | ||
140 | |||
117 | #endif /* _ASM_CACHEFLUSH_H */ | 141 | #endif /* _ASM_CACHEFLUSH_H */ |
diff --git a/arch/mips/mm/c-octeon.c b/arch/mips/mm/c-octeon.c index 16c4d256b76f..daa81f7284ac 100644 --- a/arch/mips/mm/c-octeon.c +++ b/arch/mips/mm/c-octeon.c | |||
@@ -169,6 +169,10 @@ static void octeon_flush_cache_page(struct vm_area_struct *vma, | |||
169 | octeon_flush_icache_all_cores(vma); | 169 | octeon_flush_icache_all_cores(vma); |
170 | } | 170 | } |
171 | 171 | ||
172 | static void octeon_flush_kernel_vmap_range(unsigned long vaddr, int size) | ||
173 | { | ||
174 | BUG(); | ||
175 | } | ||
172 | 176 | ||
173 | /** | 177 | /** |
174 | * Probe Octeon's caches | 178 | * Probe Octeon's caches |
@@ -273,6 +277,8 @@ void __cpuinit octeon_cache_init(void) | |||
273 | flush_icache_range = octeon_flush_icache_range; | 277 | flush_icache_range = octeon_flush_icache_range; |
274 | local_flush_icache_range = local_octeon_flush_icache_range; | 278 | local_flush_icache_range = local_octeon_flush_icache_range; |
275 | 279 | ||
280 | __flush_kernel_vmap_range = octeon_flush_kernel_vmap_range; | ||
281 | |||
276 | build_clear_page(); | 282 | build_clear_page(); |
277 | build_copy_page(); | 283 | build_copy_page(); |
278 | } | 284 | } |
diff --git a/arch/mips/mm/c-r3k.c b/arch/mips/mm/c-r3k.c index e6b0efd3f6a4..0765583d0c92 100644 --- a/arch/mips/mm/c-r3k.c +++ b/arch/mips/mm/c-r3k.c | |||
@@ -299,6 +299,11 @@ static void r3k_flush_cache_sigtramp(unsigned long addr) | |||
299 | write_c0_status(flags); | 299 | write_c0_status(flags); |
300 | } | 300 | } |
301 | 301 | ||
302 | static void r3k_flush_kernel_vmap_range(unsigned long vaddr, int size) | ||
303 | { | ||
304 | BUG(); | ||
305 | } | ||
306 | |||
302 | static void r3k_dma_cache_wback_inv(unsigned long start, unsigned long size) | 307 | static void r3k_dma_cache_wback_inv(unsigned long start, unsigned long size) |
303 | { | 308 | { |
304 | /* Catch bad driver code */ | 309 | /* Catch bad driver code */ |
@@ -323,6 +328,8 @@ void __cpuinit r3k_cache_init(void) | |||
323 | flush_icache_range = r3k_flush_icache_range; | 328 | flush_icache_range = r3k_flush_icache_range; |
324 | local_flush_icache_range = r3k_flush_icache_range; | 329 | local_flush_icache_range = r3k_flush_icache_range; |
325 | 330 | ||
331 | __flush_kernel_vmap_range = r3k_flush_kernel_vmap_range; | ||
332 | |||
326 | flush_cache_sigtramp = r3k_flush_cache_sigtramp; | 333 | flush_cache_sigtramp = r3k_flush_cache_sigtramp; |
327 | local_flush_data_cache_page = local_r3k_flush_data_cache_page; | 334 | local_flush_data_cache_page = local_r3k_flush_data_cache_page; |
328 | flush_data_cache_page = r3k_flush_data_cache_page; | 335 | flush_data_cache_page = r3k_flush_data_cache_page; |
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c index b9aabb998a32..a79fe9aa7721 100644 --- a/arch/mips/mm/c-r4k.c +++ b/arch/mips/mm/c-r4k.c | |||
@@ -722,6 +722,39 @@ static void r4k_flush_icache_all(void) | |||
722 | r4k_blast_icache(); | 722 | r4k_blast_icache(); |
723 | } | 723 | } |
724 | 724 | ||
725 | struct flush_kernel_vmap_range_args { | ||
726 | unsigned long vaddr; | ||
727 | int size; | ||
728 | }; | ||
729 | |||
730 | static inline void local_r4k_flush_kernel_vmap_range(void *args) | ||
731 | { | ||
732 | struct flush_kernel_vmap_range_args *vmra = args; | ||
733 | unsigned long vaddr = vmra->vaddr; | ||
734 | int size = vmra->size; | ||
735 | |||
736 | /* | ||
737 | * Aliases only affect the primary caches so don't bother with | ||
738 | * S-caches or T-caches. | ||
739 | */ | ||
740 | if (cpu_has_safe_index_cacheops && size >= dcache_size) | ||
741 | r4k_blast_dcache(); | ||
742 | else { | ||
743 | R4600_HIT_CACHEOP_WAR_IMPL; | ||
744 | blast_dcache_range(vaddr, vaddr + size); | ||
745 | } | ||
746 | } | ||
747 | |||
748 | static void r4k_flush_kernel_vmap_range(unsigned long vaddr, int size) | ||
749 | { | ||
750 | struct flush_kernel_vmap_range_args args; | ||
751 | |||
752 | args.vaddr = (unsigned long) vaddr; | ||
753 | args.size = size; | ||
754 | |||
755 | r4k_on_each_cpu(local_r4k_flush_kernel_vmap_range, &args); | ||
756 | } | ||
757 | |||
725 | static inline void rm7k_erratum31(void) | 758 | static inline void rm7k_erratum31(void) |
726 | { | 759 | { |
727 | const unsigned long ic_lsize = 32; | 760 | const unsigned long ic_lsize = 32; |
@@ -1403,6 +1436,8 @@ void __cpuinit r4k_cache_init(void) | |||
1403 | flush_cache_page = r4k_flush_cache_page; | 1436 | flush_cache_page = r4k_flush_cache_page; |
1404 | flush_cache_range = r4k_flush_cache_range; | 1437 | flush_cache_range = r4k_flush_cache_range; |
1405 | 1438 | ||
1439 | __flush_kernel_vmap_range = r4k_flush_kernel_vmap_range; | ||
1440 | |||
1406 | flush_cache_sigtramp = r4k_flush_cache_sigtramp; | 1441 | flush_cache_sigtramp = r4k_flush_cache_sigtramp; |
1407 | flush_icache_all = r4k_flush_icache_all; | 1442 | flush_icache_all = r4k_flush_icache_all; |
1408 | local_flush_data_cache_page = local_r4k_flush_data_cache_page; | 1443 | local_flush_data_cache_page = local_r4k_flush_data_cache_page; |
diff --git a/arch/mips/mm/c-tx39.c b/arch/mips/mm/c-tx39.c index d352fad3e451..a43c197ccf8c 100644 --- a/arch/mips/mm/c-tx39.c +++ b/arch/mips/mm/c-tx39.c | |||
@@ -253,6 +253,11 @@ static void tx39_flush_icache_range(unsigned long start, unsigned long end) | |||
253 | } | 253 | } |
254 | } | 254 | } |
255 | 255 | ||
256 | static void tx39_flush_kernel_vmap_range(unsigned long vaddr, int size) | ||
257 | { | ||
258 | BUG(); | ||
259 | } | ||
260 | |||
256 | static void tx39_dma_cache_wback_inv(unsigned long addr, unsigned long size) | 261 | static void tx39_dma_cache_wback_inv(unsigned long addr, unsigned long size) |
257 | { | 262 | { |
258 | unsigned long end; | 263 | unsigned long end; |
@@ -394,6 +399,8 @@ void __cpuinit tx39_cache_init(void) | |||
394 | flush_icache_range = tx39_flush_icache_range; | 399 | flush_icache_range = tx39_flush_icache_range; |
395 | local_flush_icache_range = tx39_flush_icache_range; | 400 | local_flush_icache_range = tx39_flush_icache_range; |
396 | 401 | ||
402 | __flush_kernel_vmap_range = tx39_flush_kernel_vmap_range; | ||
403 | |||
397 | flush_cache_sigtramp = tx39_flush_cache_sigtramp; | 404 | flush_cache_sigtramp = tx39_flush_cache_sigtramp; |
398 | local_flush_data_cache_page = local_tx39_flush_data_cache_page; | 405 | local_flush_data_cache_page = local_tx39_flush_data_cache_page; |
399 | flush_data_cache_page = tx39_flush_data_cache_page; | 406 | flush_data_cache_page = tx39_flush_data_cache_page; |
diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c index 12af739048fa..829320c7b175 100644 --- a/arch/mips/mm/cache.c +++ b/arch/mips/mm/cache.c | |||
@@ -35,6 +35,11 @@ void (*local_flush_icache_range)(unsigned long start, unsigned long end); | |||
35 | void (*__flush_cache_vmap)(void); | 35 | void (*__flush_cache_vmap)(void); |
36 | void (*__flush_cache_vunmap)(void); | 36 | void (*__flush_cache_vunmap)(void); |
37 | 37 | ||
38 | void (*__flush_kernel_vmap_range)(unsigned long vaddr, int size); | ||
39 | void (*__invalidate_kernel_vmap_range)(unsigned long vaddr, int size); | ||
40 | |||
41 | EXPORT_SYMBOL_GPL(__flush_kernel_vmap_range); | ||
42 | |||
38 | /* MIPS specific cache operations */ | 43 | /* MIPS specific cache operations */ |
39 | void (*flush_cache_sigtramp)(unsigned long addr); | 44 | void (*flush_cache_sigtramp)(unsigned long addr); |
40 | void (*local_flush_data_cache_page)(void * addr); | 45 | void (*local_flush_data_cache_page)(void * addr); |