Skip to content

Commit a5008b5

Browse files
author
Christoph Hellwig
committed
dma-direct: only limit the mapping size if swiotlb could be used
Don't just check for a swiotlb buffer, but also if buffering might be required for this particular device. Fixes: 133d624 ("dma: Introduce dma_max_mapping_size()") Reported-by: Benjamin Herrenschmidt <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Tested-by: Benjamin Herrenschmidt <[email protected]>
1 parent b866455 commit a5008b5

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

kernel/dma/direct.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -399,11 +399,9 @@ int dma_direct_supported(struct device *dev, u64 mask)
399399

400400
size_t dma_direct_max_mapping_size(struct device *dev)
401401
{
402-
size_t size = SIZE_MAX;
403-
404402
/* If SWIOTLB is active, use its maximum mapping size */
405-
if (is_swiotlb_active())
406-
size = swiotlb_max_mapping_size(dev);
407-
408-
return size;
403+
if (is_swiotlb_active() &&
404+
(dma_addressing_limited(dev) || swiotlb_force == SWIOTLB_FORCE))
405+
return swiotlb_max_mapping_size(dev);
406+
return SIZE_MAX;
409407
}

0 commit comments

Comments
 (0)