powerpc/mm: Don't call __flush_dcache_icache_phys() with PA>VA
authorScott Wood <scottwood@freescale.com>
Thu, 16 Apr 2015 00:40:23 +0000 (19:40 -0500)
committerScott Wood <scottwood@freescale.com>
Sat, 8 Aug 2015 03:59:20 +0000 (22:59 -0500)
__flush_dcache_icache_phys() requires the ability to access the
memory with the MMU disabled, which means that on a 32-bit system
any memory above 4 GiB is inaccessible.  In particular, mpc86xx is
32-bit and can have more than 4 GiB of RAM.

Signed-off-by: Scott Wood <scottwood@freescale.com>
arch/powerpc/include/asm/cacheflush.h
arch/powerpc/mm/mem.c

index 30b35fff2deaba9e01da24b3d019df4db1c3e66a..6229e6b6037b97fe7d43862945a8c7806d602128 100644 (file)
@@ -40,7 +40,12 @@ extern void __flush_dcache_icache(void *page_va);
 extern void flush_dcache_icache_page(struct page *page);
 #if defined(CONFIG_PPC32) && !defined(CONFIG_BOOKE)
 extern void __flush_dcache_icache_phys(unsigned long physaddr);
-#endif /* CONFIG_PPC32 && !CONFIG_BOOKE */
+#else
+static inline void __flush_dcache_icache_phys(unsigned long physaddr)
+{
+       BUG();
+}
+#endif
 
 extern void flush_dcache_range(unsigned long start, unsigned long stop);
 #ifdef CONFIG_PPC32
index 0f11819d8f1dc07441f6e13362a4dca53f55fb87..e1fe333da94680b9d64915c5a13850e6079d8578 100644 (file)
@@ -414,17 +414,17 @@ void flush_dcache_icache_page(struct page *page)
                return;
        }
 #endif
-#ifdef CONFIG_BOOKE
-       {
+#if defined(CONFIG_8xx) || defined(CONFIG_PPC64)
+       /* On 8xx there is no need to kmap since highmem is not supported */
+       __flush_dcache_icache(page_address(page));
+#else
+       if (IS_ENABLED(CONFIG_BOOKE) || sizeof(phys_addr_t) > sizeof(void *)) {
                void *start = kmap_atomic(page);
                __flush_dcache_icache(start);
                kunmap_atomic(start);
+       } else {
+               __flush_dcache_icache_phys(page_to_pfn(page) << PAGE_SHIFT);
        }
-#elif defined(CONFIG_8xx) || defined(CONFIG_PPC64)
-       /* On 8xx there is no need to kmap since highmem is not supported */
-       __flush_dcache_icache(page_address(page)); 
-#else
-       __flush_dcache_icache_phys(page_to_pfn(page) << PAGE_SHIFT);
 #endif
 }
 EXPORT_SYMBOL(flush_dcache_icache_page);