On Tue, Nov 24, 2026 at 01:36:21PM +0100, Christian König wrote:
The core then negotiates compatible types and adds converters between them,
I have strong objections to that plan and would potentially NAK it.
DMA-buf should *NEVER* accept CPU physical addresses nor provide conversion between different address types.
Keep in mind that DMA-buf is solely a container for DMA addresses, nothing else and it should not provide any mapping functionality whatsoever.
dmabuf needs to provide support for drivers to help them use the interface, and going from physical to dma_addr_t is absolutely a common task every driver must do. I don't care how you call it, but it is a service that must be provided by *something* and matched to the needs of dmabuf.
I will definitely NAK any direction to open code dma mapping in every driver again. If we are going away from SGT then we are fixing all the DRM mistakes, including the wrong open coded DMA mapping, sketchy use of SGT, and abuse of P2P that seems to be endemic in drm.
Meaing the exporter constructs a phys_addr list, gets a P2P provider, and some common code constructs what is passed to the importer. I don't care if this is in "dmabuf" or some "dmabuf library" or *whatever* but it must exist as common shared code.
dma_buf_phys_vec_to_sgt() is the template how to implement this transformation.
and having SGT as a type is what allows that. It only exists for unconverted exporters and importers and eventually goes away once everything is converted. The idea being we don't have to convert everything all at once, whilst also being able to add support for different interconnect types. Are you ok with the SGT type if it is just transitional?
Not really, it just complicate things.
What we should do with the mapping interface is to add the information in which domain the DMA addresses are to be used.
You need to negotiate the actual C data types too, especially if you want to do that nasty idea where dmabuf populates an iommu domain.
Jason