On Fri, Nov 27, 2026 at 09:04:15AM +0100, Christian König wrote:
If we somehow prevent the CPU physical address from being casted to a struct page and/or used with vmf_insert_pfn/page/dma_map_page etc.. then there is not much of a problem with passing around physical addresses.
I already offered that in v1 of the series using limits on EXPORT_SYMBOL and you NAK'd it too.
If we need to shared object backings and have clearly typed and negotiated on what the backing contains then we should allow it. However I mostly agree on the mapping thing, I'd want drivers to negotiate and natively support whatever backings they can rather than having an intermediate trying to handle the conversions Not saying the
Yes, exactly that's my concern as well. We need to avoid this middle layer trap.
You avoid middle layers by having reasonable subsystem helpers for things to use to build their stuff, especially to encapsulate common patterns. These helpers are part of the subsystem, or in a related subysstem helper library.
In Linux terms middle layer almost always means something wrapping a function pointer callback into a driver and enforcing specific actions on top of that. The recommended counter is to have the driver perform the actions with helpers and not wrapper the ops. It particularly came from the block world where they stuck something like SCSI after the block ops but before the driver.
It is hard to see that DMABUF is anywhere close to a middle layer.
This is also why we don't understand your remarks about dma_buf_phys_vec_to_sgt(). Of course it belongs in dmabuf, it produces the dmabuf spec'd mangled scatterlist that only dmabuf uses. Where else would you put this code?
code doing the conversions can't be a helper, bit it shouldn't ever be autoamtic or outside driver control.
I think you do want it automatic, if an exporter is new and makes, say, a dma_addr_t[] and the importer is old and wants a sgt, why should we be open coding anything in every driver to deal with this?
You can argue if it is automatic because the driver called a very general helper or automatic because the helper is wrapping a callback, but that should be a fairly minor quibble not a huge thread full of NAKs.
Ultimately DMABUF has a fairly simple flow: 1) Allow importer/exporter to negotiate what kind of interconnect they want to use (PCI, ualink, etc) 2) Give the exporter enough information about the interconect path to make a placement decision 3) Describe the exporter's buffer so any mappings/translation/etc can be setup for the importer 4) Program the importers HW.
Many of these have very common patterns, like PCI GPUs always make the same kind of VRAM placement decision in #2 based on P2P support. This should all be in helpers under the dmabuf umbrella and not open coded.
Jason