Blame SOURCES/kvm-qapi-fill-in-CpuInfoFast.arch-in-query-cpus-fast.patch

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