aboutsummaryrefslogtreecommitdiffstats
path: root/arch/parisc/include
diff options
context:
space:
mode:
authorJohn David Anglin <dave.anglin@bell.net>2014-01-05 21:25:00 -0500
committerHelge Deller <deller@gmx.de>2014-01-08 17:02:57 -0500
commitf8dae00684d678afa13041ef170cecfd1297ed40 (patch)
tree554b9054b8e629574d14f62b49c14a558bba4abe /arch/parisc/include
parentceb3b0212dfc843a6abe8a6f3b4e28c1f2059e64 (diff)
parisc: Ensure full cache coherency for kmap/kunmap
Helge Deller noted a few weeks ago problems with the AIO support on parisc. This change is the result of numerous iterations on how best to deal with this problem. The solution adopted here is to provide full cache coherency in a uniform manner on all parisc systems. This involves calling flush_dcache_page() on kmap operations and flush_kernel_dcache_page() on kunmap operations. As a result, the copy_user_page() and clear_user_page() functions can be removed and the overall code is simpler. The change ensures that both userspace and kernel aliases to a mapped page are invalidated and flushed. This is necessary for the correct operation of PA8800 and PA8900 based systems which do not support inequivalent aliases. With this change, I have observed no cache related issues on c8000 and rp3440. It is now possible for example to do kernel builds with "-j64" on four way systems. On systems using XFS file systems, the patch recently posted by Mikulas Patocka to "fix crash using XFS on loopback" is needed to avoid a hang caused by an uninitialized lock passed to flush_dcache_page() in the page struct. Signed-off-by: John David Anglin <dave.anglin@bell.net> Cc: stable@vger.kernel.org # v3.9+ Signed-off-by: Helge Deller <deller@gmx.de>
Diffstat (limited to 'arch/parisc/include')
-rw-r--r--arch/parisc/include/asm/cacheflush.h12
-rw-r--r--arch/parisc/include/asm/page.h5
2 files changed, 6 insertions, 11 deletions
diff --git a/arch/parisc/include/asm/cacheflush.h b/arch/parisc/include/asm/cacheflush.h
index f0e2784e7cca..2f9b751878ba 100644
--- a/arch/parisc/include/asm/cacheflush.h
+++ b/arch/parisc/include/asm/cacheflush.h
@@ -125,42 +125,38 @@ flush_anon_page(struct vm_area_struct *vma, struct page *page, unsigned long vma
125void mark_rodata_ro(void); 125void mark_rodata_ro(void);
126#endif 126#endif
127 127
128#ifdef CONFIG_PA8X00
129/* Only pa8800, pa8900 needs this */
130
131#include <asm/kmap_types.h> 128#include <asm/kmap_types.h>
132 129
133#define ARCH_HAS_KMAP 130#define ARCH_HAS_KMAP
134 131
135void kunmap_parisc(void *addr);
136
137static inline void *kmap(struct page *page) 132static inline void *kmap(struct page *page)
138{ 133{
139 might_sleep(); 134 might_sleep();
135 flush_dcache_page(page);
140 return page_address(page); 136 return page_address(page);
141} 137}
142 138
143static inline void kunmap(struct page *page) 139static inline void kunmap(struct page *page)
144{ 140{
145 kunmap_parisc(page_address(page)); 141 flush_kernel_dcache_page_addr(page_address(page));
146} 142}
147 143
148static inline void *kmap_atomic(struct page *page) 144static inline void *kmap_atomic(struct page *page)
149{ 145{
150 pagefault_disable(); 146 pagefault_disable();
147 flush_dcache_page(page);
151 return page_address(page); 148 return page_address(page);
152} 149}
153 150
154static inline void __kunmap_atomic(void *addr) 151static inline void __kunmap_atomic(void *addr)
155{ 152{
156 kunmap_parisc(addr); 153 flush_kernel_dcache_page_addr(addr);
157 pagefault_enable(); 154 pagefault_enable();
158} 155}
159 156
160#define kmap_atomic_prot(page, prot) kmap_atomic(page) 157#define kmap_atomic_prot(page, prot) kmap_atomic(page)
161#define kmap_atomic_pfn(pfn) kmap_atomic(pfn_to_page(pfn)) 158#define kmap_atomic_pfn(pfn) kmap_atomic(pfn_to_page(pfn))
162#define kmap_atomic_to_page(ptr) virt_to_page(ptr) 159#define kmap_atomic_to_page(ptr) virt_to_page(ptr)
163#endif
164 160
165#endif /* _PARISC_CACHEFLUSH_H */ 161#endif /* _PARISC_CACHEFLUSH_H */
166 162
diff --git a/arch/parisc/include/asm/page.h b/arch/parisc/include/asm/page.h
index b7adb2ac049c..c53fc63149e8 100644
--- a/arch/parisc/include/asm/page.h
+++ b/arch/parisc/include/asm/page.h
@@ -28,9 +28,8 @@ struct page;
28 28
29void clear_page_asm(void *page); 29void clear_page_asm(void *page);
30void copy_page_asm(void *to, void *from); 30void copy_page_asm(void *to, void *from);
31void clear_user_page(void *vto, unsigned long vaddr, struct page *pg); 31#define clear_user_page(vto, vaddr, page) clear_page_asm(vto)
32void copy_user_page(void *vto, void *vfrom, unsigned long vaddr, 32#define copy_user_page(vto, vfrom, vaddr, page) copy_page_asm(vto, vfrom)
33 struct page *pg);
34 33
35/* #define CONFIG_PARISC_TMPALIAS */ 34/* #define CONFIG_PARISC_TMPALIAS */
36 35