From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gerd Hoffmann Subject: Re: [RFC PATCH] drm/virtio: Export resource handles via DMA-buf API Date: Thu, 12 Sep 2019 14:38:21 +0200 Message-ID: <20190912123821.rraib5entkcxt5p5__12322.3382326373$1568291913$gmane$org@sirius.home.kraxel.org> References: <20190912094121.228435-1-tfiga@chromium.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20190912094121.228435-1-tfiga@chromium.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: virtualization-bounces@lists.linux-foundation.org Errors-To: virtualization-bounces@lists.linux-foundation.org To: Tomasz Figa Cc: zachr@chromium.org, David Airlie , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, virtualization@lists.linux-foundation.org, keiichiw@chromium.org, stevensd@chromium.org, Daniel Vetter , marcheu@chromium.org, posciak@chromium.org List-Id: virtualization@lists.linuxfoundation.org Hi, > To seamlessly enable buffer sharing with drivers using such frameworks, > make the virtio-gpu driver expose the resource handle as the DMA address > of the buffer returned from the DMA-buf mapping operation. Arguably, the > resource handle is a kind of DMA address already, as it is the buffer > identifier that the device needs to access the backing memory, which is > exactly the same role a DMA address provides for native devices. No. A scatter list has guest dma addresses, period. Stuffing something else into a scatterlist is asking for trouble, things will go seriously wrong when someone tries to use such a fake scatterlist as real scatterlist. Also note that "the DMA address of the buffer" is bonkers in virtio-gpu context. virtio-gpu resources are not required to be physically contigous in memory, so typically you actually need a scatter list to describe them. cheers, Gerd