[Intel-gfx] [PATCH v5] drm/i915: stop using swiotlb
Hellstrom, Thomas
thomas.hellstrom at intel.com
Mon Aug 8 15:48:02 UTC 2022
Hi, [back from vacation]
On Tue, 2022-07-26 at 16:39 +0100, Robert Beckett wrote:
> Calling swiotlb functions directly is nowadays considered harmful.
> See
> https://lore.kernel.org/intel-gfx/20220711082614.GA29487@lst.de/
>
> Replace swiotlb_max_segment() calls with dma_max_mapping_size().
> In i915_gem_object_get_pages_internal() no longer consider
> max_segment
> only if CONFIG_SWIOTLB is enabled. There can be other (iommu related)
> causes of specific max segment sizes.
>
> Cc: Christoph Hellwig <hch at lst.de>
> Cc: Tvrtko Ursulin <tvrtko.ursulin at linux.intel.com>
> Cc: Thomas Hellstrom <thomas.hellstrom at intel.com>
> Cc: Matthew Auld <matthew.auld at intel.com>
>
> v2: - restore UINT_MAX clamp in i915_sg_segment_size()
> - drop PAGE_SIZE check as it will always be >= PAGE_SIZE
> v3: - actually clamp to UINT_MAX in i915_sg_segment_size()
> v4: - round down max segment size to PAGE_SIZE
> v5: - fix checkpatch whitespace issue
>
> Reviewed-by: Christoph Hellwig <hch at lst.de>
> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> Signed-off-by: Robert Beckett <bob.beckett at collabora.com>
Hmm,
This whole thing looks a bit strange to me since with SWIOTLB actually
used for i915, the driver should malfunction anyway as it doesn't do
any dma_sync_sg_for_cpu() or dma_sync_sg_for_device(), and the driver
assumes all coherent dma. Is that SWIOTLB=force kernel option still
available?
Also, correct me if I'm wrong, but the original driver segment size
appears to mean "the largest contiguous area that can be handled either
by the device or the dma mapping layer" rather than the total space
available for dma mappings? Not completely sure what
dma_max_mapping_size() is returning, though?
/Thomas
More information about the Intel-gfx
mailing list