[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v5 34/43] i386: Get model-id from CPU object on "-cpu
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [PULL v5 34/43] i386: Get model-id from CPU object on "-cpu help" |
Date: |
Wed, 3 Jul 2019 18:08:12 -0300 |
When introducing versioned CPU models, the string at
X86CPUDefinition::model_id might not be the model-id we'll really
use. Instantiate a CPU object and check the model-id property on
"-cpu help"
Signed-off-by: Eduardo Habkost <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Signed-off-by: Eduardo Habkost <address@hidden>
---
target/i386/cpu.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 8852b57c0b..a0e422adf3 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -3837,18 +3837,28 @@ static GSList *get_sorted_cpu_model_list(void)
return list;
}
+static char *x86_cpu_class_get_model_id(X86CPUClass *xc)
+{
+ Object *obj = object_new(object_class_get_name(OBJECT_CLASS(xc)));
+ char *r = object_property_get_str(obj, "model-id", &error_abort);
+ object_unref(obj);
+ return r;
+}
+
static void x86_cpu_list_entry(gpointer data, gpointer user_data)
{
ObjectClass *oc = data;
X86CPUClass *cc = X86_CPU_CLASS(oc);
char *name = x86_cpu_class_get_model_name(cc);
- const char *desc = cc->model_description;
- if (!desc && cc->cpu_def) {
- desc = cc->cpu_def->model_id;
+ char *desc = g_strdup(cc->model_description);
+
+ if (!desc) {
+ desc = x86_cpu_class_get_model_id(cc);
}
qemu_printf("x86 %-20s %-48s\n", name, desc);
g_free(name);
+ g_free(desc);
}
/* list available CPU models and flags */
--
2.18.0.rc1.1.g3f1ff2140
- [Qemu-devel] [PULL v5 32/43] qmp: Add "alias-of" field to query-cpu-definitions, (continued)
- [Qemu-devel] [PULL v5 32/43] qmp: Add "alias-of" field to query-cpu-definitions, Eduardo Habkost, 2019/07/03
- [Qemu-devel] [PULL v5 42/43] numa: allow memory-less nodes when using memdev as backend, Eduardo Habkost, 2019/07/03
- [Qemu-devel] [PULL v5 33/43] i386: Add x-force-features option for testing, Eduardo Habkost, 2019/07/03
- [Qemu-devel] [PULL v5 17/43] numa: deprecate 'mem' parameter of '-numa node' option, Eduardo Habkost, 2019/07/03
- [Qemu-devel] [PULL v5 39/43] docs: Deprecate CPU model runnability guarantees, Eduardo Habkost, 2019/07/03
- [Qemu-devel] [PULL v5 38/43] i386: Make unversioned CPU models be aliases, Eduardo Habkost, 2019/07/03
- [Qemu-devel] [PULL v5 35/43] i386: Register versioned CPU models, Eduardo Habkost, 2019/07/03
- [Qemu-devel] [PULL v5 43/43] tests: use -numa memdev option in tests instead of legacy 'mem' option, Eduardo Habkost, 2019/07/03
- [Qemu-devel] [PULL v5 37/43] i386: Replace -noTSX, -IBRS, -IBPB CPU models with aliases, Eduardo Habkost, 2019/07/03
- [Qemu-devel] [PULL v5 36/43] i386: Define -IBRS, -noTSX, -IBRS versions of CPU models, Eduardo Habkost, 2019/07/03
- [Qemu-devel] [PULL v5 34/43] i386: Get model-id from CPU object on "-cpu help",
Eduardo Habkost <=
- [Qemu-devel] [PULL v5 41/43] numa: Make deprecation warnings conditional on !qtest_enabled(), Eduardo Habkost, 2019/07/03
- [Qemu-devel] [PULL v5 40/43] i386: Add Cascadelake-Server-v2 CPU model, Eduardo Habkost, 2019/07/03
- Re: [Qemu-devel] [PULL v5 00/43] Machine and x86 queue, 2019-07-03, no-reply, 2019/07/03
- Re: [Qemu-devel] [PULL v5 00/43] Machine and x86 queue, 2019-07-03, no-reply, 2019/07/03
- Re: [Qemu-devel] [PULL v5 00/43] Machine and x86 queue, 2019-07-03, Peter Maydell, 2019/07/04