[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH RFC 10/11] s390/qemu: cpu model QMP query-cpu-model
From: |
Michael Mueller |
Subject: |
[Qemu-devel] [PATCH RFC 10/11] s390/qemu: cpu model QMP query-cpu-model |
Date: |
Wed, 2 Oct 2013 13:33:41 +0200 |
This patch implements a new QMP request named "cpu-model". It returns
the cpu model of cpu 0. eg:
request: '{"execute" : "query-cpu-model" }
answer: '{"return" : "2817-ga1" }
Alias names are resolved to their respactive machine type and GA names
already during cpu instantiation. Thus, also a cpu name like "host",
which is iplemented as alias, will return its normalized cpu model name.
Signed-off-by: Michael Mueller <address@hidden>
---
include/sysemu/arch_init.h | 1 +
qapi-schema.json | 23 +++++++++++++++++++++++
qmp-commands.hx | 6 ++++++
qmp.c | 5 +++++
target-s390x/cpu.c | 21 +++++++++++++++++++++
5 files changed, 56 insertions(+)
diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h
index be71bca..a8d623b 100644
--- a/include/sysemu/arch_init.h
+++ b/include/sysemu/arch_init.h
@@ -36,5 +36,6 @@ int kvm_available(void);
int xen_available(void);
CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp);
+CpuModelInfo *arch_query_cpu_model(Error **errp);
#endif
diff --git a/qapi-schema.json b/qapi-schema.json
index 145eca8..9e86186 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3129,6 +3129,29 @@
##
{ 'command': 'query-cpu-definitions', 'returns': ['CpuDefinitionInfo'] }
+##
+# @CpuModelInfo:
+#
+# Virtual CPU model definition.
+#
+# @name: the name of the CPU model definition
+#
+# Since: 1.x.0
+##
+{ 'type': 'CpuModelInfo',
+ 'data': { 'name': 'str' } }
+
+##
+# @query-cpu-model:
+#
+# Return to current virtual CPU model
+#
+# Returns: CpuModelInfo
+#
+# Since: 1.2.0
+##
+{ 'command': 'query-cpu-model', 'returns': 'CpuModelInfo' }
+
# @AddfdInfo:
#
# Information about a file descriptor that was added to an fd set.
diff --git a/qmp-commands.hx b/qmp-commands.hx
index b17c46e..fef83a4 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -3036,6 +3036,12 @@ EQMP
},
{
+ .name = "query-cpu-model",
+ .args_type = "",
+ .mhandler.cmd_new = qmp_marshal_input_query_cpu_model,
+ },
+
+ {
.name = "query-target",
.args_type = "",
.mhandler.cmd_new = qmp_marshal_input_query_target,
diff --git a/qmp.c b/qmp.c
index 4c149b3..d9b1921 100644
--- a/qmp.c
+++ b/qmp.c
@@ -486,6 +486,11 @@ CpuDefinitionInfoList *qmp_query_cpu_definitions(Error
**errp)
return arch_query_cpu_definitions(errp);
}
+CpuModelInfo *qmp_query_cpu_model(Error **errp)
+{
+ return arch_query_cpu_model(errp);
+}
+
void qmp_add_client(const char *protocol, const char *fdname,
bool has_skipauth, bool skipauth, bool has_tls, bool tls,
Error **errp)
diff --git a/target-s390x/cpu.c b/target-s390x/cpu.c
index b790905..605c124 100644
--- a/target-s390x/cpu.c
+++ b/target-s390x/cpu.c
@@ -129,6 +129,27 @@ CpuDefinitionInfoList *arch_query_cpu_definitions(Error
**errp)
return entry;
}
}
+
+CpuModelInfo *arch_query_cpu_model(Error **errp)
+{
+ CpuModelInfo *cpu_model;
+ S390CPU *cpu;
+
+ cpu = s390_cpu_addr2state(0);
+ if (!cpu) {
+ return NULL;
+ }
+ cpu_model = g_malloc0(sizeof(*cpu_model));
+ if (!cpu_model) {
+ return NULL;
+ }
+ cpu_model->name = g_strdup(cpu->env.cpu_model_str);
+ if (!cpu_model->name) {
+ g_free(cpu_model);
+ return NULL;
+ }
+ return cpu_model;
+}
#endif
static void s390_cpu_set_pc(CPUState *cs, vaddr value)
--
1.8.3.1
- Re: [Qemu-devel] [PATCH RFC 04/11] s390/qemu: cpu model cpu facilitiy support, (continued)
[Qemu-devel] [PATCH RFC 05/11] s390/qemu: cpu model alias support, Michael Mueller, 2013/10/02
[Qemu-devel] [PATCH RFC 02/11] s390/qemu: cpu model extend config device, Michael Mueller, 2013/10/02
[Qemu-devel] [PATCH RFC 11/11] s390/qemu: cpu model enablement, Michael Mueller, 2013/10/02
[Qemu-devel] [PATCH RFC 01/11] s390/qemu: cpu modle disable list cpus, Michael Mueller, 2013/10/02
[Qemu-devel] [PATCH RFC 08/11] s390/qemu: cpu model command line option help, Michael Mueller, 2013/10/02
[Qemu-devel] [PATCH RFC 09/11] s390/qemu: cpu model QMP query-cpu-definitions, Michael Mueller, 2013/10/02
[Qemu-devel] [PATCH RFC 07/11] s390/qemu: cpu model class initialization, Michael Mueller, 2013/10/02
[Qemu-devel] [PATCH RFC 10/11] s390/qemu: cpu model QMP query-cpu-model,
Michael Mueller <=