[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 2/7] i386: Add X86CPUModel.alias_of field
From: |
Eduardo Habkost |
Subject: |
[PATCH v2 2/7] i386: Add X86CPUModel.alias_of field |
Date: |
Tue, 13 Oct 2020 19:04:52 -0400 |
Instead of calling x86_cpu_class_get_alias_of(), just save the
actual CPU model name in X86CPUModel and use it in `-cpu help`.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
target/i386/cpu.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 9eafbe3690..43e633ddd3 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -1647,6 +1647,12 @@ struct X86CPUModel {
* This matters only for "-cpu help" and query-cpu-definitions
*/
bool is_alias;
+ /*
+ * Valid only if is_alias is true.
+ * If NULL, actual alias depend on machine type.
+ * If not NULL, name of actual CPU model this is an alias to.
+ */
+ const char *alias_of;
};
/* Get full model name for CPU version */
@@ -4927,14 +4933,13 @@ static void x86_cpu_list_entry(gpointer data, gpointer
user_data)
X86CPUClass *cc = X86_CPU_CLASS(oc);
g_autofree char *name = x86_cpu_class_get_model_name(cc);
g_autofree char *desc = g_strdup(cc->model_description);
- g_autofree char *alias_of = x86_cpu_class_get_alias_of(cc);
g_autofree char *model_id = x86_cpu_class_get_model_id(cc);
- if (!desc && alias_of) {
- if (cc->model && cc->model->version == CPU_VERSION_AUTO) {
+ if (!desc && cc->model && cc->model->is_alias) {
+ if (!cc->model->alias_of) {
desc = g_strdup("(alias configured by machine type)");
} else {
- desc = g_strdup_printf("(alias of %s)", alias_of);
+ desc = g_strdup_printf("(alias of %s)", cc->model->alias_of);
}
}
if (!desc && cc->model && cc->model->note) {
@@ -5418,6 +5423,7 @@ static void x86_register_cpudef_types(X86CPUDefinition
*def)
m->cpudef = def;
m->version = CPU_VERSION_AUTO;
m->is_alias = true;
+ m->alias_of = NULL; /* depends on machine type */
x86_register_cpu_model_type(def->name, m);
/* Versioned models: */
@@ -5436,6 +5442,7 @@ static void x86_register_cpudef_types(X86CPUDefinition
*def)
am->cpudef = def;
am->version = vdef->version;
am->is_alias = true;
+ am->alias_of = g_strdup(name);
x86_register_cpu_model_type(vdef->alias, am);
}
}
--
2.28.0
- [PATCH v2 0/7] i386: Add `machine` parameter to query-cpu-definitions, Eduardo Habkost, 2020/10/13
- [PATCH v2 1/7] machine: machine_find_class() function, Eduardo Habkost, 2020/10/13
- [PATCH v2 2/7] i386: Add X86CPUModel.alias_of field,
Eduardo Habkost <=
- [PATCH v2 3/7] i386: Replace x86_cpu_class_get_alias_of() with x86_cpu_model_resolve_alias(), Eduardo Habkost, 2020/10/13
- [PATCH v2 4/7] i386: Add default_version parameter to CPU version functions, Eduardo Habkost, 2020/10/13
- [PATCH v2 5/7] i386: Wrap QMP code in !CONFIG_USER_ONLY, Eduardo Habkost, 2020/10/13
- [PATCH v2 6/7] i386: Don't use default_cpu_version inside x86_cpu_definition_entry(), Eduardo Habkost, 2020/10/13
- [PATCH v2 7/7] cpu: Add `machine` parameter to query-cpu-definitions, Eduardo Habkost, 2020/10/13