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


Groups > linux.kernel > #1325750

Re: [PATCH v7 5/9] virtio_ring: Support DMA APIs

From Andy Lutomirski <luto@amacapital.net>
Newsgroups linux.kernel
Subject Re: [PATCH v7 5/9] virtio_ring: Support DMA APIs
Date 2016-02-03 19:00 +0100
Message-ID <qY9SH-58b-29@gated-at.bofh.it> (permalink)
References <qXYud-6cO-3@gated-at.bofh.it> <qXYuf-6cO-19@gated-at.bofh.it> <qY68s-2Gi-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Feb 3, 2016 5:52 AM, "Michael S. Tsirkin" <mst@redhat.com> wrote:
>
> On Tue, Feb 02, 2016 at 09:46:36PM -0800, Andy Lutomirski wrote:
> > virtio_ring currently sends the device (usually a hypervisor)
> > physical addresses of its I/O buffers.  This is okay when DMA
> > addresses and physical addresses are the same thing, but this isn't
> > always the case.  For example, this never works on Xen guests, and
> > it is likely to fail if a physical "virtio" device ever ends up
> > behind an IOMMU or swiotlb.
> >
> > The immediate use case for me is to enable virtio on Xen guests.
> > For that to work, we need vring to support DMA address translation
> > as well as a corresponding change to virtio_pci or to another
> > driver.
> >
> > Signed-off-by: Andy Lutomirski <luto@kernel.org>
> > ---
> >  drivers/virtio/Kconfig           |   2 +-
> >  drivers/virtio/virtio_ring.c     | 200 ++++++++++++++++++++++++++++++++-------
> >  tools/virtio/linux/dma-mapping.h |  17 ++++
> >  3 files changed, 183 insertions(+), 36 deletions(-)
> >  create mode 100644 tools/virtio/linux/dma-mapping.h
> >
> > diff --git a/drivers/virtio/Kconfig b/drivers/virtio/Kconfig
> > index cab9f3f63a38..77590320d44c 100644
> > --- a/drivers/virtio/Kconfig
> > +++ b/drivers/virtio/Kconfig
> > @@ -60,7 +60,7 @@ config VIRTIO_INPUT
> >
> >   config VIRTIO_MMIO
> >       tristate "Platform bus driver for memory mapped virtio devices"
> > -     depends on HAS_IOMEM
> > +     depends on HAS_IOMEM && HAS_DMA
> >       select VIRTIO
> >       ---help---
> >        This drivers provides support for memory mapped virtio
>
> What's this chunk doing here btw? Should be part of the mmio patch?
>

IIRC it was deliberate.  Making virtio depend on HAS_DMA didn't work
right because kconfig doesn't propagate dependencies through select
intelligently.  This patch makes core virtio depend on HAS_DMA, so I
added the dependency here, too.

--Andy

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


Thread

[PATCH v7 5/9] virtio_ring: Support DMA APIs Andy Lutomirski <luto@kernel.org> - 2016-02-03 06:50 +0100
  Re: [PATCH v7 5/9] virtio_ring: Support DMA APIs "Michael S. Tsirkin" <mst@redhat.com> - 2016-02-03 15:00 +0100
    Re: [PATCH v7 5/9] virtio_ring: Support DMA APIs Andy Lutomirski <luto@amacapital.net> - 2016-02-03 19:00 +0100

csiph-web