From 6cccd95f944a7e98b4d4decc600685d3465358c5 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 27 Jun 2013 11:59:11 -0700 Subject: [PATCH] 3.4-stable patches added patches: arm-7755-1-handle-user-space-mapped-pages-in-flush_kernel_dcache_page.patch arm-7772-1-fix-missing-flush_kernel_dcache_page-for-nommu.patch --- ...ed-pages-in-flush_kernel_dcache_page.patch | 82 +++++++++++++++++++ ...g-flush_kernel_dcache_page-for-nommu.patch | 38 +++++++++ queue-3.4/series | 2 + 3 files changed, 122 insertions(+) create mode 100644 queue-3.4/arm-7755-1-handle-user-space-mapped-pages-in-flush_kernel_dcache_page.patch create mode 100644 queue-3.4/arm-7772-1-fix-missing-flush_kernel_dcache_page-for-nommu.patch create mode 100644 queue-3.4/series diff --git a/queue-3.4/arm-7755-1-handle-user-space-mapped-pages-in-flush_kernel_dcache_page.patch b/queue-3.4/arm-7755-1-handle-user-space-mapped-pages-in-flush_kernel_dcache_page.patch new file mode 100644 index 00000000000..08e1596c56d --- /dev/null +++ b/queue-3.4/arm-7755-1-handle-user-space-mapped-pages-in-flush_kernel_dcache_page.patch @@ -0,0 +1,82 @@ +From 1bc39742aab09248169ef9d3727c9def3528b3f3 Mon Sep 17 00:00:00 2001 +From: Simon Baatz +Date: Mon, 10 Jun 2013 21:10:12 +0100 +Subject: ARM: 7755/1: handle user space mapped pages in flush_kernel_dcache_page + +From: Simon Baatz + +commit 1bc39742aab09248169ef9d3727c9def3528b3f3 upstream. + +Commit f8b63c1 made flush_kernel_dcache_page a no-op assuming that +the pages it needs to handle are kernel mapped only. However, for +example when doing direct I/O, pages with user space mappings may +occur. + +Thus, continue to do lazy flushing if there are no user space +mappings. Otherwise, flush the kernel cache lines directly. + +Signed-off-by: Simon Baatz +Reviewed-by: Catalin Marinas +Signed-off-by: Russell King +Signed-off-by: Greg Kroah-Hartman + +--- + arch/arm/include/asm/cacheflush.h | 4 +--- + arch/arm/mm/flush.c | 33 +++++++++++++++++++++++++++++++++ + 2 files changed, 34 insertions(+), 3 deletions(-) + +--- a/arch/arm/include/asm/cacheflush.h ++++ b/arch/arm/include/asm/cacheflush.h +@@ -305,9 +305,7 @@ static inline void flush_anon_page(struc + } + + #define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE +-static inline void flush_kernel_dcache_page(struct page *page) +-{ +-} ++extern void flush_kernel_dcache_page(struct page *); + + #define flush_dcache_mmap_lock(mapping) \ + spin_lock_irq(&(mapping)->tree_lock) +--- a/arch/arm/mm/flush.c ++++ b/arch/arm/mm/flush.c +@@ -299,6 +299,39 @@ void flush_dcache_page(struct page *page + EXPORT_SYMBOL(flush_dcache_page); + + /* ++ * Ensure cache coherency for the kernel mapping of this page. We can ++ * assume that the page is pinned via kmap. ++ * ++ * If the page only exists in the page cache and there are no user ++ * space mappings, this is a no-op since the page was already marked ++ * dirty at creation. Otherwise, we need to flush the dirty kernel ++ * cache lines directly. ++ */ ++void flush_kernel_dcache_page(struct page *page) ++{ ++ if (cache_is_vivt() || cache_is_vipt_aliasing()) { ++ struct address_space *mapping; ++ ++ mapping = page_mapping(page); ++ ++ if (!mapping || mapping_mapped(mapping)) { ++ void *addr; ++ ++ addr = page_address(page); ++ /* ++ * kmap_atomic() doesn't set the page virtual ++ * address for highmem pages, and ++ * kunmap_atomic() takes care of cache ++ * flushing already. ++ */ ++ if (!IS_ENABLED(CONFIG_HIGHMEM) || addr) ++ __cpuc_flush_dcache_area(addr, PAGE_SIZE); ++ } ++ } ++} ++EXPORT_SYMBOL(flush_kernel_dcache_page); ++ ++/* + * Flush an anonymous page so that users of get_user_pages() + * can safely access the data. The expected sequence is: + * diff --git a/queue-3.4/arm-7772-1-fix-missing-flush_kernel_dcache_page-for-nommu.patch b/queue-3.4/arm-7772-1-fix-missing-flush_kernel_dcache_page-for-nommu.patch new file mode 100644 index 00000000000..a318aeca96c --- /dev/null +++ b/queue-3.4/arm-7772-1-fix-missing-flush_kernel_dcache_page-for-nommu.patch @@ -0,0 +1,38 @@ +From 63384fd0b1509acf522a8a8fcede09087eedb7df Mon Sep 17 00:00:00 2001 +From: Simon Baatz +Date: Sat, 22 Jun 2013 22:01:25 +0100 +Subject: ARM: 7772/1: Fix missing flush_kernel_dcache_page() for noMMU + +From: Simon Baatz + +commit 63384fd0b1509acf522a8a8fcede09087eedb7df upstream. + +Commit 1bc3974 (ARM: 7755/1: handle user space mapped pages in +flush_kernel_dcache_page) moved the implementation of +flush_kernel_dcache_page() into mm/flush.c but did not implement it +on noMMU ARM. + +Signed-off-by: Simon Baatz +Acked-by: Kevin Hilman +Signed-off-by: Russell King +Signed-off-by: Greg Kroah-Hartman + +--- + arch/arm/mm/nommu.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/arch/arm/mm/nommu.c ++++ b/arch/arm/mm/nommu.c +@@ -57,6 +57,12 @@ void flush_dcache_page(struct page *page + } + EXPORT_SYMBOL(flush_dcache_page); + ++void flush_kernel_dcache_page(struct page *page) ++{ ++ __cpuc_flush_dcache_area(page_address(page), PAGE_SIZE); ++} ++EXPORT_SYMBOL(flush_kernel_dcache_page); ++ + void copy_to_user_page(struct vm_area_struct *vma, struct page *page, + unsigned long uaddr, void *dst, const void *src, + unsigned long len) diff --git a/queue-3.4/series b/queue-3.4/series new file mode 100644 index 00000000000..8c0d932927b --- /dev/null +++ b/queue-3.4/series @@ -0,0 +1,2 @@ +arm-7755-1-handle-user-space-mapped-pages-in-flush_kernel_dcache_page.patch +arm-7772-1-fix-missing-flush_kernel_dcache_page-for-nommu.patch -- 2.47.3