Re: [PATCH 0/6] rust: iommu: add a paging domain abstraction

From: Daniel Almeida

Date: Thu Nov 19 2026 - 08:26:22 EST


>
> I can't speak for the actual intent of the Rust drivers, but giving them the benefit of the doubt, none of that fearmongering should apply: the valid use-case is just simple time-division multiplexing.
>
> A = iommu_paging_domain_alloc(dev);
> B = iommu_paging_domain_alloc(dev);
> iommu_attach(dev, A);
> iommu_map(A, iova_x, virt_to_phys(X));
> dma_map(dev, X) //still needed for the underlying memory
> ... //tell dev to do the work for context A using iova_x
> dma_unmap(dev, X);
> dma_map(dev, Y);
> iommu_map(B, iova_y, virt_to_phys(Y));
> iommu_detach(dev, A);
> iommu_attach(dev, B);
> ... //do some work in context B
>

Yeah, this is basically exactly what we want to do..yet Jason has been
repeateadly saying you cannot call the dma api at all once you allocate paging
domains. So now, I am confused.

> ...and so on. The only real subtlety is that while you still need to make the DMA map/unmap calls as usual (for the sake of managing cache coherency), you only use the returned DMA address for checking dma_mapping_error() and the subsequent dma_unmap(); the address you give to the device is your own IOVA for the mapping through your unmanaged domain.

Yeah, exactly.

>
> Plus as I mentioned recently in one of those sketchy dma-buf threads, it's also true that at the moment, iommu-dma will still do a load of unnecessary work in the unattached default domain for reasons that were valid 5 years ago, but that now can and really should be optimised out. I guess I'll have to steal a day or two from what I'm supposed to be doing to write that patch before I get fed up of explaining it :)

Yeah, but I did some perf here, and it doesn’t matter much.

>
> Thanks,
> Robin.