From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965168AbcBCRyD (ORCPT ); Wed, 3 Feb 2016 12:54:03 -0500 Received: from mail-ob0-f169.google.com ([209.85.214.169]:34290 "EHLO mail-ob0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933520AbcBCRx7 (ORCPT ); Wed, 3 Feb 2016 12:53:59 -0500 MIME-Version: 1.0 In-Reply-To: <20160203154633-mutt-send-email-mst@redhat.com> References: <20160203154633-mutt-send-email-mst@redhat.com> From: Andy Lutomirski Date: Wed, 3 Feb 2016 09:53:39 -0800 Message-ID: Subject: Re: [PATCH v7 5/9] virtio_ring: Support DMA APIs To: "Michael S. Tsirkin" Cc: Christian Borntraeger , Paolo Bonzini , David Woodhouse , "xen-devel@lists.xenproject.org" , Martin Schwidefsky , Sebastian Ott , "David S. Miller" , linux-s390 , David Vrabel , Cornelia Huck , Joerg Roedel , KVM , Benjamin Herrenschmidt , Stefano Stabellini , Christoph Hellwig , Linux Virtualization , "linux-kernel@vger.kernel.org" , sparclinux@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Feb 3, 2016 5:52 AM, "Michael S. Tsirkin" 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 > > --- > > 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