powerpc/64: Limit ZONE_DMA32 to 4GiB in swiotlb_detect_4g()
authorScott Wood <scottwood@freescale.com>
Fri, 8 Aug 2014 23:40:44 +0000 (18:40 -0500)
committerScott Wood <scottwood@freescale.com>
Wed, 3 Sep 2014 22:58:22 +0000 (17:58 -0500)
A DMA zone is still needed with swiotlb, for coherent allocations.
This doesn't affect platforms that don't use swiotlb or that don't call
swiotlb_detect_4g().

Signed-off-by: Scott Wood <scottwood@freescale.com>
Cc: Shaohui Xie <Shaohui.Xie@freescale.com>
arch/powerpc/kernel/dma-swiotlb.c

index bd1a2aba599f59aaee4d31d9d971f5afb9d5bca4..735979764cd4ce6b9100051b88e947b02bc4f9b2 100644 (file)
@@ -106,10 +106,14 @@ int __init swiotlb_setup_bus_notifier(void)
        return 0;
 }
 
-void swiotlb_detect_4g(void)
+void __init swiotlb_detect_4g(void)
 {
-       if ((memblock_end_of_DRAM() - 1) > 0xffffffff)
+       if ((memblock_end_of_DRAM() - 1) > 0xffffffff) {
                ppc_swiotlb_enable = 1;
+#ifdef CONFIG_ZONE_DMA32
+               limit_zone_pfn(ZONE_DMA32, (1ULL << 32) >> PAGE_SHIFT);
+#endif
+       }
 }
 
 static int __init swiotlb_late_init(void)