1 --- a/arch/mips/include/asm/cpu-features.h
2 +++ b/arch/mips/include/asm/cpu-features.h
4 #ifndef cpu_has_pindexed_dcache
5 #define cpu_has_pindexed_dcache (cpu_data[0].dcache.flags & MIPS_CACHE_PINDEX)
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
14 +++ b/arch/mips/include/asm/mach-bcm47xx/cpu-feature-overrides.h
17 + * This file is subject to the terms and conditions of the GNU General Public
18 + * License. See the file "COPYING" in the main directory of this archive
21 + * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
23 +#ifndef __ASM_MACH_BCM47XX_CPU_FEATURE_OVERRIDES_H
24 +#define __ASM_MACH_BCM47XX_CPU_FEATURE_OVERRIDES_H
26 +#define cpu_use_kmap_coherent 0
28 +#endif /* __ASM_MACH_BCM47XX_CPU_FEATURE_OVERRIDES_H */
29 --- a/arch/mips/mm/c-r4k.c
30 +++ b/arch/mips/mm/c-r4k.c
31 @@ -494,7 +494,7 @@ static inline void local_r4k_flush_cache
33 map_coherent = (cpu_has_dc_aliases &&
34 page_mapped(page) && !Page_dcache_dirty(page));
36 + if (map_coherent && cpu_use_kmap_coherent)
37 vaddr = kmap_coherent(page, addr);
39 vaddr = kmap_atomic(page, KM_USER0);
40 @@ -517,7 +517,7 @@ static inline void local_r4k_flush_cache
45 + if (map_coherent && cpu_use_kmap_coherent)
48 kunmap_atomic(vaddr, KM_USER0);
49 --- a/arch/mips/mm/init.c
50 +++ b/arch/mips/mm/init.c
51 @@ -212,7 +212,7 @@ void copy_user_highpage(struct page *to,
54 vto = kmap_atomic(to, KM_USER1);
55 - if (cpu_has_dc_aliases &&
56 + if (cpu_has_dc_aliases && cpu_use_kmap_coherent &&
57 page_mapped(from) && !Page_dcache_dirty(from)) {
58 vfrom = kmap_coherent(from, vaddr);
59 copy_page(vto, vfrom);
60 @@ -234,7 +234,7 @@ void copy_to_user_page(struct vm_area_st
61 struct page *page, unsigned long vaddr, void *dst, const void *src,
64 - if (cpu_has_dc_aliases &&
65 + if (cpu_has_dc_aliases && cpu_use_kmap_coherent &&
66 page_mapped(page) && !Page_dcache_dirty(page)) {
67 void *vto = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
68 memcpy(vto, src, len);
69 @@ -252,7 +252,7 @@ void copy_from_user_page(struct vm_area_
70 struct page *page, unsigned long vaddr, void *dst, const void *src,
73 - if (cpu_has_dc_aliases &&
74 + if (cpu_has_dc_aliases && cpu_use_kmap_coherent &&
75 page_mapped(page) && !Page_dcache_dirty(page)) {
76 void *vfrom = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
77 memcpy(dst, vfrom, len);