[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH 57/99] qapi: fill in CpuInfoFast.arch in query-cpus
From: |
Michael Roth |
Subject: |
[Qemu-stable] [PATCH 57/99] qapi: fill in CpuInfoFast.arch in query-cpus-fast |
Date: |
Mon, 23 Jul 2018 15:17:06 -0500 |
From: Laszlo Ersek <address@hidden>
* Commit ca230ff33f89 added the @arch field to @CpuInfoFast, but it failed
to set the new field in qmp_query_cpus_fast(), when TARGET_S390X was not
defined. The updated @query-cpus-fast example in "qapi-schema.json"
showed "arch":"x86" only because qmp_query_cpus_fast() calls g_malloc0()
to allocate @CpuInfoFast, and the CPU_INFO_ARCH_X86 enum constant is
generated with value 0.
All @arch values other than @s390 implied the @CpuInfoOther sub-struct
for @CpuInfoFast -- at the time of writing the patch --, thus no fields
other than @arch needed to be set when TARGET_S390X was not defined. Set
@arch now, by copying the corresponding assignments from
qmp_query_cpus().
* Commit 25fa194b7b11 added the @riscv enum constant to @CpuInfoArch (used
in both @CpuInfo and @CpuInfoFast -- the return types of the @query-cpus
and @query-cpus-fast commands, respectively), and assigned, in both
return structures, the @CpuInfoRISCV sub-structure to the new enum
value.
However, qmp_query_cpus_fast() would not populate either the @arch field
or the @CpuInfoRISCV sub-structure, when TARGET_RISCV was defined; only
qmp_query_cpus() would.
Assign @CpuInfoOther to the @riscv enum constant in @CpuInfoFast, and
populate only the @arch field in qmp_query_cpus_fast(). Getting CPU
state without interrupting KVM is an exceptional thing that only S390X
does currently. Quoting Cornelia Huck <address@hidden>, "s390x is
exceptional in that it has state in QEMU that is actually interesting
for upper layers and can be retrieved without performance penalty". See
also
<https://www.redhat.com/archives/libvir-list/2018-February/msg00121.html>.
Cc: Cornelia Huck <address@hidden>
Cc: Eric Blake <address@hidden>
Cc: Markus Armbruster <address@hidden>
Cc: Viktor VM Mihajlovski <address@hidden>
Cc: address@hidden
Fixes: ca230ff33f89bf7102cbfbc2328716da6750aaed
Fixes: 25fa194b7b11901561532e435beb83d046899f7a
Signed-off-by: Laszlo Ersek <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Cornelia Huck <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
(cherry picked from commit 96054f56396eaa0b9b5c681fc3e42a0004b17ade)
Signed-off-by: Michael Roth <address@hidden>
---
cpus.c | 16 +++++++++++++++-
qapi/misc.json | 2 +-
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/cpus.c b/cpus.c
index e1d94038fd..6fa701e423 100644
--- a/cpus.c
+++ b/cpus.c
@@ -2218,11 +2218,25 @@ CpuInfoFastList *qmp_query_cpus_fast(Error **errp)
info->value->props = props;
}
-#if defined(TARGET_S390X)
+#if defined(TARGET_I386)
+ info->value->arch = CPU_INFO_ARCH_X86;
+#elif defined(TARGET_PPC)
+ info->value->arch = CPU_INFO_ARCH_PPC;
+#elif defined(TARGET_SPARC)
+ info->value->arch = CPU_INFO_ARCH_SPARC;
+#elif defined(TARGET_MIPS)
+ info->value->arch = CPU_INFO_ARCH_MIPS;
+#elif defined(TARGET_TRICORE)
+ info->value->arch = CPU_INFO_ARCH_TRICORE;
+#elif defined(TARGET_S390X)
s390_cpu = S390_CPU(cpu);
env = &s390_cpu->env;
info->value->arch = CPU_INFO_ARCH_S390;
info->value->u.s390.cpu_state = env->cpu_state;
+#elif defined(TARGET_RISCV)
+ info->value->arch = CPU_INFO_ARCH_RISCV;
+#else
+ info->value->arch = CPU_INFO_ARCH_OTHER;
#endif
if (!cur_item) {
head = cur_item = info;
diff --git a/qapi/misc.json b/qapi/misc.json
index 5636f4a149..104d013adb 100644
--- a/qapi/misc.json
+++ b/qapi/misc.json
@@ -573,7 +573,7 @@
'mips': 'CpuInfoOther',
'tricore': 'CpuInfoOther',
's390': 'CpuInfoS390',
- 'riscv': 'CpuInfoRISCV',
+ 'riscv': 'CpuInfoOther',
'other': 'CpuInfoOther' } }
##
--
2.17.1
- [Qemu-stable] [PATCH 49/99] arm_gicv3_kvm: kvm_dist_get/put_priority: skip the registers banked by GICR_IPRIORITYR, (continued)
- [Qemu-stable] [PATCH 49/99] arm_gicv3_kvm: kvm_dist_get/put_priority: skip the registers banked by GICR_IPRIORITYR, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 48/99] iotests: Add test 221 to catch qemu-img map regression, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 50/99] usb: correctly handle Zero Length Packets, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 04/99] nbd/client: Fix error messages during NBD_INFO_BLOCK_SIZE, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 51/99] usb/dev-mtp: Fix use of uninitialized values, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 52/99] vnc: fix use-after-free, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 55/99] nbd/client: fix nbd_negotiate_simple_meta_context, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 54/99] cpus: tcg: fix never exiting loop on unplug, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 53/99] block/mirror: honor ratelimit again, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 56/99] migration/block-dirty-bitmap: fix memory leak in dirty_bitmap_load_bits, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 57/99] qapi: fill in CpuInfoFast.arch in query-cpus-fast,
Michael Roth <=
- [Qemu-stable] [PATCH 58/99] block/mirror: Make cancel always cancel pre-READY, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 60/99] riscv: spike: allow base == 0, Michael Roth, 2018/07/23
- [Qemu-stable] [PATCH 05/99] s390-ccw: force diag 308 subcode to unsigned long, Michael Roth, 2018/07/23
[Qemu-stable] [PATCH 59/99] iotests: Add test for cancelling a mirror job, Michael Roth, 2018/07/23
[Qemu-stable] [PATCH 61/99] riscv: htif: increase the priority of the htif subregion, Michael Roth, 2018/07/23
[Qemu-stable] [PATCH 62/99] riscv: requires libfdt, Michael Roth, 2018/07/23