From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38104) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzScu-0004UZ-73 for qemu-devel@nongnu.org; Thu, 19 Nov 2015 12:04:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZzScs-0006pi-Va for qemu-devel@nongnu.org; Thu, 19 Nov 2015 12:04:04 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35908) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzScs-0006pb-NT for qemu-devel@nongnu.org; Thu, 19 Nov 2015 12:04:02 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 264E83B3C7 for ; Thu, 19 Nov 2015 17:04:02 +0000 (UTC) From: Markus Armbruster 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> <564DFCC8.5090504@redhat.com> Date: Thu, 19 Nov 2015 18:03:59 +0100 In-Reply-To: <564DFCC8.5090504@redhat.com> (Eric Blake's message of "Thu, 19 Nov 2015 09:46:00 -0700") Message-ID: <87si412a68.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain 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: Eric Blake Cc: Paolo Bonzini , qemu-devel@nongnu.org, Luiz Capitulino Eric Blake writes: > On 11/19/2015 09:12 AM, Markus Armbruster wrote: >> Eric Blake writes: >> >>> 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 = object_get_canonical_path(OBJECT(cpu)); >>> info->value->thread_id = cpu->thread_id; >>> #if defined(TARGET_I386) >>> - info->value->has_pc = true; >>> - info->value->pc = env->eip + env->segs[R_CS].base; >>> + info->value->arch = CPU_INFO_ARCH_X86; >>> + info->value->u.x86 = g_new0(CpuInfoX86, 1); >>> + info->value->u.x86->pc = env->eip + env->segs[R_CS].base; >>> #elif defined(TARGET_PPC) >>> - info->value->has_nip = true; >>> - info->value->nip = env->nip; >>> + info->value->arch = CPU_INFO_ARCH_PPC; >>> + info->value->u.ppc = g_new0(CpuInfoPpc, 1); >>> + info->value->u.ppc->nip = env->nip; >>> #elif defined(TARGET_SPARC) >>> - info->value->has_pc = true; >>> - info->value->pc = env->pc; >>> - info->value->has_npc = true; >>> - info->value->npc = env->npc; >>> + info->value->arch = CPU_INFO_ARCH_SPARC; >>> + info->value->u.sparc = g_new0(CpuInfoSPARC, 1); >> >> 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 during >>> +# @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 Wikipedia and USPTO spell it SPARC, MIPS and PowerPC. PPC is a common abbreviation of the latter. I find CpuInfoPpc even uglier than CpuInfoPPC. > I'm assuming you plan on doing the touchup? Yes, fixup is being compiled.