On Sat, Oct 7, 2017 at 4:08 AM, David Woodhouse <dwmw2@xxxxxxxxxxxxx> wrote: > On Fri, 2017-10-06 at 16:15 -0700, Dan Williams wrote: >> >> Right, crossed mails. The semantic I want is that the IOVA is >> invalidated / starts throwing errors to the device because the address >> it thought it was talking to has been remapped in the file. Once >> userspace wakes up and responds to this invalidation event it can do >> the actual unmap to make the IOVA reusable again. > > So basically you want to unmap it by removing it from the page tables > and flushing the IOTLB, but you want the IOVA to still be reserved. > > The normal device-facing DMA API doesn't give you that today. You could > do it with the IOMMU API though — that one does let you manage the IOVA > space yourself. You don't want that IOVA used again? Well don't use it > as the IOVA in a subsequent iommu_map() call then :) Ah, nice. So I think I'll just add a dma_get_iommu_domain() so the dma_ops implementation can exclude identity-mapped devices, and then iommu_unmap() does the rest. Thanks for the pointer.