From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59299) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzSLb-0002Ti-Iu for qemu-devel@nongnu.org; Thu, 19 Nov 2015 11:46:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZzSLX-0000CJ-Fa for qemu-devel@nongnu.org; Thu, 19 Nov 2015 11:46:11 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44505) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzSLX-0000C9-7X for qemu-devel@nongnu.org; Thu, 19 Nov 2015 11:46:07 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id D3E2AC0BFBB2 for ; Thu, 19 Nov 2015 16:46:06 +0000 (UTC) References: <1447836791-369-1-git-send-email-eblake@redhat.com> <1447836791-369-25-git-send-email-eblake@redhat.com> <87r3jm3r4y.fsf@blackfin.pond.sub.org> From: Eric Blake Message-ID: <564DFCC8.5090504@redhat.com> Date: Thu, 19 Nov 2015 09:46:00 -0700 MIME-Version: 1.0 In-Reply-To: <87r3jm3r4y.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="doba7R1A36rLCnraKIupcENjCnAThcOHc" Subject: Re: [Qemu-devel] [PATCH v12 24/36] cpu: Convert CpuInfo into flat union List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Paolo Bonzini , qemu-devel@nongnu.org, Luiz Capitulino This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --doba7R1A36rLCnraKIupcENjCnAThcOHc Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/19/2015 09:12 AM, Markus Armbruster wrote: > Eric Blake writes: >=20 >> The CpuInfo struct is used only by the 'query-cpus' output >> command, so we are free to modify it by adding fields (clients >> are already supposed to ignore unknown output fields), or by >> changing optional members to mandatory, while still keeping >> QMP wire compatibility with older versions of qemu. >> >> +++ b/cpus.c >> @@ -1556,22 +1556,29 @@ CpuInfoList *qmp_query_cpus(Error **errp) >> info->value->qom_path =3D object_get_canonical_path(OBJECT(cp= u)); >> info->value->thread_id =3D cpu->thread_id; >> #if defined(TARGET_I386) >> - info->value->has_pc =3D true; >> - info->value->pc =3D env->eip + env->segs[R_CS].base; >> + info->value->arch =3D CPU_INFO_ARCH_X86; >> + info->value->u.x86 =3D g_new0(CpuInfoX86, 1); >> + info->value->u.x86->pc =3D env->eip + env->segs[R_CS].base; >> #elif defined(TARGET_PPC) >> - info->value->has_nip =3D true; >> - info->value->nip =3D env->nip; >> + info->value->arch =3D CPU_INFO_ARCH_PPC; >> + info->value->u.ppc =3D g_new0(CpuInfoPpc, 1); >> + info->value->u.ppc->nip =3D env->nip; >> #elif defined(TARGET_SPARC) >> - info->value->has_pc =3D true; >> - info->value->pc =3D env->pc; >> - info->value->has_npc =3D true; >> - info->value->npc =3D env->npc; >> + info->value->arch =3D CPU_INFO_ARCH_SPARC; >> + info->value->u.sparc =3D g_new0(CpuInfoSPARC, 1); >=20 > CpuInfoSparc. #ifdef compilation problems. Yes, we'll have to double-check that whatever case we use here matches our qapi. >> +++ b/qapi-schema.json >> @@ -744,43 +744,125 @@ >> { 'command': 'query-mice', 'returns': ['MouseInfo'] } >> >> ## >> -# @CpuInfo: >> +# @CpuInfoArch: >> # >> -# Information about a virtual CPU >> +# An enumeration of cpu types that enable additional information duri= ng >> +# @query-cpus. >> +# >> +# Since: 2.6 >> +## >> +{ 'enum': 'CpuInfoArch', >> + 'data': ['x86', 'sparc', 'ppc', 'mips', 'tricore', 'other' ] } >> + >> +## >> +# @CpuInfo: >> +# >> +# Information about a virtual CPU >> +# >> +# Since: 0.14.0 >> +## >> +{ 'union': 'CpuInfo', 'base': 'CpuInfoBase', 'discriminator': 'arch',= >> + 'data': { 'x86': 'CpuInfoX86', >> + 'sparc': 'CpuInfoSparc', >> + 'ppc': 'CpuInfoPpc', >> + 'mips': 'CpuInfoMips', >> + 'tricore': 'CpuInfoTricore', >> + 'other': 'CpuInfoOther' } } As to the qapi types, changing the case to CpuInfoSPARC, CpuInfoPPC, and CpuInfoMIPS all work for me. For MIPS, it definitely matches prevailing preference (here searching for any use of the arch name as part of a larger CamelCase name); for SPARC and PPC, we could sway the vote: $ git grep '[a-z]Sparc' origin | wc 39 262 2705 $ git grep '[a-z]SPARC' origin | wc 38 316 3385 $ git grep '[a-z]Ppc' origin | wc 1 4 48 $ git grep '[a-z]PPC' origin | wc 1 4 56 $ git grep '[a-z]Mips' origin | wc 0 0 0 $ git grep '[a-z]MIPS' origin | wc 69 407 5475 I'm assuming you plan on doing the touchup? --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --doba7R1A36rLCnraKIupcENjCnAThcOHc 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/ iQEcBAEBCAAGBQJWTfzIAAoJEKeha0olJ0NqrrIH/1PcbosND0cZsJXnHhVXKF9d yvxrSGAQ6y9+p5dJIKMXmUuernPXCxZCOuYCu5ju8t0ilc75as4j6wsiAnjQSYFF AlHa85On+L4qPQ84I2RnvnxzsCBh7GFMmlkqD4jjblDRIHK1lV8t1XRINPjV8Bz1 3Zn4SZO35jW6UOJMU96xeHkx1cAZcAbcbsVCxa9hCXC/X9mjkyNHcgF7n4bzo/nf Jmpro9qE4vDsoa/6IxoUBChVb5wM0eFWzqchSiQrMQYcSKpLx5N2tmPFUuvppod0 t3+4n00EbtD3BMm4sCTwJgBlh3v25gVdOZfJ0fkH6x2ij0jjmy67JRRLfXHlCxc= =IHit -----END PGP SIGNATURE----- --doba7R1A36rLCnraKIupcENjCnAThcOHc--