Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp2270676ybe; Thu, 12 Sep 2019 07:08:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqzgCOOirEDkBIOrJTQ0qczw+rlVfx+5hU9a94HqVa1CG80gxWSyUKmh2LGb1zpJt9tAJr5S X-Received: by 2002:a17:906:2356:: with SMTP id m22mr35248293eja.121.1568297309362; Thu, 12 Sep 2019 07:08:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568297309; cv=none; d=google.com; s=arc-20160816; b=gsWgG5uElw99Ql1l7NJ6OGykJPrVNAbnWtE3+UzGRCIn6ebO9psBfvn3fhZBaVcL8x dfoYpI7PpLtV+zSxPRXtzhov8F8HdKZkl8jAU4le2F/dsldqmeZfJFUojZxafr/PcLtf uqcNyHZ3HY+GWq/OFGjda4lUVdw/k1mm/lJHeuNRadvxkw5Qc50WF/dcnL6Oie1TRtRp MZAehOYf+hm2/lIAaUfpsMYD9MkO9RBk5tAVA4tuL/z0dqnDNOTqPO12zH7TuI+AA1f4 /sCJnZI/jbMgQfjHjZSLPCUb2PSS1V+YtrUfqIzlIZqeGybCVjxtshU4jZ3CP3PJP9uT jg5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=ha/ksfChi40fvWXvJ2Pp1OUPpzkomxxm5i7dcskz7Q0=; b=ynOtc1R8DZdPgNN0PQiSzRlsqglyvV4iq5Z116NO9hIzzt+svw4r8tgcAyea/YKTjK SeuQBqlSFsfgbjRwqSKMMwjnlRkClhz2kH+Tn/0VlIrNEFoFtiyfvfxBC201TOhhbktS 7wemdWW4K0NZKefEFkXR9QFfeQwIH9bBmmgKATFjiEOqsuD3qjVBvdmb7Bofq0KNmVcv 0x/bbgwyevCTtS+SVa8mE5yXAg0PdsqlNZ/Hct4uKqh3XNqs1epP1pLu3bhJreZkS/q5 b4PwzujGGlhr2R7I0FsESs8HsmHahWFw++tK0g2ywWpmzD/XnvgCr8hrYsmlBf8dI1nB nvDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="N1uaN/ry"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o2si13216067ejx.40.2019.09.12.07.08.04; Thu, 12 Sep 2019 07:08:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="N1uaN/ry"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732453AbfILOFP (ORCPT + 99 others); Thu, 12 Sep 2019 10:05:15 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:33743 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732447AbfILOFO (ORCPT ); Thu, 12 Sep 2019 10:05:14 -0400 Received: by mail-ed1-f68.google.com with SMTP id o9so24112451edq.0 for ; Thu, 12 Sep 2019 07:05:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ha/ksfChi40fvWXvJ2Pp1OUPpzkomxxm5i7dcskz7Q0=; b=N1uaN/ryzApCA4SADojux1E9zO7nn0OPjjEhdzhTt0JKsMtlgusANPx2drUgpBAlLs SoZeqeON7maPDbM+8sK+uV/VnXPnMhc5g1bliSnosSXlo6RK5RwkdtVIW7Qp0ctU+sSL QIWvxhqIgpV8zoKpYk8nnZDbkc4QWsB8IV8IA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ha/ksfChi40fvWXvJ2Pp1OUPpzkomxxm5i7dcskz7Q0=; b=Jv5rqHH0jIwk3j4PF6LxFJtjx6P9XLkoMe3lXEM6q9p1mINRgbH6NBClZSahNB2h3N we130suHIAo4DtjaeXMNTx3anbRmMbOEGIIXcPs9McJ2Z/lUOqY/nvPPSVSkI7iVYEZt XxHWFjyiiiLJr3zjMmBFXofrV4ZGYHh976meHWTaVhXghG4WZO2HzRiN+41LfW9OXrqM Ucct2wyWb112rn/wiEisc02A5mrpyEHxWdGkC77ZWC28Z26ygqPM15fYv5PArgLLGux6 9q3KDT8kJ0adyRJY6jy8NWolRRTGelFSvyfzIGrJnie/49uyFwdTt1g6zFxoDqZfPz7J V8ow== X-Gm-Message-State: APjAAAXI0gHCBeLRrONxJq2peB6EC9cZBwU6h7imLAULXaRdkejRpvXT rSbeXFWOw2kKoT/G0DqJoEpGIT4C/zenAQ== X-Received: by 2002:a05:6402:651:: with SMTP id u17mr34830937edx.59.1568297112249; Thu, 12 Sep 2019 07:05:12 -0700 (PDT) Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com. [209.85.221.46]) by smtp.gmail.com with ESMTPSA id f4sm4564572edf.47.2019.09.12.07.05.11 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 Sep 2019 07:05:11 -0700 (PDT) Received: by mail-wr1-f46.google.com with SMTP id h7so27599263wrw.8 for ; Thu, 12 Sep 2019 07:05:11 -0700 (PDT) X-Received: by 2002:a05:6000:1082:: with SMTP id y2mr35193821wrw.77.1568297110781; Thu, 12 Sep 2019 07:05:10 -0700 (PDT) MIME-Version: 1.0 References: <20190912094121.228435-1-tfiga@chromium.org> <20190912123821.rraib5entkcxt5p5@sirius.home.kraxel.org> In-Reply-To: <20190912123821.rraib5entkcxt5p5@sirius.home.kraxel.org> From: Tomasz Figa Date: Thu, 12 Sep 2019 23:04:59 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH] drm/virtio: Export resource handles via DMA-buf API To: Gerd Hoffmann Cc: David Airlie , Daniel Vetter , dri-devel , virtualization@lists.linux-foundation.org, Linux Kernel Mailing List , stevensd@chromium.org, =?UTF-8?Q?St=C3=A9phane_Marchesin?= , Zach Reizner , Keiichi Watanabe , Pawel Osciak Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Gerd, On Thu, Sep 12, 2019 at 9:38 PM Gerd Hoffmann wrote: > > 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. First of all, thanks for taking a look at this. > > 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. What is a "guest dma address"? The definition of a DMA address in the Linux DMA API is an address internal to the DMA master address space. For virtio, the resource handle namespace may be such an address space. However, we could as well introduce a separate DMA address space if resource handles are not the right way to refer to the memory from other virtio devices. > > 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. There is no such requirement even on a bare metal system, see any system that has an IOMMU, which is typical on ARM/ARM64. The DMA address space must be contiguous only from the DMA master point of view. Best regards, Tomasz