kernel: Add support spi-nor, Eon EN25QH32
[openwrt/openwrt.git] / target / linux / generic / pending-4.4 / 101-MIPS-fix-cache-flushing-for-highmem-pages.patch
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Sun, 24 Jan 2016 01:03:51 +0100
3 Subject: [PATCH] MIPS: fix cache flushing for highmem pages
4
5 Most cache flush ops were no-op for highmem pages. This led to nasty
6 segfaults and (in the case of page_address(page) == NULL) kernel
7 crashes.
8
9 Fix this by always flushing highmem pages using kmap/kunmap_atomic
10 around the actual cache flush. This might be a bit inefficient, but at
11 least it's stable.
12
13 Signed-off-by: Felix Fietkau <nbd@nbd.name>
14 ---
15
16 --- a/arch/mips/mm/cache.c
17 +++ b/arch/mips/mm/cache.c
18 @@ -111,6 +111,13 @@ void __flush_anon_page(struct page *page
19 {
20 unsigned long addr = (unsigned long) page_address(page);
21
22 + if (PageHighMem(page)) {
23 + addr = (unsigned long)kmap_atomic(page);
24 + flush_data_cache_page(addr);
25 + __kunmap_atomic((void *)addr);
26 + return;
27 + }
28 +
29 if (pages_do_alias(addr, vmaddr)) {
30 if (page_mapped(page) && !Page_dcache_dirty(page)) {
31 void *kaddr;