Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1257596

Re: [PATCH 3/3] virtio_pci: Use the DMA API

From David Woodhouse <dwmw2@infradead.org>
Newsgroups linux.kernel
Subject Re: [PATCH 3/3] virtio_pci: Use the DMA API
Date 2015-10-28 03:30 +0100
Message-ID <qooEW-4Wx-13@gated-at.bofh.it> (permalink)
References <qonzc-4kh-3@gated-at.bofh.it> <qonzc-4kh-15@gated-at.bofh.it> <qoovf-4Tc-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Wed, 2015-10-28 at 11:15 +0900, Joerg Roedel wrote:
> On Tue, Oct 27, 2015 at 06:17:10PM -0700, Andy Lutomirski wrote:
> > From: Andy Lutomirski <luto@amacapital.net>
> > 
> > This fixes virtio-pci on platforms and busses that have IOMMUs. 
> >  This
> > will break the experimental QEMU Q35 IOMMU support until QEMU is
> > fixed.  In exchange, it fixes physical virtio hardware as well as
> > virtio-pci running under Xen.
> > 
> > We should clean up the virtqueue API to do its own allocation and
> > teach virtqueue_get_avail and virtqueue_get_used to return DMA
> > addresses directly.
> > 
> > Signed-off-by: Andy Lutomirski <luto@kernel.org>
> > ---
> >  drivers/virtio/virtio_pci_common.h |  3 ++-
> >  drivers/virtio/virtio_pci_legacy.c | 19 +++++++++++++++----
> >  drivers/virtio/virtio_pci_modern.c | 34 ++++++++++++++++++++++++--
> > --------
> >  3 files changed, 41 insertions(+), 15 deletions(-)
> 
> Same here, you need to call the dma_sync* functions when passing data
> from/to the virtio-device.
> 
> I think a good test for that is to boot a virtio kvm-guest with
> swiotlb=force and see if it still works.

That's useful but doesn't cover the cases where dma_wmb() is needed,
right? 

We should make sure we're handling descriptors properly as we would for
real hardware, and ensuring that addresses etc. are written to the
descriptor (and a write barrier occurs) *before* the bit is set which
tells the 'hardware' that it owns that descriptor.

AFAICT we're currently setting the flags *first* in virtqueue_add(),
let alone the missing write barrier between the two.

-- 
dwmw2


Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 3/3] virtio_pci: Use the DMA API Andy Lutomirski <luto@kernel.org> - 2015-10-28 02:20 +0100
  Re: [PATCH 3/3] virtio_pci: Use the DMA API Joerg Roedel <jroedel@suse.de> - 2015-10-28 03:20 +0100
    Re: [PATCH 3/3] virtio_pci: Use the DMA API Joerg Roedel <jroedel@suse.de> - 2015-10-28 03:30 +0100
    Re: [PATCH 3/3] virtio_pci: Use the DMA API David Woodhouse <dwmw2@infradead.org> - 2015-10-28 03:30 +0100
      Re: [PATCH 3/3] virtio_pci: Use the DMA API Joerg Roedel <jroedel@suse.de> - 2015-10-28 04:00 +0100

csiph-web