Re: [PATCH v3 03/24] dma-buf: Add the SGT DMA mapping type
From: Christian König
Date: Thu Nov 26 2026 - 04:58:31 EST
On 11/26/26 07:24, Alistair Popple wrote:
> On 2026-11-26 at 06:07 +1100, Jason Gunthorpe <jgg@xxxxxxxx> wrote...
>> On Wed, Nov 25, 2026 at 07:17:51PM +0100, Christian König wrote:
>>> On 11/25/26 16:55, Jason Gunthorpe wrote:
>>>> On Wed, Nov 25, 2026 at 12:19:08PM +0100, Christian König wrote:
>
> [...]
>
> > > We cannot disconnect this from the DMA API, ie to use an iommu domain
>>>> or ualink, if exporting drivers are hardwiring calls into it.
>>>
>>> Well the plan is to not disconnect it at all. The exporting drivers
>>> just says to the underlying API here is my buffer please map that
>>> for this importer and that result is then given back to the importer
>>> through the DMA API again.
>>
>> DMA API will only do basic PCI DMA mappings into dma_addr_t.
>>
>> It will never handle iommu_domain, it will never handle ualink/etc.
>>
>> Give us a plan for those if you don't like any of these ideas.
>>
>>>> Fundamentally the need is for the driver to get the phys_addr list,
>>>> exactly like today, and then pass it to an op which formats that into
>>>> the right data structure for the importer. Be it dma_addr[],
>>>> iommu_domain, or some ualink_addr[] - or whatever.
>>>
>>> No, the phys_addr type should only ever been seen by the DMA API and
>>> not by DMA-buf.
>>
>> Again, I don't care how you label things or what "library" they live
>> in, I can't tell if we are nitpicking names or what.
>>
>> But there needs to be some kind of abstraction that takes in
>> phys_addr_t and makes sgt, dma_addr_t, or iommu_domain depending on
>> what the importer needs.
>>
>> Exporters must not open code that.
>>
>> Obviously DMABUF is involved here *somehow* since it is the only thing
>> that knows an importer even exists.
>>
>> Would you be happy if we made a 'dma mapping for dmabuf' library that
>> did all of this and DMABUF just passes its type opaquely and drivers
>> just call its tightly abstracted functions?
>>
>> That is the component Alistair is proposing, he just prefixed it with
>> dmabuf_* as the namespace because, lets be honest, only dmabuf needs
>> this weird looking thing.
>
> Right, I don't really mind where and what things are named. I'm fine with this
> being a separate library somewhere or building it all on top of opaque/private
> types. But I'm having trouble understanding where exactly the objections lie and
> what the path forward is.
Would it help if have a call on Teams or similar services to discuss the whole thing?
That might be easier and especially faster than by mail.
Regards,
Christian.
> So given no one outright rejected the plan I wrote earlier I'm going to go ahead
> and post the series implementing it (I was hoping to do that today, but it's not
> quite ready).
>
> Hopefully that will help by giving us actual code to ground the discussion on.
>
> - Alistair
>
>> Jason