1 diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h
2 --- a/arch/mips/include/asm/cpu-features.h
3 +++ b/arch/mips/include/asm/cpu-features.h
5 #ifndef cpu_has_pindexed_dcache
6 #define cpu_has_pindexed_dcache (cpu_data[0].dcache.flags & MIPS_CACHE_PINDEX)
8 +#ifndef cpu_use_kmap_coherent
9 +#define cpu_use_kmap_coherent 1
13 * I-Cache snoops remote store. This only matters on SMP. Some multiprocessors
14 diff --git a/arch/mips/include/asm/mach-bcm47xx/cpu-feature-overrides.h b/arch/mips/include/asm/mach-bcm47xx/cpu-feature-overrides.h
16 +++ b/arch/mips/include/asm/mach-bcm47xx/cpu-feature-overrides.h
19 + * This file is subject to the terms and conditions of the GNU General Public
20 + * License. See the file "COPYING" in the main directory of this archive
23 + * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
25 +#ifndef __ASM_MACH_BCM47XX_CPU_FEATURE_OVERRIDES_H
26 +#define __ASM_MACH_BCM47XX_CPU_FEATURE_OVERRIDES_H
28 +#define cpu_use_kmap_coherent 0
30 +#endif /* __ASM_MACH_BCM47XX_CPU_FEATURE_OVERRIDES_H */
31 diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
32 --- a/arch/mips/mm/c-r4k.c
33 +++ b/arch/mips/mm/c-r4k.c
34 @@ -494,7 +494,7 @@ static inline void local_r4k_flush_cache_page(void *args)
36 map_coherent = (cpu_has_dc_aliases &&
37 page_mapped(page) && !Page_dcache_dirty(page));
39 + if (map_coherent && cpu_use_kmap_coherent)
40 vaddr = kmap_coherent(page, addr);
42 vaddr = kmap_atomic(page, KM_USER0);
43 @@ -517,7 +517,7 @@ static inline void local_r4k_flush_cache_page(void *args)
48 + if (map_coherent && cpu_use_kmap_coherent)
51 kunmap_atomic(vaddr, KM_USER0);
52 diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
53 --- a/arch/mips/mm/init.c
54 +++ b/arch/mips/mm/init.c
55 @@ -212,7 +212,7 @@ void copy_user_highpage(struct page *to, struct page *from,
58 vto = kmap_atomic(to, KM_USER1);
59 - if (cpu_has_dc_aliases &&
60 + if (cpu_has_dc_aliases && cpu_use_kmap_coherent &&
61 page_mapped(from) && !Page_dcache_dirty(from)) {
62 vfrom = kmap_coherent(from, vaddr);
63 copy_page(vto, vfrom);
64 @@ -234,7 +234,7 @@ void copy_to_user_page(struct vm_area_struct *vma,
65 struct page *page, unsigned long vaddr, void *dst, const void *src,
68 - if (cpu_has_dc_aliases &&
69 + if (cpu_has_dc_aliases && cpu_use_kmap_coherent &&
70 page_mapped(page) && !Page_dcache_dirty(page)) {
71 void *vto = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
72 memcpy(vto, src, len);
73 @@ -252,7 +252,7 @@ void copy_from_user_page(struct vm_area_struct *vma,
74 struct page *page, unsigned long vaddr, void *dst, const void *src,
77 - if (cpu_has_dc_aliases &&
78 + if (cpu_has_dc_aliases && cpu_use_kmap_coherent &&
79 page_mapped(page) && !Page_dcache_dirty(page)) {
80 void *vfrom = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
81 memcpy(dst, vfrom, len);