[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 4/4] qapi: discriminate CpuInfoFast on SysEmu
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v2 4/4] qapi: discriminate CpuInfoFast on SysEmuTarget, not CpuInfoArch |
Date: |
Thu, 26 Apr 2018 14:41:56 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 |
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 @target
> the new discriminator for the @CpuInfoFast return structure. Keep @arch
> for compatibility.
>
> Cc: "Daniel P. Berrange" <address@hidden>
> Cc: Eric Blake <address@hidden>
> Cc: Markus Armbruster <address@hidden>
> Signed-off-by: Laszlo Ersek <address@hidden>
> ---
>
> +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" script.
> + */
> + 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 <address@hidden>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature