[PATCH 09/34] dma-mapping: take dma_pfn_offset into account in dma_max_pfn

From
Christoph Hellwig <hidden>
Date
2018-01-12 08:52:26
Also in
linux-arch, linux-arm-kernel, linux-iommu, linux-mips, linux-s390, linux-sh, linuxppc-dev, lkml, sparclinux
Reply to
Christoph Hellwig, 2018-01-12
This makes sure the generic version can be used with architectures /
devices that have a DMA offset in the direct mapping.

Signed-off-by: Christoph Hellwig <redacted>
Reviewed-by: Robin Murphy <redacted>
---
 include/linux/dma-mapping.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 81ed9b2d84dc..d84951865be7 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -692,7 +692,7 @@ static inline int dma_set_seg_boundary(struct device *dev, unsigned long mask)
 #ifndef dma_max_pfn
 static inline unsigned long dma_max_pfn(struct device *dev)
 {
-	return *dev->dma_mask >> PAGE_SHIFT;
+	return (*dev->dma_mask >> PAGE_SHIFT) + dev->dma_pfn_offset;
 }
 #endif
 
-- 
2.14.2
Thread (37 messages) 37 messages, 3 authors, last reply 2018-02-02
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help