RE: [PATCH v3 0/4] dma-mapping: introduce new dma unmap and sync variants
From: Madalin Bucur
Date: Mon Dec 02 2019 - 09:58:46 EST
> -----Original Message-----
> From: Christoph Hellwig <hch@xxxxxx>
> To: David Miller <davem@xxxxxxxxxxxxx>
> Subject: Re: [PATCH v3 0/4] dma-mapping: introduce new dma unmap and sync
> variants
>
> On Wed, Nov 13, 2019 at 12:11:32PM -0800, David Miller wrote:
> > > This series introduces a few new dma unmap and sync api variants
> that,
> > > on top of what the originals do, return the virtual address
> > > corresponding to the input dma address. In order to do that a new dma
> > > map op is added, .get_virt_addr that takes the input dma address and
> > > returns the virtual address backing it up.
> > > The second patch adds an implementation for this new dma map op in
> the
> > > generic iommu dma glue code and wires it in.
> > > The third patch updates the dpaa2-eth driver to use the new apis.
> >
> > The driver should store the mapping in it's private software state if
> > it needs this kind of conversion.
>
> I think the problem for this driver (and a few others) is that they
> somehow manage to split I/O completions at a different boundary
> than submissions. For me with my block I/O background this seems
> weird, but I'll need networking folks to double check the theory.
>
> > This is huge precendence for this, and there is therefore no need to
> > add even more complication and methods and burdon to architecture code
> > for the sake of this.
>
> Unfortunately there are various drivers that abuse iommu_iova_to_phys
> to get a struct page to unmap. Two of theose are network drivers
> that went in through you (dpaa2 and thunder), additonally the
> caam crypto driver (which I think is the same SOC family as dpaa,
> but I'm not sure) and the AMD GPU driver.
>
> We also have drivers that just don't unmap and this don't work with
> iommus or dma-debug (IBM EMAC another net driver).
>
> That being said I hate these new API, but I still think they are less
> bad than these IOMMU API abuses people do now. If experienced
> networking folks know a way to get rid of both I'm all for it.
Hi,
will this API be included during the v5.5 kernel development cycle or is
there an alternative solution?
Thank you,
Madalin