1 --- a/arch/mips/include/asm/cpu-features.h
2 +++ b/arch/mips/include/asm/cpu-features.h
4 #ifndef cpu_has_local_ebase
5 #define cpu_has_local_ebase 1
7 +#ifndef cpu_use_kmap_coherent
8 +#define cpu_use_kmap_coherent 1
12 * I-Cache snoops remote store. This only matters on SMP. Some multiprocessors
13 --- a/arch/mips/include/asm/mach-bcm47xx/cpu-feature-overrides.h
14 +++ b/arch/mips/include/asm/mach-bcm47xx/cpu-feature-overrides.h
16 #define cpu_scache_line_size() 0
19 +#define cpu_use_kmap_coherent 0
21 #endif /* __ASM_MACH_BCM47XX_CPU_FEATURE_OVERRIDES_H */
22 --- a/arch/mips/mm/c-r4k.c
23 +++ b/arch/mips/mm/c-r4k.c
24 @@ -523,7 +523,7 @@ static inline void local_r4k_flush_cache
26 map_coherent = (cpu_has_dc_aliases &&
27 page_mapped(page) && !Page_dcache_dirty(page));
29 + if (map_coherent && cpu_use_kmap_coherent)
30 vaddr = kmap_coherent(page, addr);
32 vaddr = kmap_atomic(page);
33 @@ -546,7 +546,7 @@ static inline void local_r4k_flush_cache
38 + if (map_coherent && cpu_use_kmap_coherent)
42 --- a/arch/mips/mm/init.c
43 +++ b/arch/mips/mm/init.c
44 @@ -200,7 +200,7 @@ void copy_user_highpage(struct page *to,
47 vto = kmap_atomic(to);
48 - if (cpu_has_dc_aliases &&
49 + if (cpu_has_dc_aliases && cpu_use_kmap_coherent &&
50 page_mapped(from) && !Page_dcache_dirty(from)) {
51 vfrom = kmap_coherent(from, vaddr);
52 copy_page(vto, vfrom);
53 @@ -222,7 +222,7 @@ void copy_to_user_page(struct vm_area_st
54 struct page *page, unsigned long vaddr, void *dst, const void *src,
57 - if (cpu_has_dc_aliases &&
58 + if (cpu_has_dc_aliases && cpu_use_kmap_coherent &&
59 page_mapped(page) && !Page_dcache_dirty(page)) {
60 void *vto = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
61 memcpy(vto, src, len);
62 @@ -240,7 +240,7 @@ void copy_from_user_page(struct vm_area_
63 struct page *page, unsigned long vaddr, void *dst, const void *src,
66 - if (cpu_has_dc_aliases &&
67 + if (cpu_has_dc_aliases && cpu_use_kmap_coherent &&
68 page_mapped(page) && !Page_dcache_dirty(page)) {
69 void *vfrom = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
70 memcpy(dst, vfrom, len);