On 11/19/2015 09:12 AM, Markus Armbruster wrote:
> Eric Blake <ebl...@redhat.com> 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

I'm assuming you plan on doing the touchup?

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to