From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45090) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b68v3-0001Pq-LC for qemu-devel@nongnu.org; Thu, 26 May 2016 23:58:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b68uz-0004HZ-HJ for qemu-devel@nongnu.org; Thu, 26 May 2016 23:58:40 -0400 Date: Fri, 27 May 2016 13:58:28 +1000 From: David Gibson Message-ID: <20160527035828.GV17226@voom.fritz.box> References: <146424972400.5666.10324293617984893259.stgit@bahia.huguette.org> <146424974323.5666.5471538288045048119.stgit@bahia.huguette.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="eaV5P3cR6+S+P6qN" Content-Disposition: inline In-Reply-To: <146424974323.5666.5471538288045048119.stgit@bahia.huguette.org> Subject: Re: [Qemu-devel] [PATCH 3/3] KVM: use KVM_CAP_MAX_VCPU_ID List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Greg Kurz Cc: qemu-devel@nongnu.org, Paolo Bonzini , qemu-ppc@nongnu.org, Alexander Graf --eaV5P3cR6+S+P6qN Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, May 26, 2016 at 10:02:23AM +0200, Greg Kurz wrote: > As stated in linux/Documentation/virtual/kvm/api.txt: >=20 > The maximum possible value for max_vcpu_id can be retrieved using the > KVM_CAP_MAX_VCPU_ID of the KVM_CHECK_EXTENSION ioctl() at run-time. >=20 > If the KVM_CAP_MAX_VCPU_ID does not exist, you should assume that > max_vcpu_id is the same as the value returned from KVM_CAP_MAX_VCPUS. >=20 > Signed-off-by: Greg Kurz Reviewed-by: David Gibson > --- > kvm-all.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) >=20 > diff --git a/kvm-all.c b/kvm-all.c > index e56f38527815..e74e0c6e2352 100644 > --- a/kvm-all.c > +++ b/kvm-all.c > @@ -1459,10 +1459,16 @@ static int kvm_max_vcpus(KVMState *s) > return (ret) ? ret : kvm_recommended_vcpus(s); > } > =20 > +static int kvm_max_vcpu_id(KVMState *s) > +{ > + int ret =3D kvm_check_extension(s, KVM_CAP_MAX_VCPU_ID); > + return (ret) ? ret : kvm_max_vcpus(s); > +} > + > bool kvm_vcpu_id_is_valid(int vcpu_id) > { > KVMState *s =3D KVM_STATE(current_machine->accelerator); > - return vcpu_id >=3D 0 && vcpu_id < kvm_max_vcpus(s); > + return vcpu_id >=3D 0 && vcpu_id < kvm_max_vcpu_id(s); > } > =20 > static int kvm_init(MachineState *ms) >=20 --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --eaV5P3cR6+S+P6qN Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXR8XkAAoJEGw4ysog2bOSLOUQAIUTQSDFz3HhX9WiZcHWbPRZ j2iuMBKwNxizAIM+T9VhyFcqTLUfST5f9mMCFhN/BL+iF0RpjlSpatVxR9aBTFg1 TkIbdXLfVLjPQACYMoGToLqMz9kaz4ghEth9CcxS6J4NMUEylhwsuhMwSwUs009x NCqAa9aE+gEvV8+GrAJMv9VQoG/iwjbYPvCW5BS39XcMOXiOf8ufCjBmkPX8Houd gLm+RJyZ/ZSz1oGKDKoJpNlIjKpGiyjpDbc6mGVN66GRyBqL/oG/FkbB7glt7x6E YQY7MKghbWXMyA/C5ff3Mq8HEEu2kSC/pocPs49Rcd+0lVSqdzX1TvTEQBaHf0ko jGbRjfmQ6Brw+z4iwYpShRM6X/Ss7WmalMdcnMgwv1wz6B9l1J6QFeBobLSBWQV8 9xrxd2A3YtVnC3LrJiE+Nt/suxzn7HVHniUt4W1SV2ktBlfKpAJ8b4F5J70aTiJL xyMhBHlpu389lTwTZASIl92etC/kC2UW253K7J0jDOtpZpnoh5djnJLojSMHvaXi 19HmGCFuBZuulHU1RNVz6UAi33VgT66dWm2mTcfBmRUnUlSUILXRqicEXJi5W4qU 36Ly1nJ5bug2e8B3qMBZPhdJhxlVEyGugJyWLFquW469+sAgJPdUCDZ/o8eCejH8 pObiakhr8bnTxNCb3qdr =4d+n -----END PGP SIGNATURE----- --eaV5P3cR6+S+P6qN--