Skip to content

Commit c1d0af1

Browse files
author
Christoph Hellwig
committed
kernel/dma/direct: take DMA offset into account in dma_direct_supported
When a device has a DMA offset the dma capable result will change due to the difference between the physical and DMA address. Take that into account. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Benjamin Herrenschmidt <[email protected]> Reviewed-by: Robin Murphy <[email protected]>
1 parent 5b394b2 commit c1d0af1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/dma/direct.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
168168
int dma_direct_supported(struct device *dev, u64 mask)
169169
{
170170
#ifdef CONFIG_ZONE_DMA
171-
if (mask < DMA_BIT_MASK(ARCH_ZONE_DMA_BITS))
171+
if (mask < phys_to_dma(dev, DMA_BIT_MASK(ARCH_ZONE_DMA_BITS)))
172172
return 0;
173173
#else
174174
/*
@@ -177,7 +177,7 @@ int dma_direct_supported(struct device *dev, u64 mask)
177177
* memory, or by providing a ZONE_DMA32. If neither is the case, the
178178
* architecture needs to use an IOMMU instead of the direct mapping.
179179
*/
180-
if (mask < DMA_BIT_MASK(32))
180+
if (mask < phys_to_dma(dev, DMA_BIT_MASK(32)))
181181
return 0;
182182
#endif
183183
/*

0 commit comments

Comments
 (0)