[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v12 24/36] cpu: Convert CpuInfo into flat union
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH v12 24/36] cpu: Convert CpuInfo into flat union |
Date: |
Thu, 19 Nov 2015 18:03:59 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Eric Blake <address@hidden> writes:
> On 11/19/2015 09:12 AM, Markus Armbruster wrote:
>> Eric Blake <address@hidden> 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.
[Qemu-devel] [PATCH v12 20/36] blkdebug: Avoid '.' in enum values, Eric Blake, 2015/11/18
[Qemu-devel] [PATCH v12 28/36] qapi: Simplify QObject, Eric Blake, 2015/11/18
[Qemu-devel] [PATCH v12 27/36] qapi: Forbid case-insensitive clashes, Eric Blake, 2015/11/18