qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC 5/5] target-i386: Report QOM class name for CPU defini


From: Eduardo Habkost
Subject: [Qemu-devel] [RFC 5/5] target-i386: Report QOM class name for CPU definitions
Date: Wed, 30 Apr 2014 17:29:33 -0300

The new qom-type attributed will be used to indicate that the object-add
QMP command can be used to create CPU objects. This will let management
code to create multiple CPU objects from different classes and CPU
models and query for their information using QOM properties (like the
"feature-words" properties) in a single QEMU instance, instead of having
to re-run QEMU once for each CPU model.

Signed-off-by: Eduardo Habkost <address@hidden>
---
 qapi-schema.json  | 6 +++++-
 target-i386/cpu.c | 2 ++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/qapi-schema.json b/qapi-schema.json
index 0b00427..7d8bec5 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3438,11 +3438,15 @@
 # Virtual CPU definition.
 #
 # @name: the name of the CPU definition
+# @qom-type: the name of the QOM class for the CPU model. The presence
+#            of this attribute indicates that CPU objects can be created
+#            using object-add.
+#            (since: 2.1.0)
 #
 # Since: 1.2.0
 ##
 { 'type': 'CpuDefinitionInfo',
-  'data': { 'name': 'str' } }
+  'data': { 'name': 'str', '*qom-type': 'str' } }
 
 ##
 # @query-cpu-definitions:
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 2417fc8..897caa4 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1828,6 +1828,8 @@ CpuDefinitionInfoList *arch_query_cpu_definitions(Error 
**errp)
         def = &builtin_x86_defs[i];
         info = g_malloc0(sizeof(*info));
         info->name = g_strdup(def->name);
+        info->has_qom_type = true;
+        info->qom_type = x86_cpu_type_name(def->name);
 
         entry = g_malloc0(sizeof(*entry));
         entry->value = info;
-- 
1.9.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]