Received: from eggs.gnu.org ([2001:4830:134:3::10]:42838) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQ9kf-0006IH-12 for qemu-devel@nongnu.org; Thu, 21 Jul 2016 04:54:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bQ9kb-0006eG-0V for qemu-devel@nongnu.org; Thu, 21 Jul 2016 04:54:41 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:58254 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQ9ka-0006eA-SQ for qemu-devel@nongnu.org; Thu, 21 Jul 2016 04:54:36 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u6L8rZin141106 for ; Thu, 21 Jul 2016 04:54:36 -0400 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0b-001b2d01.pphosted.com with ESMTP id 24aj3x7y03-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 21 Jul 2016 04:54:35 -0400 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 21 Jul 2016 09:54:33 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 9E6051B0804B for ; Thu, 21 Jul 2016 09:55:49 +0100 (BST) Received: from d06av08.portsmouth.uk.ibm.com (d06av08.portsmouth.uk.ibm.com [9.149.37.249]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u6L8sPLF62718040 for ; Thu, 21 Jul 2016 08:54:25 GMT Received: from d06av08.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u6L8sOtE001233 for ; Thu, 21 Jul 2016 02:54:24 -0600 Date: Thu, 21 Jul 2016 10:54:21 +0200 From: Cornelia Huck In-Reply-To: <1469028501-23780-1-git-send-email-marcel@redhat.com> References: <1469028501-23780-1-git-send-email-marcel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-Id: <20160721105421.4dfe9669.cornelia.huck@de.ibm.com> Subject: Re: [Qemu-devel] [PATCH V3] hw/virtio-pci: fix virtio behaviour List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marcel Apfelbaum Cc: qemu-devel@nongnu.org, mst@redhat.com, kraxel@redhat.com On Wed, 20 Jul 2016 18:28:21 +0300 Marcel Apfelbaum wrote: > Enable transitional virtio devices by default. > Enable virtio-1.0 for devices plugged into > PCIe ports (Root ports or Downstream ports). Add "by default", as this can still be overridden? > > Using the virtio-1 mode will remove the limitation s/Using the virtio-1 mode/Disabling the legacy mode/ ? > of the number of devices that can be attached to a machine > by removing the need for the IO BAR. > > Signed-off-by: Marcel Apfelbaum (...) > +static inline bool virtio_pci_modern(VirtIOPCIProxy *proxy) > +{ > + return !proxy->disable_modern; > +} > + > +static inline bool virtio_pci_legacy(VirtIOPCIProxy *proxy) > +{ > + return proxy->disable_legacy == ON_OFF_AUTO_OFF; > +} > + > +static inline void virtio_pci_force_virtio_1(VirtIOPCIProxy *proxy) One thing I still find a bit confusing is that you refer to 'modern' above, but force to 'virtio_1' here... but that's a minor thing. > +{ > + proxy->disable_modern = false; > + proxy->disable_legacy = ON_OFF_AUTO_ON; > +} > > /* > * virtio-scsi-pci: This extends VirtioPCIProxy. > diff --git a/include/hw/compat.h b/include/hw/compat.h > index 9914e7a..1531399 100644 > --- a/include/hw/compat.h > +++ b/include/hw/compat.h > @@ -6,6 +6,14 @@ > .driver = "virtio-mmio",\ > .property = "format_transport_address",\ > .value = "off",\ > + },{\ > + .driver = "virtio-pci",\ > + .property = "disable-modern",\ > + .value = "on",\ > + },{\ > + .driver = "virtio-pci",\ > + .property = "disable-legacy",\ > + .value = "off",\ After looking at the code, I think this will work - did you test this with a compat machine, though? > }, > > #define HW_COMPAT_2_5 \ But generally, looks good and I think this is also an improvement in readability.