Re: [RFC PATCH 1/2] iommu: Add iommu_map_sgtable_dma()

From: Jason Gunthorpe

Date: Fri Oct 09 2026 - 11:21:00 EST


On Fri, Oct 09, 2026 at 02:21:13AM +0200, Karl Mehltretter wrote:
> DMA-BUF attachments provide DMA addresses, not CPU-side pages.
> iommu_map_sgtable() needs those pages, so private-domain importers such
> as Rockchip cannot use it with strict DMABUF_DEBUG.
>
> Add an iommu-dma helper to map a live attachment into another domain by
> translating through the device's default DMA domain. Roll back target
> mappings on error. This still recovers physical addresses
> internally.

Absolutely not. You cannot recover the phys_addr's from a DMABUF
expoter by using iommu_iova_to_phys(). Christian is adamant that
drivers must not use physical addresses, and I will not agree to any
hacks like this to try to end-run around his prohibition by abusing
iommu subsystem.

NAKed-by: Jason Gunthorpe <jgg@xxxxxxxxxx>

If you want to keep the domain in the rockchip driver you have to fix
DMABUF to allow an importer to use an iommu domain safely.

It *must not* be done with a scatterlist interface, sorry, I know that
is alot of work but Alistair is going to take a serious stab at it.

Many users want this, not just rockchip. So help with the work to
allow iommufd to do this and you will get it for free.

Jason