Root/target/linux/brcm47xx/patches-2.6.38/160-kmap_coherent.patch

1--- a/arch/mips/include/asm/cpu-features.h
2+++ b/arch/mips/include/asm/cpu-features.h
3@@ -110,6 +110,9 @@
4 #ifndef cpu_has_pindexed_dcache
5 #define cpu_has_pindexed_dcache (cpu_data[0].dcache.flags & MIPS_CACHE_PINDEX)
6 #endif
7+#ifndef cpu_use_kmap_coherent
8+#define cpu_use_kmap_coherent 1
9+#endif
10 
11 /*
12  * I-Cache snoops remote store. This only matters on SMP. Some multiprocessors
13--- /dev/null
14+++ b/arch/mips/include/asm/mach-bcm47xx/cpu-feature-overrides.h
15@@ -0,0 +1,13 @@
16+/*
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
19+ * for more details.
20+ *
21+ * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
22+ */
23+#ifndef __ASM_MACH_BCM47XX_CPU_FEATURE_OVERRIDES_H
24+#define __ASM_MACH_BCM47XX_CPU_FEATURE_OVERRIDES_H
25+
26+#define cpu_use_kmap_coherent 0
27+
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@@ -507,7 +507,7 @@ static inline void local_r4k_flush_cache
32          */
33         map_coherent = (cpu_has_dc_aliases &&
34                 page_mapped(page) && !Page_dcache_dirty(page));
35- if (map_coherent)
36+ if (map_coherent && cpu_use_kmap_coherent)
37             vaddr = kmap_coherent(page, addr);
38         else
39             vaddr = kmap_atomic(page, KM_USER0);
40@@ -530,7 +530,7 @@ static inline void local_r4k_flush_cache
41     }
42 
43     if (vaddr) {
44- if (map_coherent)
45+ if (map_coherent && cpu_use_kmap_coherent)
46             kunmap_coherent();
47         else
48             kunmap_atomic(vaddr, KM_USER0);
49--- a/arch/mips/mm/init.c
50+++ b/arch/mips/mm/init.c
51@@ -210,7 +210,7 @@ void copy_user_highpage(struct page *to,
52     void *vfrom, *vto;
53 
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@@ -232,7 +232,7 @@ void copy_to_user_page(struct vm_area_st
61     struct page *page, unsigned long vaddr, void *dst, const void *src,
62     unsigned long len)
63 {
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@@ -250,7 +250,7 @@ void copy_from_user_page(struct vm_area_
70     struct page *page, unsigned long vaddr, void *dst, const void *src,
71     unsigned long len)
72 {
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);
78

Archive Download this file



interactive