Re: [RFC PATCH] dma-iommu: Add iommu_dma_max_mapping_size()

From: Christoph Hellwig
Date: Wed May 18 2022 - 09:14:02 EST


On Tue, May 17, 2022 at 01:02:00PM +0100, Robin Murphy wrote:
>> So how to inform the SCSI driver of this caching limit then so that it may
>> limit the SGL length?
>
> Driver-specific mechanism; block-layer-specific mechanism; redefine this
> whole API to something like dma_opt_mapping_size(), as a limit above which
> mappings might become less efficient or start to fail (callback to my
> thoughts on [1] as well, I suppose); many options. Just not imposing a
> ridiculously low *maximum* on everyone wherein mapping calls "should not be
> larger than the returned value" when that's clearly bollocks.

Well, for swiotlb it is a hard limit. So if we want to go down that
route we need two APIs, one for the optimal size and one for the
hard limit.