From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH 3/4] kvm: Add kvm_has_pit_state2 helper Date: Sun, 05 Feb 2012 21:36:28 +0100 Message-ID: <4F2EE84C.80304@web.de> References: <6776cc5c00f4d06d23c11b68d18fd96e27f71718.1328438750.git.jan.kiszka@web.de> <87d39tjbdm.fsf@elfo.elfo> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig099B7C552A63E7E5D87DDCED" Cc: Anthony Liguori , Marcelo Tosatti , Avi Kivity , kvm@vger.kernel.org, qemu-devel To: quintela@redhat.com Return-path: In-Reply-To: <87d39tjbdm.fsf@elfo.elfo> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org Sender: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org List-Id: kvm.vger.kernel.org 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--