On Wed, Apr 22, 2026 at 02:39:16PM +0200, Christian König wrote:
Can you be more specific please, I still have no idea what you are thinking in terms of an acceptable implementation.
Let me try to describe it differently:
The iommufd deals with iommu_domain structures which userspace can map different things into.
So of hand I would say that an interface to map DMA-buf into such an iommu_domain should look something like this:
dma_buf_map_attachment_iommu(struct dma_buf_attachment *attachment, struct iommu_domain *domain, unsigned long iova, unsigned long offset, size_t size, ...);
The DMA buf exporter then maps the its data into the iommu_domain at iova starting with offset from within the buffer and size number of bytes.
Well, my first reaction is very negative, this suggestion is leaking deep internal details like iommu_domain out of the single place that needs them - iommufd - into about 6 exporter drivers. Not nice. I have the mirror of your concern that I don't trust DRM drivers not to abuse the iommu_domain pointer in some very creative way.
However. With a suitable helper we can largely isolate this to a single function and yeah I can see making this functional.
Not sure how this can work for KVM, but I'm getting the feeling the way forward here is to "live and learn" together.
So, in the context of this series, your proposal is an iommu_domain mapping type, to replace PAL. Yes?
Do you have a positive feeling about the general mapping type system from the earlier patches?
I think if you want these kinds of APIs there are going to be several mapping types required to exchange their very narrowly defined details: scatterlist, scatterlist-ng, iommu_domain, the Intel vfio thing, UALink, driver private interconnects, and whatever KVM needs.
Thus I think this is making a stronger case that we should have this formal negotiation protocol between exporter and importer for the mapping types.
Thanks, Jason