[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 4/7] i386: Add default_version parameter to CPU version functi
From: |
Eduardo Habkost |
Subject: |
[PATCH v2 4/7] i386: Add default_version parameter to CPU version functions |
Date: |
Tue, 13 Oct 2020 19:04:54 -0400 |
Currently, the functions that resolve CPU model versions
(x86_cpu_model_resolve_version(), x86_cpu_model_resolve_alias())
need a machine to be initialized first. Get rid of this
requirement by making those functions get an explicit
default_version argument.
No behavior changes are introduced by this patch, as all callers
are being changed to use default_cpu_version as argument.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
target/i386/cpu.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 2c8dd3fa32..c78b2abfb8 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -4158,11 +4158,12 @@ static X86CPUVersion x86_cpu_model_last_version(const
X86CPUModel *model)
}
/* Return the actual version being used for a specific CPU model */
-static X86CPUVersion x86_cpu_model_resolve_version(const X86CPUModel *model)
+static X86CPUVersion x86_cpu_model_resolve_version(const X86CPUModel *model,
+ X86CPUVersion
default_version)
{
X86CPUVersion v = model->version;
if (v == CPU_VERSION_AUTO) {
- v = default_cpu_version;
+ v = default_version;
}
if (v == CPU_VERSION_LATEST) {
return x86_cpu_model_last_version(model);
@@ -4171,14 +4172,15 @@ static X86CPUVersion
x86_cpu_model_resolve_version(const X86CPUModel *model)
}
/* Resolve CPU model alias to actual CPU model name */
-static char *x86_cpu_model_resolve_alias(const X86CPUModel *model)
+static char *x86_cpu_model_resolve_alias(const X86CPUModel *model,
+ X86CPUVersion default_version)
{
X86CPUVersion version;
if (!model->is_alias) {
return NULL;
}
- version = x86_cpu_model_resolve_version(model);
+ version = x86_cpu_model_resolve_version(model, default_version);
if (version <= 0) {
return NULL;
}
@@ -5004,7 +5006,8 @@ static void x86_cpu_definition_entry(gpointer data,
gpointer user_data)
* doesn't break compatibility with previous QEMU versions.
*/
if (cc->model && default_cpu_version != CPU_VERSION_LEGACY) {
- info->alias_of = x86_cpu_model_resolve_alias(cc->model);
+ info->alias_of = x86_cpu_model_resolve_alias(cc->model,
+ default_cpu_version);
info->has_alias_of = !!info->alias_of;
}
@@ -5075,7 +5078,8 @@ static void x86_cpu_apply_props(X86CPU *cpu, PropValue
*props)
static void x86_cpu_apply_version_props(X86CPU *cpu, X86CPUModel *model)
{
const X86CPUVersionDefinition *vdef;
- X86CPUVersion version = x86_cpu_model_resolve_version(model);
+ X86CPUVersion version = x86_cpu_model_resolve_version(model,
+ default_cpu_version);
if (version == CPU_VERSION_LEGACY) {
return;
--
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 <=
- [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 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