Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a5008b59 authored by Christoph Hellwig's avatar Christoph Hellwig
Browse files

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: 133d624b ("dma: Introduce dma_max_mapping_size()")
Reported-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Tested-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent b8664554
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -399,11 +399,9 @@ int dma_direct_supported(struct device *dev, u64 mask)

size_t dma_direct_max_mapping_size(struct device *dev)
{
	size_t size = SIZE_MAX;

	/* If SWIOTLB is active, use its maximum mapping size */
	if (is_swiotlb_active())
		size = swiotlb_max_mapping_size(dev);

	return size;
	if (is_swiotlb_active() &&
	    (dma_addressing_limited(dev) || swiotlb_force == SWIOTLB_FORCE))
		return swiotlb_max_mapping_size(dev);
	return SIZE_MAX;
}