Re: [PATCH] dma-direct: Set SG_DMA_SWIOTLB flag for dma-direct

From: Christoph Hellwig
Date: Mon May 06 2024 - 12:21:03 EST


On Mon, May 06, 2024 at 09:10:40AM -0700, T.J. Mercier wrote:
> I want to reject mapping a dma_buf for a device if any of the pages
> that back the buffer require SWIOTLB. AFAICT there's no way to know
> whether SWIOTLB is used until after calling dma_map_sg, so afterwards
> I'm trying to check.

You should not check, you simply must handle it by doing the proper
DMA API based ownership management.