1 --- a/arch/mips/mm/init.c
2 +++ b/arch/mips/mm/init.c
3 @@ -211,7 +211,7 @@ void copy_user_highpage(struct page *to,
6 vto = kmap_atomic(to, KM_USER1);
7 - if (cpu_has_dc_aliases &&
8 + if (cpu_has_dc_aliases && cpu_use_kmap_coherent &&
9 page_mapped(from) && !Page_dcache_dirty(from)) {
10 vfrom = kmap_coherent(from, vaddr);
11 copy_page(vto, vfrom);
12 @@ -235,7 +235,7 @@ void copy_to_user_page(struct vm_area_st
13 struct page *page, unsigned long vaddr, void *dst, const void *src,
16 - if (cpu_has_dc_aliases &&
17 + if (cpu_has_dc_aliases && cpu_use_kmap_coherent &&
18 page_mapped(page) && !Page_dcache_dirty(page)) {
19 void *vto = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
20 memcpy(vto, src, len);
21 @@ -255,7 +255,7 @@ void copy_from_user_page(struct vm_area_
22 struct page *page, unsigned long vaddr, void *dst, const void *src,
25 - if (cpu_has_dc_aliases &&
26 + if (cpu_has_dc_aliases && cpu_use_kmap_coherent &&
27 page_mapped(page) && !Page_dcache_dirty(page)) {
28 void *vfrom = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
29 memcpy(dst, vfrom, len);
31 +++ b/include/asm-mips/mach-bcm47xx/cpu-feature-overrides.h
34 + * This file is subject to the terms and conditions of the GNU General Public
35 + * License. See the file "COPYING" in the main directory of this archive
38 + * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
40 +#ifndef __ASM_MACH_BCM47XX_CPU_FEATURE_OVERRIDES_H
41 +#define __ASM_MACH_BCM47XX_CPU_FEATURE_OVERRIDES_H
43 +#define cpu_use_kmap_coherent 0
45 +#endif /* __ASM_MACH_BCM47XX_CPU_FEATURE_OVERRIDES_H */
46 --- a/include/asm-mips/cpu-features.h
47 +++ b/include/asm-mips/cpu-features.h
49 #ifndef cpu_has_pindexed_dcache
50 #define cpu_has_pindexed_dcache (cpu_data[0].dcache.flags & MIPS_CACHE_PINDEX)
52 +#ifndef cpu_use_kmap_coherent
53 +#define cpu_use_kmap_coherent 1
57 * I-Cache snoops remote store. This only matters on SMP. Some multiprocessors
58 --- a/arch/mips/mm/c-r4k.c
59 +++ b/arch/mips/mm/c-r4k.c
60 @@ -484,7 +484,7 @@ static inline void local_r4k_flush_cache
61 * Use kmap_coherent or kmap_atomic to do flushes for
62 * another ASID than the current one.
64 - if (cpu_has_dc_aliases)
65 + if (cpu_has_dc_aliases && cpu_use_kmap_coherent)
66 vaddr = kmap_coherent(page, addr);
68 vaddr = kmap_atomic(page, KM_USER0);
69 @@ -505,7 +505,7 @@ static inline void local_r4k_flush_cache
73 - if (cpu_has_dc_aliases)
74 + if (cpu_has_dc_aliases && cpu_use_kmap_coherent)
77 kunmap_atomic(vaddr, KM_USER0);