Re: [Linaro-mm-sig] [PATCH v3 1/2] habanalabs: define uAPI to export FD for DMA-BUF
From: Christoph Hellwig
Date: Thu Jun 24 2021 - 09:22:58 EST
On Thu, Jun 24, 2021 at 11:52:47AM +0200, Christian König wrote:
> I've already converted a bunch of the GPU drivers, but there are at least 6
> GPU still needing to be fixed and on top of that comes VA-API and a few
> others.
>
> What are your plans for the DMA mapping subsystem?
Building a new API that allows batched DMA mapping without the scatterlist.
The main input for my use case would be bio_vecs, but I plan to make it
a little flexible, and the output would be a list of [dma_addr,len]
tuples, with the API being flexible enough to just return a single
[dma_addr,len] for the common IOMMU coalescing case.
>
>> Btw, one thing I noticed when looking over the dma-buf instances is that
>> there is a lot of duplicated code for creating a sg_table from pages,
>> and then mapping it. It would be good if we could move toward common
>> helpers instead of duplicating that all over again.
>
> Can you give an example?
Take a look at the get_sg_table and put_sg_table helpers in udmabuf.
Those would also be useful in armda, i915, tegra, gntdev-dmabuf, mbochs
in one form or another.
Similar for variants that use a contigous regions.