5fe38aaaf679b6ff0bd31447f134e3bd1e594257
[openwrt.git] / target / linux / brcm47xx / patches-2.6.25 / 160-kmap_coherent.patch
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,
4 void *vfrom, *vto;
5
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,
14 unsigned long len)
15 {
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,
23 unsigned long len)
24 {
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);
30 --- /dev/null
31 +++ b/include/asm-mips/mach-bcm47xx/cpu-feature-overrides.h
32 @@ -0,0 +1,13 @@
33 +/*
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
36 + * for more details.
37 + *
38 + * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
39 + */
40 +#ifndef __ASM_MACH_BCM47XX_CPU_FEATURE_OVERRIDES_H
41 +#define __ASM_MACH_BCM47XX_CPU_FEATURE_OVERRIDES_H
42 +
43 +#define cpu_use_kmap_coherent 0
44 +
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
48 @@ -101,6 +101,9 @@
49 #ifndef cpu_has_pindexed_dcache
50 #define cpu_has_pindexed_dcache (cpu_data[0].dcache.flags & MIPS_CACHE_PINDEX)
51 #endif
52 +#ifndef cpu_use_kmap_coherent
53 +#define cpu_use_kmap_coherent 1
54 +#endif
55
56 /*
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.
63 */
64 - if (cpu_has_dc_aliases)
65 + if (cpu_has_dc_aliases && cpu_use_kmap_coherent)
66 vaddr = kmap_coherent(page, addr);
67 else
68 vaddr = kmap_atomic(page, KM_USER0);
69 @@ -505,7 +505,7 @@ static inline void local_r4k_flush_cache
70 }
71
72 if (vaddr) {
73 - if (cpu_has_dc_aliases)
74 + if (cpu_has_dc_aliases && cpu_use_kmap_coherent)
75 kunmap_coherent();
76 else
77 kunmap_atomic(vaddr, KM_USER0);
This page took 0.061496 seconds and 3 git commands to generate.