On Mon, Sep 14, 2026 at 04:27:00PM +0200, Christian König wrote:
> > +enum pci_p2pdma_map_type
> > +dma_buf_p2pdma_map_type(struct dma_buf_attachment *attach,
> > + unsigned int tlp_flags)
> > +{
> > + struct dma_buf *dmabuf = attach->dmabuf;
> > + struct p2pdma_provider *provider;
> > +
> > + if (!dmabuf->ops->p2pdma_provider)
> > + return PCI_P2PDMA_MAP_NONE;
> > +
> > + provider = dmabuf->ops->p2pdma_provider(dmabuf);
> > + if (!provider)
> > + return PCI_P2PDMA_MAP_NONE;
> > +
> > + return pci_p2pdma_map_type_tlp(provider, attach->dev, tlp_flags);
>
> Calling PCI subsystem functions from dma-buf is a hard NO-GO.
This is why I had the mapping type arrangement able to know if a PCI
path was involved so it could activate PCI support for that path. In
an extendable way so other interconnects could also provide their
unique knowledge too.
> I shouldn't have allowed the mapping functions to be added to
> DMA-buf in the first place, all of this belongs either into the DMA
> layer or the exporter.
DMA layer is not the place to form dmabuf's corrupted
scatterlist. This must only be done in dmabuf.
We don't want to open code this common logic in every exporter, it
needs a helper. If you have a better place where to put the thing that
makes the dmabuf unique broken scatterlist, then I'm open :) HCH isn't
going to accept anything like that outside stuff hard wired to dmabuf.
> We should probably have a single callback the exporter provides to
> fill in a structure with PCI specific information for a mapping.
Yeah, that is where I was going.
I'm really sorry I haven't been able to come back to that mapping type
series. Were you feeling positive about that? Maybe Leon or someone
can pick it up from me. I was optimistic about scaling back to just
the maping type negotiation as a first step
Jason