Re: [RFC PATCH v1 00/18] Provide a new two step DMA API mapping API
From: Jason Gunthorpe
Date: Thu Jul 11 2024 - 19:22:08 EST
On Wed, Jul 10, 2024 at 08:27:04AM +0200, Christoph Hellwig wrote:
> On Tue, Jul 09, 2024 at 03:53:15PM -0300, Jason Gunthorpe wrote:
> > > That whole thing of course opens the question if we want a pure
> > > in-memory version of the dma_addr_t/len tuple. IMHO that is the best
> > > way to migrate and allows to share code easily. We can look into ways
> > > to avoiding that more for drivers that care, but most drivers are
> > > probably best serve with it to keep the code simple and make the
> > > conversion easier.
> >
> > My feeling has been that this RFC is the low level interface and we
> > can bring our own data structure on top.
> >
> > It would probably make sense to build a scatterlist v2 on top of this
> > that has an in-memory dma_addr_t/len list close to today
>
> Yes, the usage of the dma_vec would be in a higher layer. But I'd
> really like to see it from the beginning.
Well, lets start with agreeing on this layer's API and be confident it
can succeed.
Then I'd say to look at RDMA as it is a logical place to build such a
data structure and we can build something that at least does what RDMA
needs.
I need something anyhow to plumb through to DMABUF and over to iommufd
and VFIO, can't skip out on it :)
> Yes, I don't think the dma_vec should be the low-level interface.
> I think a low-level interface based on physical address is the right
> one. I'll see what I can do to move the single segment map interface
> to be physical address based instead of page based so that we can
> unify them.
Yeah, I've been talking to Matthew explaining that starting at the DMA
API makes the most sense and lets remove mandatory struct page
entanglements there. Then we can start to examine other layers. Having
a consistent option in the DMA API to be physically based with a
memory type fits with that plan.
Jason