All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tomasz Figa <tfiga@chromium.org>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: "David Airlie" <airlied@linux.ie>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	virtualization@lists.linux-foundation.org,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	stevensd@chromium.org,
	"Stéphane Marchesin" <marcheu@chromium.org>,
	"Zach Reizner" <zachr@chromium.org>,
	"Keiichi Watanabe" <keiichiw@chromium.org>,
	"Pawel Osciak" <posciak@chromium.org>
Subject: Re: [RFC PATCH] drm/virtio: Export resource handles via DMA-buf API
Date: Thu, 12 Sep 2019 23:04:59 +0900	[thread overview]
Message-ID: <CAAFQd5AFXfu7ysFCi1XQS61DK8nbSk5-=UHkvpYWDtFae5YQ6Q@mail.gmail.com> (raw)
In-Reply-To: <20190912123821.rraib5entkcxt5p5@sirius.home.kraxel.org>

Hi Gerd,

On Thu, Sep 12, 2019 at 9:38 PM Gerd Hoffmann <kraxel@redhat.com> 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

  reply	other threads:[~2019-09-12 14:05 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-12  9:41 [RFC PATCH] drm/virtio: Export resource handles via DMA-buf API Tomasz Figa
2019-09-12 12:38 ` Gerd Hoffmann
2019-09-12 12:38 ` Gerd Hoffmann
2019-09-12 14:04   ` Tomasz Figa [this message]
2019-09-13  8:07     ` Gerd Hoffmann
2019-09-13  8:07     ` Gerd Hoffmann
2019-09-13  8:31       ` Tomasz Figa
2019-09-13 11:05         ` Gerd Hoffmann
2019-09-13 11:05         ` Gerd Hoffmann
2019-09-19 11:41           ` Keiichi Watanabe
2019-09-17 13:23 ` Daniel Vetter
2019-09-17 13:23 ` Daniel Vetter
2019-10-05  5:41   ` Tomasz Figa
2019-10-05  5:41     ` Tomasz Figa
2019-10-08 10:03     ` Daniel Vetter
2019-10-08 10:03     ` Daniel Vetter
2019-10-08 10:49       ` Tomasz Figa
2019-10-08 15:04         ` Daniel Vetter
2019-10-16  3:19           ` Tomasz Figa
2019-10-16  6:12             ` Gerd Hoffmann
2019-10-16  6:12             ` Gerd Hoffmann
2019-10-16  6:12               ` Gerd Hoffmann
2019-10-16  8:27               ` Tomasz Figa
2019-10-16  9:18             ` Daniel Vetter
2019-10-16  9:18             ` Daniel Vetter
2019-10-16 10:31               ` Tomasz Figa
2019-10-08 15:04         ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAAFQd5AFXfu7ysFCi1XQS61DK8nbSk5-=UHkvpYWDtFae5YQ6Q@mail.gmail.com' \
    --to=tfiga@chromium.org \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=keiichiw@chromium.org \
    --cc=kraxel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcheu@chromium.org \
    --cc=posciak@chromium.org \
    --cc=stevensd@chromium.org \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=zachr@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.