|
|
383d26 |
From 06441913a6b0832d545bb40b1c4969cca99059a7 Mon Sep 17 00:00:00 2001
|
|
|
383d26 |
From: Laszlo Ersek <lersek@redhat.com>
|
|
|
383d26 |
Date: Tue, 13 Nov 2018 18:16:34 +0100
|
|
|
383d26 |
Subject: [PATCH 15/22] qapi: fill in CpuInfoFast.arch in query-cpus-fast
|
|
|
383d26 |
MIME-Version: 1.0
|
|
|
383d26 |
Content-Type: text/plain; charset=UTF-8
|
|
|
383d26 |
Content-Transfer-Encoding: 8bit
|
|
|
383d26 |
|
|
|
383d26 |
RH-Author: Laszlo Ersek <lersek@redhat.com>
|
|
|
383d26 |
Message-id: <20181113181639.4999-2-lersek@redhat.com>
|
|
|
383d26 |
Patchwork-id: 83003
|
|
|
383d26 |
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 1/6] qapi: fill in CpuInfoFast.arch in query-cpus-fast
|
|
|
383d26 |
Bugzilla: 1607406
|
|
|
383d26 |
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
|
|
383d26 |
RH-Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
383d26 |
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
|
|
|
383d26 |
|
|
|
383d26 |
* Commit ca230ff33f89 added the @arch field to @CpuInfoFast, but it failed
|
|
|
383d26 |
to set the new field in qmp_query_cpus_fast(), when TARGET_S390X was not
|
|
|
383d26 |
defined. The updated @query-cpus-fast example in "qapi-schema.json"
|
|
|
383d26 |
showed "arch":"x86" only because qmp_query_cpus_fast() calls g_malloc0()
|
|
|
383d26 |
to allocate @CpuInfoFast, and the CPU_INFO_ARCH_X86 enum constant is
|
|
|
383d26 |
generated with value 0.
|
|
|
383d26 |
|
|
|
383d26 |
All @arch values other than @s390 implied the @CpuInfoOther sub-struct
|
|
|
383d26 |
for @CpuInfoFast -- at the time of writing the patch --, thus no fields
|
|
|
383d26 |
other than @arch needed to be set when TARGET_S390X was not defined. Set
|
|
|
383d26 |
@arch now, by copying the corresponding assignments from
|
|
|
383d26 |
qmp_query_cpus().
|
|
|
383d26 |
|
|
|
383d26 |
* Commit 25fa194b7b11 added the @riscv enum constant to @CpuInfoArch (used
|
|
|
383d26 |
in both @CpuInfo and @CpuInfoFast -- the return types of the @query-cpus
|
|
|
383d26 |
and @query-cpus-fast commands, respectively), and assigned, in both
|
|
|
383d26 |
return structures, the @CpuInfoRISCV sub-structure to the new enum
|
|
|
383d26 |
value.
|
|
|
383d26 |
|
|
|
383d26 |
However, qmp_query_cpus_fast() would not populate either the @arch field
|
|
|
383d26 |
or the @CpuInfoRISCV sub-structure, when TARGET_RISCV was defined; only
|
|
|
383d26 |
qmp_query_cpus() would.
|
|
|
383d26 |
|
|
|
383d26 |
Assign @CpuInfoOther to the @riscv enum constant in @CpuInfoFast, and
|
|
|
383d26 |
populate only the @arch field in qmp_query_cpus_fast(). Getting CPU
|
|
|
383d26 |
state without interrupting KVM is an exceptional thing that only S390X
|
|
|
383d26 |
does currently. Quoting Cornelia Huck <cohuck@redhat.com>, "s390x is
|
|
|
383d26 |
exceptional in that it has state in QEMU that is actually interesting
|
|
|
383d26 |
for upper layers and can be retrieved without performance penalty". See
|
|
|
383d26 |
also
|
|
|
383d26 |
<https://www.redhat.com/archives/libvir-list/2018-February/msg00121.html>.
|
|
|
383d26 |
|
|
|
383d26 |
Cc: Cornelia Huck <cohuck@redhat.com>
|
|
|
383d26 |
Cc: Eric Blake <eblake@redhat.com>
|
|
|
383d26 |
Cc: Markus Armbruster <armbru@redhat.com>
|
|
|
383d26 |
Cc: Viktor VM Mihajlovski <mihajlov@linux.vnet.ibm.com>
|
|
|
383d26 |
Cc: qemu-stable@nongnu.org
|
|
|
383d26 |
Fixes: ca230ff33f89bf7102cbfbc2328716da6750aaed
|
|
|
383d26 |
Fixes: 25fa194b7b11901561532e435beb83d046899f7a
|
|
|
383d26 |
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
383d26 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
383d26 |
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
383d26 |
Reviewed-by: Markus Armbruster <armbru@redhat.com>
|
|
|
383d26 |
Message-Id: <20180427192852.15013-2-lersek@redhat.com>
|
|
|
383d26 |
Signed-off-by: Markus Armbruster <armbru@redhat.com>
|
|
|
383d26 |
(cherry picked from commit 96054f56396eaa0b9b5c681fc3e42a0004b17ade)
|
|
|
383d26 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
383d26 |
---
|
|
|
383d26 |
cpus.c | 16 +++++++++++++++-
|
|
|
383d26 |
qapi/misc.json | 2 +-
|
|
|
383d26 |
2 files changed, 16 insertions(+), 2 deletions(-)
|
|
|
383d26 |
|
|
|
383d26 |
diff --git a/cpus.c b/cpus.c
|
|
|
383d26 |
index 398392b..4f83f16 100644
|
|
|
383d26 |
--- a/cpus.c
|
|
|
383d26 |
+++ b/cpus.c
|
|
|
383d26 |
@@ -2218,11 +2218,25 @@ CpuInfoFastList *qmp_query_cpus_fast(Error **errp)
|
|
|
383d26 |
info->value->props = props;
|
|
|
383d26 |
}
|
|
|
383d26 |
|
|
|
383d26 |
-#if defined(TARGET_S390X)
|
|
|
383d26 |
+#if defined(TARGET_I386)
|
|
|
383d26 |
+ info->value->arch = CPU_INFO_ARCH_X86;
|
|
|
383d26 |
+#elif defined(TARGET_PPC)
|
|
|
383d26 |
+ info->value->arch = CPU_INFO_ARCH_PPC;
|
|
|
383d26 |
+#elif defined(TARGET_SPARC)
|
|
|
383d26 |
+ info->value->arch = CPU_INFO_ARCH_SPARC;
|
|
|
383d26 |
+#elif defined(TARGET_MIPS)
|
|
|
383d26 |
+ info->value->arch = CPU_INFO_ARCH_MIPS;
|
|
|
383d26 |
+#elif defined(TARGET_TRICORE)
|
|
|
383d26 |
+ info->value->arch = CPU_INFO_ARCH_TRICORE;
|
|
|
383d26 |
+#elif defined(TARGET_S390X)
|
|
|
383d26 |
s390_cpu = S390_CPU(cpu);
|
|
|
383d26 |
env = &s390_cpu->env;
|
|
|
383d26 |
info->value->arch = CPU_INFO_ARCH_S390;
|
|
|
383d26 |
info->value->u.s390.cpu_state = env->cpu_state;
|
|
|
383d26 |
+#elif defined(TARGET_RISCV)
|
|
|
383d26 |
+ info->value->arch = CPU_INFO_ARCH_RISCV;
|
|
|
383d26 |
+#else
|
|
|
383d26 |
+ info->value->arch = CPU_INFO_ARCH_OTHER;
|
|
|
383d26 |
#endif
|
|
|
383d26 |
if (!cur_item) {
|
|
|
383d26 |
head = cur_item = info;
|
|
|
383d26 |
diff --git a/qapi/misc.json b/qapi/misc.json
|
|
|
383d26 |
index 045eb7c..8b28270 100644
|
|
|
383d26 |
--- a/qapi/misc.json
|
|
|
383d26 |
+++ b/qapi/misc.json
|
|
|
383d26 |
@@ -573,7 +573,7 @@
|
|
|
383d26 |
'mips': 'CpuInfoOther',
|
|
|
383d26 |
'tricore': 'CpuInfoOther',
|
|
|
383d26 |
's390': 'CpuInfoS390',
|
|
|
383d26 |
- 'riscv': 'CpuInfoRISCV',
|
|
|
383d26 |
+ 'riscv': 'CpuInfoOther',
|
|
|
383d26 |
'other': 'CpuInfoOther' } }
|
|
|
383d26 |
|
|
|
383d26 |
##
|
|
|
383d26 |
--
|
|
|
383d26 |
1.8.3.1
|
|
|
383d26 |
|