From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:43964) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ru8pH-0002UP-S2 for qemu-devel@nongnu.org; Sun, 05 Feb 2012 15:36:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ru8pG-0000FR-DM for qemu-devel@nongnu.org; Sun, 05 Feb 2012 15:36:43 -0500 Received: from fmmailgate02.web.de ([217.72.192.227]:47511) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ru8pF-0000FN-Rl for qemu-devel@nongnu.org; Sun, 05 Feb 2012 15:36:42 -0500 Received: from moweb001.kundenserver.de (moweb001.kundenserver.de [172.19.20.114]) by fmmailgate02.web.de (Postfix) with ESMTP id 395011C0A7854 for ; Sun, 5 Feb 2012 21:36:40 +0100 (CET) Message-ID: <4F2EE84C.80304@web.de> Date: Sun, 05 Feb 2012 21:36:28 +0100 From: Jan Kiszka MIME-Version: 1.0 References: <6776cc5c00f4d06d23c11b68d18fd96e27f71718.1328438750.git.jan.kiszka@web.de> <87d39tjbdm.fsf@elfo.elfo> In-Reply-To: <87d39tjbdm.fsf@elfo.elfo> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig099B7C552A63E7E5D87DDCED" Subject: Re: [Qemu-devel] [PATCH 3/4] kvm: Add kvm_has_pit_state2 helper List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: quintela@redhat.com Cc: Anthony Liguori , Marcelo Tosatti , Avi Kivity , kvm@vger.kernel.org, qemu-devel This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig099B7C552A63E7E5D87DDCED Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable On 2012-02-05 21:03, Juan Quintela wrote: > Jan Kiszka wrote: >> From: Jan Kiszka >> >> To be used for in-kernel PIT emulation. >=20 > .... >=20 >> + int pit_state2; >=20 > This is used as a bool. >=20 >> int xsave, xcrs; >> int many_ioeventfds; >> int irqchip_inject_ioctl; >> @@ -954,6 +955,10 @@ int kvm_init(void) >> s->xcrs =3D kvm_check_extension(s, KVM_CAP_XCRS); >> #endif >> =20 >> +#ifdef KVM_CAP_PIT_STATE2 >> + s->pit_state2 =3D kvm_check_extension(s, KVM_CAP_PIT_STATE2); >> +#endif >> + >=20 > [ this happened to me when I was reviewing this patch, but culprit is > not this patch] >=20 > really kvm_check_extension() should also return a bool, but that is a > bigger change that this patch series tend to introduce. >=20 > So, I went to "man ioctl" >=20 >> RETURN VALUE >> Usually, on success zero is returned. A few ioctl() requests = use the >> return value as an output parameter and return a nonnegative = value on >> success. On error, -1 is returned, and errno is set appropriate= ly. >=20 > Usually is the important word there. Right, because the driver decides in the end what is returned. In case of KVM_CHECK_EXTENSION, it is > 0 for supported. Sometimes it returns an integer value that encode "how much" is supported, e.g. KVM_CAP_IRQ_ROUTING provides the number of supported GSI routes. That said, all those boolean caps could indeed be encoded as such. Some smarter way to initialize and retrieve them would also be nice. Too much boilerplate code. Thanks for bending your brain around this :) Jan --------------enig099B7C552A63E7E5D87DDCED 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.0.16 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk8u6FMACgkQitSsb3rl5xQkHwCgwnsMye/5HqzdW1yN2djjQEGV XTEAnRY+Uxnrg34OjuePypzPDh02JeT3 =AUZb -----END PGP SIGNATURE----- --------------enig099B7C552A63E7E5D87DDCED--