1 From: Jeff Hansen <jhansen@cardaccess-inc.com>
2 Subject: [PATCH] no highpage
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:
7 2) Using flush_cache_mm in flush_cache_dup_mm
9 For details see OpenWrt ticket #2035 https://dev.openwrt.org/ticket/2035
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 */
16 #include <linux/pfn.h>
17 +#include <asm/cpu-features.h>
19 extern void build_clear_page(void);
20 extern void build_copy_page(void);
21 @@ -105,11 +106,16 @@ static inline void clear_user_page(void
22 flush_data_cache_page((unsigned long)addr);
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,
31 + extern void (*flush_data_cache_page)(unsigned long addr);
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);
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 @@ -158,30 +158,6 @@ void kunmap_coherent(void)
48 -void copy_user_highpage(struct page *to, struct page *from,
49 - unsigned long vaddr, struct vm_area_struct *vma)
53 - vto = kmap_atomic(to);
54 - if (cpu_has_dc_aliases && cpu_use_kmap_coherent &&
55 - page_mapped(from) && !Page_dcache_dirty(from)) {
56 - vfrom = kmap_coherent(from, vaddr);
57 - copy_page(vto, vfrom);
60 - vfrom = kmap_atomic(from);
61 - copy_page(vto, vfrom);
62 - kunmap_atomic(vfrom);
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);
68 - /* Make sure this page is cleared on other CPU's too before using it */
72 void copy_to_user_page(struct vm_area_struct *vma,
73 struct page *page, unsigned long vaddr, void *dst, const void *src,