From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933548AbcAaUOV (ORCPT ); Sun, 31 Jan 2016 15:14:21 -0500 Received: from mail-ob0-f176.google.com ([209.85.214.176]:35461 "EHLO mail-ob0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933445AbcAaUOS (ORCPT ); Sun, 31 Jan 2016 15:14:18 -0500 MIME-Version: 1.0 In-Reply-To: <20160131220601-mutt-send-email-mst@redhat.com> References: <64e979cc139c5e6a9bbfae9f1bc5e6693d91bea9.1454034075.git.luto@kernel.org> <56AB4053.4070007@citrix.com> <20160131220601-mutt-send-email-mst@redhat.com> From: Andy Lutomirski Date: Sun, 31 Jan 2016 12:13:58 -0800 Message-ID: Subject: Re: [Xen-devel] [PATCH v5 09/10] vring: Use the DMA API on Xen To: "Michael S. Tsirkin" Cc: David Vrabel , Andy Lutomirski , Cornelia Huck , Joerg Roedel , KVM , linux-s390 , Benjamin Herrenschmidt , Stefano Stabellini , Sebastian Ott , "linux-kernel@vger.kernel.org" , Christoph Hellwig , Christian Borntraeger , "xen-devel@lists.xenproject.org" , sparclinux@vger.kernel.org, Paolo Bonzini , Linux Virtualization , David Woodhouse , "David S. Miller" , Martin Schwidefsky 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 Sun, Jan 31, 2016 at 12:09 PM, Michael S. Tsirkin wrote: > On Fri, Jan 29, 2016 at 10:34:59AM +0000, David Vrabel wrote: >> On 29/01/16 02:31, Andy Lutomirski wrote: >> > Signed-off-by: Andy Lutomirski >> > --- >> > drivers/virtio/virtio_ring.c | 12 ++++++++++++ >> > 1 file changed, 12 insertions(+) >> > >> > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c >> > index c169c6444637..305c05cc249a 100644 >> > --- a/drivers/virtio/virtio_ring.c >> > +++ b/drivers/virtio/virtio_ring.c >> > @@ -47,6 +47,18 @@ >> > >> > static bool vring_use_dma_api(void) >> > { >> > +#if defined(CONFIG_X86) && defined(CONFIG_XEN) >> > + /* >> > + * In theory, it's possible to have a buggy QEMU-supposed >> > + * emulated Q35 IOMMU and Xen enabled at the same time. On >> > + * such a configuration, virtio has never worked and will >> > + * not work without an even larger kludge. Instead, enable >> > + * the DMA API if we're a Xen guest, which at least allows >> > + * all of the sensible Xen configurations to work correctly. >> > + */ >> > + return static_cpu_has(X86_FEATURE_XENPV); >> >> You want: >> >> if (xen_domain()) >> return true; >> >> Without the #if so we use the DMA API for all types of Xen guest on all >> architectures. >> >> David > > I doubt HVM domains can have virtio devices. > They certainly can under nested virt (L0 provides virtio device, L1 is Xen, and L2 is Linux). Of course, this won't work given the current QEMU situation unless Xen can pass things through to dom0 without an IOMMU, which seems plausible to me. But yes, xen_domain() sounds right to me. I just failed to find that function when I wrote this patch. Michael, if you like the rest of the series, I'd be okay if you changed this patch to use xen_domain() when you apply it. If I send a v2, I'll fix it up. --Andy From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andy Lutomirski Subject: Re: [Xen-devel] [PATCH v5 09/10] vring: Use the DMA API on Xen Date: Sun, 31 Jan 2016 12:13:58 -0800 Message-ID: References: <64e979cc139c5e6a9bbfae9f1bc5e6693d91bea9.1454034075.git.luto@kernel.org> <56AB4053.4070007@citrix.com> <20160131220601-mutt-send-email-mst@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20160131220601-mutt-send-email-mst@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: virtualization-bounces@lists.linux-foundation.org Errors-To: virtualization-bounces@lists.linux-foundation.org List-Archive: List-Post: To: "Michael S. Tsirkin" Cc: linux-s390 , sparclinux@vger.kernel.org, Joerg Roedel , KVM , Stefano Stabellini , Benjamin Herrenschmidt , Sebastian Ott , "linux-kernel@vger.kernel.org" , Linux Virtualization , Christian Borntraeger , "David S. Miller" , David Vrabel , Andy Lutomirski , Paolo Bonzini , "xen-devel@lists.xenproject.org" , David Woodhouse , Christoph Hellwig , Martin Schwidefsky List-ID: On Sun, Jan 31, 2016 at 12:09 PM, Michael S. Tsirkin wrote: > On Fri, Jan 29, 2016 at 10:34:59AM +0000, David Vrabel wrote: >> On 29/01/16 02:31, Andy Lutomirski wrote: >> > Signed-off-by: Andy Lutomirski >> > --- >> > drivers/virtio/virtio_ring.c | 12 ++++++++++++ >> > 1 file changed, 12 insertions(+) >> > >> > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c >> > index c169c6444637..305c05cc249a 100644 >> > --- a/drivers/virtio/virtio_ring.c >> > +++ b/drivers/virtio/virtio_ring.c >> > @@ -47,6 +47,18 @@ >> > >> > static bool vring_use_dma_api(void) >> > { >> > +#if defined(CONFIG_X86) && defined(CONFIG_XEN) >> > + /* >> > + * In theory, it's possible to have a buggy QEMU-supposed >> > + * emulated Q35 IOMMU and Xen enabled at the same time. On >> > + * such a configuration, virtio has never worked and will >> > + * not work without an even larger kludge. Instead, enable >> > + * the DMA API if we're a Xen guest, which at least allows >> > + * all of the sensible Xen configurations to work correctly. >> > + */ >> > + return static_cpu_has(X86_FEATURE_XENPV); >> >> You want: >> >> if (xen_domain()) >> return true; >> >> Without the #if so we use the DMA API for all types of Xen guest on all >> architectures. >> >> David > > I doubt HVM domains can have virtio devices. > They certainly can under nested virt (L0 provides virtio device, L1 is Xen, and L2 is Linux). Of course, this won't work given the current QEMU situation unless Xen can pass things through to dom0 without an IOMMU, which seems plausible to me. But yes, xen_domain() sounds right to me. I just failed to find that function when I wrote this patch. Michael, if you like the rest of the series, I'd be okay if you changed this patch to use xen_domain() when you apply it. If I send a v2, I'll fix it up. --Andy From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andy Lutomirski Date: Sun, 31 Jan 2016 20:13:58 +0000 Subject: Re: [Xen-devel] [PATCH v5 09/10] vring: Use the DMA API on Xen Message-Id: List-Id: References: <64e979cc139c5e6a9bbfae9f1bc5e6693d91bea9.1454034075.git.luto@kernel.org> <56AB4053.4070007@citrix.com> <20160131220601-mutt-send-email-mst@redhat.com> In-Reply-To: <20160131220601-mutt-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: "Michael S. Tsirkin" Cc: linux-s390 , sparclinux@vger.kernel.org, Joerg Roedel , KVM , Stefano Stabellini , Benjamin Herrenschmidt , Sebastian Ott , "linux-kernel@vger.kernel.org" , Linux Virtualization , Christian Borntraeger , "David S. Miller" , David Vrabel , Andy Lutomirski , Paolo Bonzini , "xen-devel@lists.xenproject.org" , David Woodhouse , Christoph Hellwig , Martin Schwidefsky On Sun, Jan 31, 2016 at 12:09 PM, Michael S. Tsirkin wrote: > On Fri, Jan 29, 2016 at 10:34:59AM +0000, David Vrabel wrote: >> On 29/01/16 02:31, Andy Lutomirski wrote: >> > Signed-off-by: Andy Lutomirski >> > --- >> > drivers/virtio/virtio_ring.c | 12 ++++++++++++ >> > 1 file changed, 12 insertions(+) >> > >> > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c >> > index c169c6444637..305c05cc249a 100644 >> > --- a/drivers/virtio/virtio_ring.c >> > +++ b/drivers/virtio/virtio_ring.c >> > @@ -47,6 +47,18 @@ >> > >> > static bool vring_use_dma_api(void) >> > { >> > +#if defined(CONFIG_X86) && defined(CONFIG_XEN) >> > + /* >> > + * In theory, it's possible to have a buggy QEMU-supposed >> > + * emulated Q35 IOMMU and Xen enabled at the same time. On >> > + * such a configuration, virtio has never worked and will >> > + * not work without an even larger kludge. Instead, enable >> > + * the DMA API if we're a Xen guest, which at least allows >> > + * all of the sensible Xen configurations to work correctly. >> > + */ >> > + return static_cpu_has(X86_FEATURE_XENPV); >> >> You want: >> >> if (xen_domain()) >> return true; >> >> Without the #if so we use the DMA API for all types of Xen guest on all >> architectures. >> >> David > > I doubt HVM domains can have virtio devices. > They certainly can under nested virt (L0 provides virtio device, L1 is Xen, and L2 is Linux). Of course, this won't work given the current QEMU situation unless Xen can pass things through to dom0 without an IOMMU, which seems plausible to me. But yes, xen_domain() sounds right to me. I just failed to find that function when I wrote this patch. Michael, if you like the rest of the series, I'd be okay if you changed this patch to use xen_domain() when you apply it. If I send a v2, I'll fix it up. --Andy