Re: [Linaro-mm-sig] [PATCH v8 06/11] dma-buf: provide phys_vec to scatter-gather mapping routine

Jason Gunthorpe
2025-11-19T19:31:19Z

On Wed, Nov 19, 2025 at 02:42:18PM +0100, Christian König wrote:

> >>> + case PCI_P2PDMA_MAP_THRU_HOST_BRIDGE:
> >>> + dma->state = kzalloc(sizeof(*dma->state), GFP_KERNEL);
> >>> + if (!dma->state) {
> >>> + ret = -ENOMEM;
> >>> + goto err_free_dma;
> >>> + }
> >>> +
> >>> + dma_iova_try_alloc(attach->dev, dma->state, 0, size);
> >>
> >> Oh, that is a clear no-go for the core DMA-buf code.
> >>
> >> It's intentionally up to the exporter how to create the DMA
> >> addresses the importer can work with.
> >
> > I can't fully understand this remark?
>
> The exporter should be able to decide if it actually wants to use
> P2P when the transfer has to go through the host bridge (e.g. when
> IOMMU/bridge routing bits are enabled).

Sure, but this is a simplified helper for exporters that don't have
choices where the memory comes from.

I fully expet to see changes to this to support more use cases,
including the one above. We should do those changes along with users
making use of them so we can evaluate what works best.

> But only take that as Acked-by, I would need at least a day (or
> week) of free time to wrap my head around all the technical details
> again. And that is something I won't have before January or even
> later.

Sure, it is alot, and I think DRM community in general should come up
to speed on the new DMA API and how we are pushing to see P2P work
within Linux.

So thanks, we can take the Acked-by and progress here. Interested
parties can pick it up from this point when time allows.

We can also have a mini-community call to give a summary/etc on these
topics.

Thanks,
Jason