[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 3/7] i386: Replace x86_cpu_class_get_alias_of() with x86_cpu_m
From: |
Eduardo Habkost |
Subject: |
[PATCH v2 3/7] i386: Replace x86_cpu_class_get_alias_of() with x86_cpu_model_resolve_alias() |
Date: |
Tue, 13 Oct 2020 19:04:53 -0400 |
New function is very similar to the old function, but it just
takes a X86CPUModel as argument, and its name makes its purpose
clearer.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
target/i386/cpu.c | 33 +++++++++++++++++----------------
1 file changed, 17 insertions(+), 16 deletions(-)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 43e633ddd3..2c8dd3fa32 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -4170,6 +4170,21 @@ static X86CPUVersion x86_cpu_model_resolve_version(const
X86CPUModel *model)
return v;
}
+/* Resolve CPU model alias to actual CPU model name */
+static char *x86_cpu_model_resolve_alias(const X86CPUModel *model)
+{
+ X86CPUVersion version;
+
+ if (!model->is_alias) {
+ return NULL;
+ }
+ version = x86_cpu_model_resolve_version(model);
+ if (version <= 0) {
+ return NULL;
+ }
+ return x86_cpu_versioned_model_name(model->cpudef, version);
+}
+
void x86_cpu_change_kvm_default(const char *prop, const char *value)
{
PropValue *pv;
@@ -4913,20 +4928,6 @@ static char *x86_cpu_class_get_model_id(X86CPUClass *xc)
return r;
}
-static char *x86_cpu_class_get_alias_of(X86CPUClass *cc)
-{
- X86CPUVersion version;
-
- if (!cc->model || !cc->model->is_alias) {
- return NULL;
- }
- version = x86_cpu_model_resolve_version(cc->model);
- if (version <= 0) {
- return NULL;
- }
- return x86_cpu_versioned_model_name(cc->model->cpudef, version);
-}
-
static void x86_cpu_list_entry(gpointer data, gpointer user_data)
{
ObjectClass *oc = data;
@@ -5002,8 +5003,8 @@ static void x86_cpu_definition_entry(gpointer data,
gpointer user_data)
* Old machine types won't report aliases, so that alias translation
* doesn't break compatibility with previous QEMU versions.
*/
- if (default_cpu_version != CPU_VERSION_LEGACY) {
- info->alias_of = x86_cpu_class_get_alias_of(cc);
+ if (cc->model && default_cpu_version != CPU_VERSION_LEGACY) {
+ info->alias_of = x86_cpu_model_resolve_alias(cc->model);
info->has_alias_of = !!info->alias_of;
}
--
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, 2020/10/13
- [PATCH v2 4/7] i386: Add default_version parameter to CPU version functions, Eduardo Habkost, 2020/10/13
- [PATCH v2 3/7] i386: Replace x86_cpu_class_get_alias_of() with x86_cpu_model_resolve_alias(),
Eduardo Habkost <=
- [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