Re: [PATCH] swiotlb: sync buffer when mapping FROM_DEVICE

From: Christoph Hellwig
Date: Wed May 22 2019 - 09:12:29 EST


On Wed, May 22, 2019 at 01:50:47PM +0100, Robin Murphy wrote:
> Would that work out any different from the existing DMA_ATTR_SKIP_CPU_SYNC?
>
> If drivers are prepared to handle this issue from their end, they can
> already do so for single mappings by using that attr along with explicit
> partial syncs via dma_sync_single(). For page/sg mappings we'd still have
> the problem of identifying what part of "partial" actually matters, and
> probably having to add some additional new sync operations to cope.

Except that the same optimization we are tripping over here is also
present in dma_sync_* - dma_sync_*_to_device with DMA_FROM_DEVICE is a
no-op in swiotlb.