virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: Christoph Hellwig <hch@infradead.org>,
	Xuan Zhuo <xuanzhuo@linux.alibaba.com>,
	virtualization@lists.linux-foundation.org,
	Guenter Roeck <linux@roeck-us.net>,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [PATCH vhost v6 08/11] virtio_ring: introduce virtqueue_dma_dev()
Date: Tue, 11 Apr 2023 10:55:36 +0200	[thread overview]
Message-ID: <tnj4yvrjjlwkmecb6dkvc25na4t7bmzb2jlrdfzvjsfkih32ka@7bvxpyy4ghc4> (raw)
In-Reply-To: <CACGkMEuZss7m+qC2V+QjMJD3W1JdYAoQs6Amn1WXHYZBrJRUjg@mail.gmail.com>

On Tue, Apr 11, 2023 at 12:54:46PM +0800, Jason Wang wrote:
> On Tue, Apr 11, 2023 at 12:10 PM Christoph Hellwig <hch@infradead.org> wrote:
> >
> > On Tue, Apr 11, 2023 at 11:56:47AM +0800, Jason Wang wrote:
> > > > The DMA device for virtio_pci is the underlying PCI device, always.
> > > > !VIRTIO_F_ACCESS_PLATFORM means there is no dma device at all.  Because
> > > > of all these things you can't just expose a pointer to the dma_device
> > > > as that is just a completely wrong way of thinking about the problem.
> > >
> > > Ok, so if there's no DMA at all we should avoid using the DMA API
> > > completely. This means we should check dma_dev against NULL in
> > > virtio_has_dma_quirk().
> >
> > No nee to add a check to virtio_has_dma_quirk.
> 
> Ok, just to clarify, I meant there could be a case where the virtqueue
> is emulated by software, in this case we need check whether the
> virtqueue has a dma device or not in vring_use_dma_api(). If not we
> need return false.
> 
> > But looking at virtio_has_dma_quirk shows that virtio-gpu is
> > pretty messed up already as well.

Yes.  For gem objects allocated in guest ram virtio-gpu effectively
passes a scatter list to the host.  It doesn't use vrings for that
though, so it has to re-implement some of the logic the virtio core
already has for the vrings.

> > It can't really poke into the DMA details.  We'll need core virtio
> > helpers for allocating and syncing a sg_table instead and make
> > virtio_has_dma_quirk private to the core.

That should work.

take care,
  Gerd

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  parent reply	other threads:[~2023-04-11  8:55 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-27  4:05 [PATCH vhost v6 00/11] virtio core prepares for AF_XDP Xuan Zhuo
2023-03-27  4:05 ` [PATCH vhost v6 01/11] virtio_ring: split: separate dma codes Xuan Zhuo
2023-03-28  6:26   ` Jason Wang
2023-03-27  4:05 ` [PATCH vhost v6 02/11] virtio_ring: packed: " Xuan Zhuo
2023-03-27  4:05 ` [PATCH vhost v6 03/11] virtio_ring: packed-indirect: " Xuan Zhuo
2023-03-27  4:05 ` [PATCH vhost v6 04/11] virtio_ring: split: support premapped Xuan Zhuo
2023-03-28  6:27   ` Jason Wang
2023-03-27  4:05 ` [PATCH vhost v6 05/11] virtio_ring: packed: " Xuan Zhuo
2023-03-28  6:27   ` Jason Wang
2023-03-27  4:05 ` [PATCH vhost v6 06/11] virtio_ring: packed-indirect: " Xuan Zhuo
2023-03-28  6:29   ` Jason Wang
2023-03-27  4:05 ` [PATCH vhost v6 07/11] virtio_ring: update document for virtqueue_add_* Xuan Zhuo
2023-03-28  6:30   ` Jason Wang
2023-03-27  4:05 ` [PATCH vhost v6 08/11] virtio_ring: introduce virtqueue_dma_dev() Xuan Zhuo
2023-04-06 17:20   ` Guenter Roeck
2023-04-07  3:17     ` Xuan Zhuo
2023-04-07 12:34       ` Guenter Roeck
2023-04-07 11:02     ` Michael S. Tsirkin
2023-04-10  3:29       ` Xuan Zhuo
2023-04-10  5:14         ` Jason Wang
2023-04-10  6:03           ` Xuan Zhuo
2023-04-10  6:40             ` Michael S. Tsirkin
2023-04-10  6:42               ` Xuan Zhuo
2023-04-10 15:27           ` Christoph Hellwig
2023-04-11  1:56             ` Xuan Zhuo
2023-04-11  2:09               ` Jason Wang
2023-04-11  3:31                 ` Christoph Hellwig
2023-04-11  3:56                   ` Jason Wang
2023-04-11  4:09                     ` Christoph Hellwig
2023-04-11  4:54                       ` Jason Wang
2023-04-11  5:14                         ` Christoph Hellwig
2023-04-11  5:19                           ` Jason Wang
2023-04-11  8:55                         ` Gerd Hoffmann [this message]
2023-04-11  6:11                     ` Xuan Zhuo
2023-04-11  6:20                       ` Christoph Hellwig
2023-04-11  6:28                         ` Xuan Zhuo
2023-04-11  6:46                           ` Christoph Hellwig
2023-04-11  6:51                             ` Xuan Zhuo
2023-04-11  7:04                               ` Xuan Zhuo
2023-04-12  2:03                           ` Xuan Zhuo
2023-04-12 11:54                             ` Christoph Hellwig
2023-04-11  3:26               ` Christoph Hellwig
2023-04-11  6:23                 ` Xuan Zhuo
2023-04-11  6:30                   ` Christoph Hellwig
2023-04-11  6:33                     ` Xuan Zhuo
2023-04-11  6:45                       ` Christoph Hellwig
2023-04-11  7:23                         ` Xuan Zhuo
2023-04-11 12:16                           ` Christoph Hellwig
2023-04-18  6:18                             ` Xuan Zhuo
2023-04-19  5:10                               ` Christoph Hellwig
2023-04-19  6:16                                 ` Xuan Zhuo
2023-04-11  7:12           ` Xuan Zhuo
2023-04-11  8:59             ` Jason Wang
2023-04-11 12:17             ` Christoph Hellwig
2023-03-27  4:05 ` [PATCH vhost v6 09/11] virtio_ring: correct the expression of the description of virtqueue_resize() Xuan Zhuo
2023-03-27  4:05 ` [PATCH vhost v6 10/11] virtio_ring: separate the logic of reset/enable from virtqueue_resize Xuan Zhuo
2023-03-27  4:05 ` [PATCH vhost v6 11/11] virtio_ring: introduce virtqueue_reset() Xuan Zhuo

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=tnj4yvrjjlwkmecb6dkvc25na4t7bmzb2jlrdfzvjsfkih32ka@7bvxpyy4ghc4 \
    --to=kraxel@redhat.com \
    --cc=hch@infradead.org \
    --cc=jasowang@redhat.com \
    --cc=linux@roeck-us.net \
    --cc=mst@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=xuanzhuo@linux.alibaba.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).