[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 1/6] qapi: fill in CpuInfoFast.arch in query-cpus-fa
From: |
Laszlo Ersek |
Subject: |
[Qemu-devel] [PATCH 1/6] qapi: fill in CpuInfoFast.arch in query-cpus-fast |
Date: |
Tue, 24 Apr 2018 23:45:45 +0200 |
Commit ca230ff33f89 added 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().
Cc: Eric Blake <address@hidden>
Cc: Markus Armbruster <address@hidden>
Cc: Paolo Bonzini <address@hidden>
Cc: Peter Crosthwaite <address@hidden>
Cc: Richard Henderson <address@hidden>
Cc: address@hidden
Fixes: ca230ff33f89bf7102cbfbc2328716da6750aaed
Signed-off-by: Laszlo Ersek <address@hidden>
---
Notes:
PATCHv1:
- new patch
cpus.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/cpus.c b/cpus.c
index 38eba8bff334..1a9a2edee1f2 100644
--- a/cpus.c
+++ b/cpus.c
@@ -2210,27 +2210,39 @@ CpuInfoFastList *qmp_query_cpus_fast(Error **errp)
info->value->qom_path = object_get_canonical_path(OBJECT(cpu));
info->value->thread_id = cpu->thread_id;
info->value->has_props = !!mc->cpu_index_to_instance_props;
if (info->value->has_props) {
CpuInstanceProperties *props;
props = g_malloc0(sizeof(*props));
*props = mc->cpu_index_to_instance_props(ms, cpu->cpu_index);
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;
+#else
+ info->value->arch = CPU_INFO_ARCH_OTHER;
#endif
if (!cur_item) {
head = cur_item = info;
} else {
cur_item->next = info;
cur_item = info;
}
}
return head;
}
--
2.14.1.3.gb7cf6e02401b
[Qemu-devel] [PATCH 1/6] qapi: fill in CpuInfoFast.arch in query-cpus-fast,
Laszlo Ersek <=
[Qemu-devel] [PATCH 2/6] qapi: handle the riscv CpuInfoArch in query-cpus-fast, Laszlo Ersek, 2018/04/24