summary refs log tree commit diff
path: root/kernel/dma
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2019-11-21 18:13:03 +0100
committerChristoph Hellwig <hch@lst.de>2019-11-21 18:13:03 +0100
commitd7293f79caea45c50c0ab4294847e7af96501ced (patch)
tree04d55fbe33562f4d242e0445baae55690ebb6682 /kernel/dma
parent68a33b1794665ba8a1d1ef1d3bfcc7c587d380a6 (diff)
parentbff3b04460a80f425442fe8e5c6ee8c3ebef611f (diff)
downloadlinux-d7293f79caea45c50c0ab4294847e7af96501ced.tar.gz
Merge branch 'for-next/zone-dma' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux into dma-mapping-for-next
Pull in a stable branch from the arm64 tree that adds the zone_dma_bits
variable to avoid creating hard to resolve conflicts with that addition.
Diffstat (limited to 'kernel/dma')
-rw-r--r--kernel/dma/direct.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c
index 40f1f0aac4b1..267b23a13b69 100644
--- a/kernel/dma/direct.c
+++ b/kernel/dma/direct.c
@@ -17,12 +17,11 @@
 #include <linux/swiotlb.h>
 
 /*
- * Most architectures use ZONE_DMA for the first 16 Megabytes, but
- * some use it for entirely different regions:
+ * Most architectures use ZONE_DMA for the first 16 Megabytes, but some use it
+ * it for entirely different regions. In that case the arch code needs to
+ * override the variable below for dma-direct to work properly.
  */
-#ifndef ARCH_ZONE_DMA_BITS
-#define ARCH_ZONE_DMA_BITS 24
-#endif
+unsigned int zone_dma_bits __ro_after_init = 24;
 
 static void report_addr(struct device *dev, dma_addr_t dma_addr, size_t size)
 {
@@ -76,7 +75,7 @@ static gfp_t __dma_direct_optimal_gfp_mask(struct device *dev, u64 dma_mask,
 	 * Note that GFP_DMA32 and GFP_DMA are no ops without the corresponding
 	 * zones.
 	 */
-	if (*phys_mask <= DMA_BIT_MASK(ARCH_ZONE_DMA_BITS))
+	if (*phys_mask <= DMA_BIT_MASK(zone_dma_bits))
 		return GFP_DMA;
 	if (*phys_mask <= DMA_BIT_MASK(32))
 		return GFP_DMA32;
@@ -485,7 +484,7 @@ int dma_direct_supported(struct device *dev, u64 mask)
 	u64 min_mask;
 
 	if (IS_ENABLED(CONFIG_ZONE_DMA))
-		min_mask = DMA_BIT_MASK(ARCH_ZONE_DMA_BITS);
+		min_mask = DMA_BIT_MASK(zone_dma_bits);
 	else
 		min_mask = DMA_BIT_MASK(32);