]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
powerpc: enable a 30-bit ZONE_DMA for 32-bit pmac
authorChristoph Hellwig <hch@lst.de>
Thu, 13 Jun 2019 08:24:46 +0000 (10:24 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 14 Jul 2019 06:09:45 +0000 (08:09 +0200)
[ Upstream commit 9739ab7eda459f0669ec9807e0d9be5020bab88c ]

With the strict dma mask checking introduced with the switch to
the generic DMA direct code common wifi chips on 32-bit powerbooks
stopped working.  Add a 30-bit ZONE_DMA to the 32-bit pmac builds
to allow them to reliably allocate dma coherent memory.

Fixes: 65a21b71f948 ("powerpc/dma: remove dma_nommu_dma_supported")
Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/powerpc/include/asm/page.h
arch/powerpc/mm/mem.c
arch/powerpc/platforms/powermac/Kconfig

index ed870468ef6f12562f7833fc8af56bb24d44cc85..d408711d09fb13ee2893df3e2fe73136b78bb879 100644 (file)
@@ -330,6 +330,13 @@ struct vm_area_struct;
 #endif /* __ASSEMBLY__ */
 #include <asm/slice.h>
 
+/*
+ * Allow 30-bit DMA for very limited Broadcom wifi chips on many powerbooks.
+ */
+#ifdef CONFIG_PPC32
+#define ARCH_ZONE_DMA_BITS 30
+#else
 #define ARCH_ZONE_DMA_BITS 31
+#endif
 
 #endif /* _ASM_POWERPC_PAGE_H */
index f6787f90e1585bb735e38ee85a869e865486f9af..b98ce400a889582a06ad7c85044436bdb6762f10 100644 (file)
@@ -255,7 +255,8 @@ void __init paging_init(void)
               (long int)((top_of_ram - total_ram) >> 20));
 
 #ifdef CONFIG_ZONE_DMA
-       max_zone_pfns[ZONE_DMA] = min(max_low_pfn, 0x7fffffffUL >> PAGE_SHIFT);
+       max_zone_pfns[ZONE_DMA] = min(max_low_pfn,
+                       ((1UL << ARCH_ZONE_DMA_BITS) - 1) >> PAGE_SHIFT);
 #endif
        max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
 #ifdef CONFIG_HIGHMEM
index f834a19ed772bbcb1a65e93d3da90d61fa5b5a9b..c02d8c503b2946b290363a23deed0016aeefe452 100644 (file)
@@ -7,6 +7,7 @@ config PPC_PMAC
        select PPC_INDIRECT_PCI if PPC32
        select PPC_MPC106 if PPC32
        select PPC_NATIVE
+       select ZONE_DMA if PPC32
        default y
 
 config PPC_PMAC64