new upstream kernel 2.6.28.6
[openwrt.git] / target / linux / brcm47xx / patches-2.6.28 / 160-kmap_coherent.patch
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
4 @@ -101,6 +101,9 @@
5 #ifndef cpu_has_pindexed_dcache
6 #define cpu_has_pindexed_dcache (cpu_data[0].dcache.flags & MIPS_CACHE_PINDEX)
7 #endif
8 +#ifndef cpu_use_kmap_coherent
9 +#define cpu_use_kmap_coherent 1
10 +#endif
11
12 /*
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
15 --- /dev/null
16 +++ b/arch/mips/include/asm/mach-bcm47xx/cpu-feature-overrides.h
17 @@ -0,0 +1,13 @@
18 +/*
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
21 + * for more details.
22 + *
23 + * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
24 + */
25 +#ifndef __ASM_MACH_BCM47XX_CPU_FEATURE_OVERRIDES_H
26 +#define __ASM_MACH_BCM47XX_CPU_FEATURE_OVERRIDES_H
27 +
28 +#define cpu_use_kmap_coherent 0
29 +
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)
35 */
36 map_coherent = (cpu_has_dc_aliases &&
37 page_mapped(page) && !Page_dcache_dirty(page));
38 - if (map_coherent)
39 + if (map_coherent && cpu_use_kmap_coherent)
40 vaddr = kmap_coherent(page, addr);
41 else
42 vaddr = kmap_atomic(page, KM_USER0);
43 @@ -517,7 +517,7 @@ static inline void local_r4k_flush_cache_page(void *args)
44 }
45
46 if (vaddr) {
47 - if (map_coherent)
48 + if (map_coherent && cpu_use_kmap_coherent)
49 kunmap_coherent();
50 else
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,
56 void *vfrom, *vto;
57
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,
66 unsigned long len)
67 {
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,
75 unsigned long len)
76 {
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);
This page took 0.043702 seconds and 5 git commands to generate.