On 28/09/18 16:33, Christoph Hellwig wrote:
On Fri, Sep 28, 2018 at 04:31:10PM +0100, Robin Murphy wrote:
The tricky part is how to reconcile that with those other drivers which
want to do explicit IOMMU management with their own domain but still use
the DMA API for coherency of the underlying memory. I do have a couple of
half-formed ideas, but they're not quite there yet.
It think the only sensible answer is that they can't, and we'll need
coherency API in the iommu API (or augmenting it). Which might be a
real possibility now that I'm almost done lifting the coherency
management to arch hooks instead of dma op methods.
I reckon it seems feasible if the few clients that want to had a way to
allocate their own proper managed domains, and the IOMMU API knew how to
swizzle between iommu_dma_ops and dma_direct_ops upon attach depending
on whether the target domain was managed or unmanaged. The worst part is
liekly to be the difference between that lovely conceptual
"iommu_dma_ops" and the cross-architecture mess of reality, plus where
identity domains with a possible need for SWIOTLB come into it.
Robin.