On Thu, Oct 31, 2024 at 09:18:11PM +0000, Robin Murphy wrote: >> +/** >> + * dma_need_unmap - does this device need dma_unmap_* operations >> + * @dev: device to check >> + * >> + * If this function returns %false, drivers can skip calling dma_unmap_* after >> + * finishing an I/O. This function must be called after all mappings that might >> + * need to be unmapped have been performed. > > In terms of the unmap call itself, why don't we just use dma_skip_sync to > short-cut dma_direct_unmap_*() and make sure it's as cheap as possible? > > In terms of not having to unmap implying not having to store addresses at > all, it doesn't seem super-useful when you still have to store them for > long enough to find out that you don't :/ I don't fully understand the comment, mostly because the way I read the two sentences appear to contradict each other. Bypassing dma_direct_unmap_ is not the important part, because it already is pretty cheap. Storing the addresses is not. That being said now that we never check need_unmap in the iova path it might make sense to not have a separate helper, but it needs to be exposed and documented.