[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180416123937.GA9073@infradead.org>
Date: Mon, 16 Apr 2018 05:39:37 -0700
From: Christoph Hellwig <hch@...radead.org>
To: Jerome Glisse <jglisse@...hat.com>, christian.koenig@....com,
linaro-mm-sig@...ts.linaro.org, linux-media@...r.kernel.org,
dri-devel@...ts.freedesktop.org, amd-gfx@...ts.freedesktop.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 4/8] dma-buf: add peer2peer flag
On Tue, Apr 03, 2018 at 08:08:32PM +0200, Daniel Vetter wrote:
> I did not mean you should dma_map_sg/page. I just meant that using
> dma_map_resource to fill only the dma address part of the sg table seems
> perfectly sufficient.
But that is not how the interface work, especially facing sg_dma_len.
> Assuming you get an sg table that's been mapping by calling dma_map_sg was
> always a bit a case of bending the abstraction to avoid typing code. The
> only thing an importer ever should have done is look at the dma addresses
> in that sg table, nothing else.
The scatterlist is not a very good abstraction unfortunately, but it
it is spread all over the kernel. And we do expect that anyone who
gets passed a scatterlist can use sg_page() or sg_virt() (which calls
sg_page()) on it. Your changes would break that, and will cause major
trouble because of that.
If you want to expose p2p memory returned from dma_map_resource in
dmabuf do not use scatterlists for this please, but with a new interface
that explicitly passes a virtual address, a dma address and a length
and make it very clear that virt_to_page will not work on the virtual
address.
Powered by blists - more mailing lists