[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 11/11] i386: Improve query-cpu-model-expansion full m
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [PULL 11/11] i386: Improve query-cpu-model-expansion full mode |
Date: |
Mon, 27 Feb 2017 13:25:01 -0300 |
This keeps the same results on type=static expansion, but make
type=full expansion return every single QOM property on the CPU
object that have a different value from the "base' CPU model,
plus all the CPU feature flag properties.
Cc: Jiri Denemark <address@hidden>
Message-Id: <address@hidden>
Tested-by: Jiri Denemark <address@hidden>
Signed-off-by: Eduardo Habkost <address@hidden>
---
target/i386/cpu.c | 34 +++++++++++++++++++++++++++++++---
1 file changed, 31 insertions(+), 3 deletions(-)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 139b7ea12e..89421c893b 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -2419,6 +2419,34 @@ static void x86_cpu_to_dict(X86CPU *cpu, QDict *props)
}
}
+/* Convert CPU model data from X86CPU object to a property dictionary
+ * that can recreate exactly the same CPU model, including every
+ * writeable QOM property.
+ */
+static void x86_cpu_to_dict_full(X86CPU *cpu, QDict *props)
+{
+ ObjectPropertyIterator iter;
+ ObjectProperty *prop;
+
+ object_property_iter_init(&iter, OBJECT(cpu));
+ while ((prop = object_property_iter_next(&iter))) {
+ /* skip read-only or write-only properties */
+ if (!prop->get || !prop->set) {
+ continue;
+ }
+
+ /* "hotplugged" is the only property that is configurable
+ * on the command-line but will be set differently on CPUs
+ * created using "-cpu ... -smp ..." and by CPUs created
+ * on the fly by x86_cpu_from_model() for querying. Skip it.
+ */
+ if (!strcmp(prop->name, "hotplugged")) {
+ continue;
+ }
+ x86_cpu_expand_prop(cpu, props, prop->name);
+ }
+}
+
static void object_apply_props(Object *obj, QDict *props, Error **errp)
{
const QDictEntry *prop;
@@ -2489,11 +2517,13 @@ arch_query_cpu_model_expansion(CpuModelExpansionType
type,
goto out;
}
+ props = qdict_new();
switch (type) {
case CPU_MODEL_EXPANSION_TYPE_STATIC:
/* Static expansion will be based on "base" only */
base_name = "base";
+ x86_cpu_to_dict(xc, props);
break;
case CPU_MODEL_EXPANSION_TYPE_FULL:
/* As we don't return every single property, full expansion needs
@@ -2501,9 +2531,7 @@ arch_query_cpu_model_expansion(CpuModelExpansionType type,
* properties on top of that.
*/
base_name = model->name;
- if (model->has_props && model->props) {
- props = qdict_clone_shallow(qobject_to_qdict(model->props));
- }
+ x86_cpu_to_dict_full(xc, props);
break;
default:
error_setg(&err, "Unsupportted expansion type");
--
2.11.0.259.g40922b1
- [Qemu-devel] [PULL 00/11] x86 queue, 2017-02-27, Eduardo Habkost, 2017/02/27
- [Qemu-devel] [PULL 01/11] i386: Unset cannot_destroy_with_object_finalize_yet on "host" model, Eduardo Habkost, 2017/02/27
- [Qemu-devel] [PULL 02/11] i386: Add ordering field to CPUClass, Eduardo Habkost, 2017/02/27
- [Qemu-devel] [PULL 03/11] i386: Rename X86CPU::host_features to X86CPU::max_features, Eduardo Habkost, 2017/02/27
- [Qemu-devel] [PULL 05/11] qapi-schema: Comment about full expansion of non-migration-safe models, Eduardo Habkost, 2017/02/27
- [Qemu-devel] [PULL 04/11] i386: Reorganize and document CPUID initialization steps, Eduardo Habkost, 2017/02/27
- [Qemu-devel] [PULL 06/11] i386: Create "max" CPU model, Eduardo Habkost, 2017/02/27
- [Qemu-devel] [PULL 07/11] i386: Make "max" model not use any host CPUID info on TCG, Eduardo Habkost, 2017/02/27
- [Qemu-devel] [PULL 08/11] i386: Don't set CPUClass::cpu_def on "max" model, Eduardo Habkost, 2017/02/27
- [Qemu-devel] [PULL 11/11] i386: Improve query-cpu-model-expansion full mode,
Eduardo Habkost <=
- [Qemu-devel] [PULL 09/11] i386: Define static "base" CPU model, Eduardo Habkost, 2017/02/27
- [Qemu-devel] [PULL 10/11] i386: Implement query-cpu-model-expansion QMP command, Eduardo Habkost, 2017/02/27
- Re: [Qemu-devel] [PULL 00/11] x86 queue, 2017-02-27, Peter Maydell, 2017/02/27