From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44879) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fBmmK-0003xC-IS for qemu-devel@nongnu.org; Thu, 26 Apr 2018 15:42:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fBmmH-0002ii-FJ for qemu-devel@nongnu.org; Thu, 26 Apr 2018 15:42:04 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:44096 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fBmmG-0002iI-VL for qemu-devel@nongnu.org; Thu, 26 Apr 2018 15:42:01 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DCF8B81A88D5 for ; Thu, 26 Apr 2018 19:41:59 +0000 (UTC) References: <20180426183404.3756-1-lersek@redhat.com> <20180426183404.3756-5-lersek@redhat.com> From: Eric Blake Message-ID: <16b5979b-3db1-73fe-fb9b-d73b08b11177@redhat.com> Date: Thu, 26 Apr 2018 14:41:56 -0500 MIME-Version: 1.0 In-Reply-To: <20180426183404.3756-5-lersek@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="eebF8dKM1VRx2sTzGYxlbjTbWdufZyXHD" Subject: Re: [Qemu-devel] [PATCH v2 4/4] qapi: discriminate CpuInfoFast on SysEmuTarget, not CpuInfoArch List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laszlo Ersek , qemu devel list Cc: "Daniel P. Berrange" , Markus Armbruster This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --eebF8dKM1VRx2sTzGYxlbjTbWdufZyXHD From: Eric Blake To: Laszlo Ersek , qemu devel list Cc: "Daniel P. Berrange" , Markus Armbruster Message-ID: <16b5979b-3db1-73fe-fb9b-d73b08b11177@redhat.com> Subject: Re: [PATCH v2 4/4] qapi: discriminate CpuInfoFast on SysEmuTarget, not CpuInfoArch References: <20180426183404.3756-1-lersek@redhat.com> <20180426183404.3756-5-lersek@redhat.com> In-Reply-To: <20180426183404.3756-5-lersek@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 04/26/2018 01:34 PM, Laszlo Ersek wrote: > Add a new field @target (of type @SysEmuTarget) to the output of the > @query-cpus-fast command, which provides more information about the > emulation target than the field @arch (of type @CpuInfoArch). Make @tar= get > the new discriminator for the @CpuInfoFast return structure. Keep @arch= > for compatibility. >=20 > Cc: "Daniel P. Berrange" > Cc: Eric Blake > Cc: Markus Armbruster > Signed-off-by: Laszlo Ersek > --- >=20 > +static CpuInfoArch sysemu_target_to_cpuinfo_arch(SysEmuTarget target) > +{ > + /* > + * The @SysEmuTarget -> @CpuInfoArch mapping below is based on the= > + * TARGET_ARCH -> TARGET_BASE_ARCH mapping in the "configure" scri= pt. > + */ > + switch (target) { > + case SYS_EMU_TARGET_I386: > + case SYS_EMU_TARGET_X86_64: > + return CPU_INFO_ARCH_X86; Thankfully, the addition of new targets is infrequent, so hopefully not too hard to keep this mapping up-to-date. I also like that this approach is introspectible via 'query-qmp-schema' - if 'query-cpus-fast' has the "target" member, then you know that it is fixed (you can ignore "arch" in that case, even though you know it works); if it lacks "target", you know that "arch":"s390x" is the only real string to look for and that all other systems report "x86" whether or not that was accurate. Reviewed-by: Eric Blake --=20 Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org --eebF8dKM1VRx2sTzGYxlbjTbWdufZyXHD Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEzBAEBCAAdFiEEccLMIrHEYCkn0vOqp6FrSiUnQ2oFAlriK4QACgkQp6FrSiUn Q2pTzgf/RZaaGLG1jviOEMNedo/cTK71QEKGikPZ0ivdYhlxPTihQy2N8YNVBmO3 G/ufytzxE/U4m2MyKdc3GkSCNZok0ngYyGGXyQho1xcAlhNNr4eKYABujK2Zp5MC 9oIozoChXbEyOxAYPfE/eJgvMdUl/+Dn4IwZzZZXxDFSWMiyPMklScNi3wSnAszg 4svQbrsQgdN19gAtJgZbPR4KoqTsXFAlpd1MlWU2U/XJchf2x4dSem6HEwtmb04i WkYrymR4oe+nyUUIubuia6TCdTsp17uIGE0MozS+hYKS6HeI2nLUn+bWqVYzjzmL HjmYtuKLpwOnpN5yACNuLJY7CDzn7w== =fCGG -----END PGP SIGNATURE----- --eebF8dKM1VRx2sTzGYxlbjTbWdufZyXHD--