Merge tag 'libnvdimm-for-4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm...
[cascardo/linux.git] / arch / powerpc / mm / mem.c
index 0f11819..22d94c3 100644 (file)
@@ -113,7 +113,7 @@ int memory_add_physaddr_to_nid(u64 start)
 }
 #endif
 
-int arch_add_memory(int nid, u64 start, u64 size)
+int arch_add_memory(int nid, u64 start, u64 size, bool for_device)
 {
        struct pglist_data *pgdata;
        struct zone *zone;
@@ -128,7 +128,7 @@ int arch_add_memory(int nid, u64 start, u64 size)
 
        /* this should work for most non-highmem platforms */
        zone = pgdata->node_zones +
-               zone_for_memory(nid, start, size, 0);
+               zone_for_memory(nid, start, size, 0, for_device);
 
        return __add_pages(nid, zone, start_pfn, nr_pages);
 }
@@ -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);