From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40748) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQKFh-0000Oq-A4 for qemu-devel@nongnu.org; Thu, 21 Jul 2016 16:07:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bQKFc-0006KW-Rv for qemu-devel@nongnu.org; Thu, 21 Jul 2016 16:07:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:13124) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQKFc-0006KJ-84 for qemu-devel@nongnu.org; Thu, 21 Jul 2016 16:07:20 -0400 References: <146912266605.14450.16219526000301775326.stgit@bahia.lan> From: Eric Blake Message-ID: <57912B6A.1050204@redhat.com> Date: Thu, 21 Jul 2016 14:07:06 -0600 MIME-Version: 1.0 In-Reply-To: <146912266605.14450.16219526000301775326.stgit@bahia.lan> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="GXXJRptFEQJk1crg0JdhDXVOuu7e7nPRo" Subject: Re: [Qemu-devel] [PATCH v3] virtio-pci: error out when both legacy and modern modes are disabled List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Greg Kurz , "Michael S. Tsirkin" Cc: Cornelia Huck , qemu-devel@nongnu.org, Marcel Apfelbaum This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --GXXJRptFEQJk1crg0JdhDXVOuu7e7nPRo From: Eric Blake To: Greg Kurz , "Michael S. Tsirkin" Cc: Cornelia Huck , qemu-devel@nongnu.org, Marcel Apfelbaum Message-ID: <57912B6A.1050204@redhat.com> Subject: Re: [Qemu-devel] [PATCH v3] virtio-pci: error out when both legacy and modern modes are disabled References: <146912266605.14450.16219526000301775326.stgit@bahia.lan> In-Reply-To: <146912266605.14450.16219526000301775326.stgit@bahia.lan> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 07/21/2016 11:43 AM, Greg Kurz wrote: > From: Greg Kurz >=20 > Without presuming if we got there because of a user mistake or some > more subtle bug in the tooling, it really does not make sense to > implement a non-functional device. >=20 > Signed-off-by: Greg Kurz > Signed-off-by: Greg Kurz > --- > v3: - rebased on top of: > https://lists.gnu.org/archive/html/qemu-devel/2016-07/msg04744.html= > - use virtio_pci_legacy/modern helpers > - rephrased error message to be shorter and use the on/off logic >=20 > Marcel, this still results in > 80 char line in the code but I'd rather= not > split it to ease grepping, nor shorten the message even more to keep it= > meaningful. > --- > hw/virtio/virtio-pci.c | 5 +++++ > 1 file changed, 5 insertions(+) >=20 > diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c > index 755f9218b77d..1f5f00a50a0b 100644 > --- a/hw/virtio/virtio-pci.c > +++ b/hw/virtio/virtio-pci.c > @@ -1842,6 +1842,11 @@ static void virtio_pci_dc_realize(DeviceState *q= dev, Error **errp) > VirtIOPCIProxy *proxy =3D VIRTIO_PCI(qdev); > PCIDevice *pci_dev =3D &proxy->pci_dev; > =20 > + if (!(virtio_pci_modern(proxy) || virtio_pci_legacy(proxy))) { > + error_setg(errp, "device cannot work when both disable-modern = and disable-legacy are set to on."); The phrase passed to error_setg() should not end in '.' You can also split the string literal, to keep the line length of the source under 80 (the long error message is less problematic). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --GXXJRptFEQJk1crg0JdhDXVOuu7e7nPRo Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXkStqAAoJEKeha0olJ0NqI/cH/2Z7jYjHPo4i8kB5T3SCzm2U 1A9/s+xUwOVPXHRM+Gxl8ngnL/mcOnl5sFHEVZr+pY0o+Ff+00yzm35LCJ3J90nR Ieq1ZpFo7BlUO7MPOtPb5cpsqrXiutho1SZi2yPeshtsxTWJpGVzPSKFkBJNMI19 Sqecx5Fe+mjBzF7Ni8cdcBadjFIK2WkMcK/dvDDfpjKccscv5D7wiixdTHiv68yF LskK08KlAd1Kq5oR/9/KLjoYp0nN9lb4KYQ3K6h1Ky2Wk897hoiS17G0QSMlghJE mH+sH8dv6kemOjggr0l7sm9WNnP3rYDqIbxGG1sZsThoJzDW+o03Okta4yvsoSw= =sdof -----END PGP SIGNATURE----- --GXXJRptFEQJk1crg0JdhDXVOuu7e7nPRo--