ramips: fix HiWiFi HC5761A switch settings
[openwrt/staging/wigyori.git] / target / linux / brcm47xx / patches-4.19 / 310-no_highpage.patch
1 From: Jeff Hansen <jhansen@cardaccess-inc.com>
2 Subject: [PATCH] no highpage
3
4 On ASUS WL-500gP there are many unexpected "Segmentation fault"s that
5 seem to be caused by a kernel. They can be avoided by:
6 1) Disabling highpage
7 2) Using flush_cache_mm in flush_cache_dup_mm
8
9 For details see OpenWrt ticket #2035 https://dev.openwrt.org/ticket/2035
10 ---
11 --- a/arch/mips/include/asm/page.h
12 +++ b/arch/mips/include/asm/page.h
13 @@ -71,6 +71,7 @@ static inline unsigned int page_size_ftl
14 #endif /* CONFIG_MIPS_HUGE_TLB_SUPPORT */
15
16 #include <linux/pfn.h>
17 +#include <asm/cpu-features.h>
18
19 extern void build_clear_page(void);
20 extern void build_copy_page(void);
21 @@ -110,11 +111,16 @@ static inline void clear_user_page(void
22 flush_data_cache_page((unsigned long)addr);
23 }
24
25 -struct vm_area_struct;
26 -extern void copy_user_highpage(struct page *to, struct page *from,
27 - unsigned long vaddr, struct vm_area_struct *vma);
28 +static inline void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
29 + struct page *to)
30 +{
31 + extern void (*flush_data_cache_page)(unsigned long addr);
32
33 -#define __HAVE_ARCH_COPY_USER_HIGHPAGE
34 + copy_page(vto, vfrom);
35 + if (!cpu_has_ic_fills_f_dc ||
36 + pages_do_alias((unsigned long)vto, vaddr & PAGE_MASK))
37 + flush_data_cache_page((unsigned long)vto);
38 +}
39
40 /*
41 * These are used to make use of C type-checking..
42 --- a/arch/mips/mm/init.c
43 +++ b/arch/mips/mm/init.c
44 @@ -162,30 +162,6 @@ void kunmap_coherent(void)
45 preempt_enable();
46 }
47
48 -void copy_user_highpage(struct page *to, struct page *from,
49 - unsigned long vaddr, struct vm_area_struct *vma)
50 -{
51 - void *vfrom, *vto;
52 -
53 - vto = kmap_atomic(to);
54 - if (cpu_has_dc_aliases && cpu_use_kmap_coherent &&
55 - page_mapcount(from) && !Page_dcache_dirty(from)) {
56 - vfrom = kmap_coherent(from, vaddr);
57 - copy_page(vto, vfrom);
58 - kunmap_coherent();
59 - } else {
60 - vfrom = kmap_atomic(from);
61 - copy_page(vto, vfrom);
62 - kunmap_atomic(vfrom);
63 - }
64 - if ((!cpu_has_ic_fills_f_dc) ||
65 - pages_do_alias((unsigned long)vto, vaddr & PAGE_MASK))
66 - flush_data_cache_page((unsigned long)vto);
67 - kunmap_atomic(vto);
68 - /* Make sure this page is cleared on other CPU's too before using it */
69 - smp_wmb();
70 -}
71 -
72 void copy_to_user_page(struct vm_area_struct *vma,
73 struct page *page, unsigned long vaddr, void *dst, const void *src,
74 unsigned long len)