|
|
4ec855 |
From 9000286ea20abb4e03c76ab8f873a6e9eb708377 Mon Sep 17 00:00:00 2001
|
|
|
4ec855 |
From: Maxim Levitsky <mlevitsk@redhat.com>
|
|
|
4ec855 |
Date: Thu, 14 Nov 2019 08:20:41 +0000
|
|
|
4ec855 |
Subject: [PATCH 1/8] qapi: fill in CpuInfoFast.arch in query-cpus-fast
|
|
|
4ec855 |
|
|
|
4ec855 |
RH-Author: Maxim Levitsky <mlevitsk@redhat.com>
|
|
|
4ec855 |
Message-id: <20191114082041.20840-2-mlevitsk@redhat.com>
|
|
|
4ec855 |
Patchwork-id: 92245
|
|
|
4ec855 |
O-Subject: [RHEL-8.2.0 qemu-kvm PATCH v2 1/1] qapi: fill in CpuInfoFast.arch in query-cpus-fast
|
|
|
4ec855 |
Bugzilla: 1730969
|
|
|
4ec855 |
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
4ec855 |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
4ec855 |
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
|
|
|
4ec855 |
|
|
|
4ec855 |
From: Laszlo Ersek <lersek@redhat.com>
|
|
|
4ec855 |
|
|
|
4ec855 |
* Commit ca230ff33f89 added the @arch field to @CpuInfoFast, but it failed
|
|
|
4ec855 |
to set the new field in qmp_query_cpus_fast(), when TARGET_S390X was not
|
|
|
4ec855 |
defined. The updated @query-cpus-fast example in "qapi-schema.json"
|
|
|
4ec855 |
showed "arch":"x86" only because qmp_query_cpus_fast() calls g_malloc0()
|
|
|
4ec855 |
to allocate @CpuInfoFast, and the CPU_INFO_ARCH_X86 enum constant is
|
|
|
4ec855 |
generated with value 0.
|
|
|
4ec855 |
|
|
|
4ec855 |
All @arch values other than @s390 implied the @CpuInfoOther sub-struct
|
|
|
4ec855 |
for @CpuInfoFast -- at the time of writing the patch --, thus no fields
|
|
|
4ec855 |
other than @arch needed to be set when TARGET_S390X was not defined. Set
|
|
|
4ec855 |
@arch now, by copying the corresponding assignments from
|
|
|
4ec855 |
qmp_query_cpus().
|
|
|
4ec855 |
|
|
|
4ec855 |
* Commit 25fa194b7b11 added the @riscv enum constant to @CpuInfoArch (used
|
|
|
4ec855 |
in both @CpuInfo and @CpuInfoFast -- the return types of the @query-cpus
|
|
|
4ec855 |
and @query-cpus-fast commands, respectively), and assigned, in both
|
|
|
4ec855 |
return structures, the @CpuInfoRISCV sub-structure to the new enum
|
|
|
4ec855 |
value.
|
|
|
4ec855 |
|
|
|
4ec855 |
However, qmp_query_cpus_fast() would not populate either the @arch field
|
|
|
4ec855 |
or the @CpuInfoRISCV sub-structure, when TARGET_RISCV was defined; only
|
|
|
4ec855 |
qmp_query_cpus() would.
|
|
|
4ec855 |
|
|
|
4ec855 |
Assign @CpuInfoOther to the @riscv enum constant in @CpuInfoFast, and
|
|
|
4ec855 |
populate only the @arch field in qmp_query_cpus_fast(). Getting CPU
|
|
|
4ec855 |
state without interrupting KVM is an exceptional thing that only S390X
|
|
|
4ec855 |
does currently. Quoting Cornelia Huck <cohuck@redhat.com>, "s390x is
|
|
|
4ec855 |
exceptional in that it has state in QEMU that is actually interesting
|
|
|
4ec855 |
for upper layers and can be retrieved without performance penalty". See
|
|
|
4ec855 |
also
|
|
|
4ec855 |
<https://www.redhat.com/archives/libvir-list/2018-February/msg00121.html>.
|
|
|
4ec855 |
|
|
|
4ec855 |
Cc: Cornelia Huck <cohuck@redhat.com>
|
|
|
4ec855 |
Cc: Eric Blake <eblake@redhat.com>
|
|
|
4ec855 |
Cc: Markus Armbruster <armbru@redhat.com>
|
|
|
4ec855 |
Cc: Viktor VM Mihajlovski <mihajlov@linux.vnet.ibm.com>
|
|
|
4ec855 |
Cc: qemu-stable@nongnu.org
|
|
|
4ec855 |
Fixes: ca230ff33f89bf7102cbfbc2328716da6750aaed
|
|
|
4ec855 |
Fixes: 25fa194b7b11901561532e435beb83d046899f7a
|
|
|
4ec855 |
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
4ec855 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
4ec855 |
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
4ec855 |
Reviewed-by: Markus Armbruster <armbru@redhat.com>
|
|
|
4ec855 |
Message-Id: <20180427192852.15013-2-lersek@redhat.com>
|
|
|
4ec855 |
Signed-off-by: Markus Armbruster <armbru@redhat.com>
|
|
|
4ec855 |
(cherry picked from commit 96054f56396eaa0b9b5c681fc3e42a0004b17ade)
|
|
|
4ec855 |
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
|
|
|
4ec855 |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
4ec855 |
---
|
|
|
4ec855 |
cpus.c | 16 +++++++++++++++-
|
|
|
4ec855 |
qapi/misc.json | 2 +-
|
|
|
4ec855 |
2 files changed, 16 insertions(+), 2 deletions(-)
|
|
|
4ec855 |
|
|
|
4ec855 |
diff --git a/cpus.c b/cpus.c
|
|
|
4ec855 |
index 6100089..cea42f9 100644
|
|
|
4ec855 |
--- a/cpus.c
|
|
|
4ec855 |
+++ b/cpus.c
|
|
|
4ec855 |
@@ -2218,11 +2218,25 @@ CpuInfoFastList *qmp_query_cpus_fast(Error **errp)
|
|
|
4ec855 |
info->value->props = props;
|
|
|
4ec855 |
}
|
|
|
4ec855 |
|
|
|
4ec855 |
-#if defined(TARGET_S390X)
|
|
|
4ec855 |
+#if defined(TARGET_I386)
|
|
|
4ec855 |
+ info->value->arch = CPU_INFO_ARCH_X86;
|
|
|
4ec855 |
+#elif defined(TARGET_PPC)
|
|
|
4ec855 |
+ info->value->arch = CPU_INFO_ARCH_PPC;
|
|
|
4ec855 |
+#elif defined(TARGET_SPARC)
|
|
|
4ec855 |
+ info->value->arch = CPU_INFO_ARCH_SPARC;
|
|
|
4ec855 |
+#elif defined(TARGET_MIPS)
|
|
|
4ec855 |
+ info->value->arch = CPU_INFO_ARCH_MIPS;
|
|
|
4ec855 |
+#elif defined(TARGET_TRICORE)
|
|
|
4ec855 |
+ info->value->arch = CPU_INFO_ARCH_TRICORE;
|
|
|
4ec855 |
+#elif defined(TARGET_S390X)
|
|
|
4ec855 |
s390_cpu = S390_CPU(cpu);
|
|
|
4ec855 |
env = &s390_cpu->env;
|
|
|
4ec855 |
info->value->arch = CPU_INFO_ARCH_S390;
|
|
|
4ec855 |
info->value->u.s390.cpu_state = env->cpu_state;
|
|
|
4ec855 |
+#elif defined(TARGET_RISCV)
|
|
|
4ec855 |
+ info->value->arch = CPU_INFO_ARCH_RISCV;
|
|
|
4ec855 |
+#else
|
|
|
4ec855 |
+ info->value->arch = CPU_INFO_ARCH_OTHER;
|
|
|
4ec855 |
#endif
|
|
|
4ec855 |
if (!cur_item) {
|
|
|
4ec855 |
head = cur_item = info;
|
|
|
4ec855 |
diff --git a/qapi/misc.json b/qapi/misc.json
|
|
|
4ec855 |
index 5636f4a..104d013 100644
|
|
|
4ec855 |
--- a/qapi/misc.json
|
|
|
4ec855 |
+++ b/qapi/misc.json
|
|
|
4ec855 |
@@ -573,7 +573,7 @@
|
|
|
4ec855 |
'mips': 'CpuInfoOther',
|
|
|
4ec855 |
'tricore': 'CpuInfoOther',
|
|
|
4ec855 |
's390': 'CpuInfoS390',
|
|
|
4ec855 |
- 'riscv': 'CpuInfoRISCV',
|
|
|
4ec855 |
+ 'riscv': 'CpuInfoOther',
|
|
|
4ec855 |
'other': 'CpuInfoOther' } }
|
|
|
4ec855 |
|
|
|
4ec855 |
##
|
|
|
4ec855 |
--
|
|
|
4ec855 |
1.8.3.1
|
|
|
4ec855 |
|