hw/i386/microvm.c | 2 +- target/i386/cpu.c | 15 --------------- target/i386/cpu.h | 4 ---- 3 files changed, 1 insertion(+), 20 deletions(-)
Microvm machines are not versioned and therefore there is no requirement to use
the latest cpu model by default. Let microvms use the non-versioned cpu model.
Those users who need spefific cpu versions can use explicit commandline to
select the cpu version desired.
CC: imammedo@redhat.com
CC: zhao1.liu@intel.com
Signed-off-by: Ani Sinha <anisinha@redhat.com>
---
hw/i386/microvm.c | 2 +-
target/i386/cpu.c | 15 ---------------
target/i386/cpu.h | 4 ----
3 files changed, 1 insertion(+), 20 deletions(-)
Pipeline passes:
https://gitlab.com/anisinha/qemu/-/pipelines/1669159835
See also Igor's comment on
https://patchwork.ozlabs.org/project/qemu-devel/patch/20250128035526.3750043-1-anisinha@redhat.com/
diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c
index a8d354aabe..b8be1542ff 100644
--- a/hw/i386/microvm.c
+++ b/hw/i386/microvm.c
@@ -458,7 +458,7 @@ static void microvm_machine_state_init(MachineState *machine)
microvm_memory_init(mms);
- x86_cpus_init(x86ms, CPU_VERSION_LATEST);
+ x86_cpus_init(x86ms, 1);
microvm_devices_init(mms);
}
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index b5dd60d281..6d251c0025 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -5513,18 +5513,6 @@ void x86_cpu_set_default_version(X86CPUVersion version)
default_cpu_version = version;
}
-static X86CPUVersion x86_cpu_model_last_version(const X86CPUModel *model)
-{
- int v = 0;
- const X86CPUVersionDefinition *vdef =
- x86_cpu_def_get_versions(model->cpudef);
- while (vdef->version) {
- v = vdef->version;
- vdef++;
- }
- return v;
-}
-
/* Return the actual version being used for a specific CPU model */
static X86CPUVersion x86_cpu_model_resolve_version(const X86CPUModel *model)
{
@@ -5532,9 +5520,6 @@ static X86CPUVersion x86_cpu_model_resolve_version(const X86CPUModel *model)
if (v == CPU_VERSION_AUTO) {
v = default_cpu_version;
}
- if (v == CPU_VERSION_LATEST) {
- return x86_cpu_model_last_version(model);
- }
return v;
}
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index c67b42d34f..71f150a05f 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -2701,10 +2701,6 @@ void apic_handle_tpr_access_report(DeviceState *d, target_ulong ip,
TPRAccess access);
/* Special values for X86CPUVersion: */
-
-/* Resolve to latest CPU version */
-#define CPU_VERSION_LATEST -1
-
/*
* Resolve to version defined by current machine type.
* See x86_cpu_set_default_version()
--
2.45.2
Ani Sinha <anisinha@redhat.com> writes: > Microvm machines are not versioned and therefore there is no requirement to use > the latest cpu model by default. Let microvms use the non-versioned cpu model. > Those users who need spefific cpu versions can use explicit commandline to > select the cpu version desired. > > CC: imammedo@redhat.com > CC: zhao1.liu@intel.com > Signed-off-by: Ani Sinha <anisinha@redhat.com> > --- > hw/i386/microvm.c | 2 +- > target/i386/cpu.c | 15 --------------- > target/i386/cpu.h | 4 ---- > 3 files changed, 1 insertion(+), 20 deletions(-) Reviewed-by: Sergio Lopez <slp@redhat.com>
On Thu, 13 Feb 2025 15:11:00 +0530
Ani Sinha <anisinha@redhat.com> wrote:
> Microvm machines are not versioned and therefore there is no requirement to use
> the latest cpu model by default. Let microvms use the non-versioned cpu model.
> Those users who need spefific cpu versions can use explicit commandline to
> select the cpu version desired.
Above says why we can do this but,
I'd also add here a reason why we are doing that to begin with.
>
> CC: imammedo@redhat.com
> CC: zhao1.liu@intel.com
> Signed-off-by: Ani Sinha <anisinha@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
> ---
> hw/i386/microvm.c | 2 +-
> target/i386/cpu.c | 15 ---------------
> target/i386/cpu.h | 4 ----
> 3 files changed, 1 insertion(+), 20 deletions(-)
>
> Pipeline passes:
> https://gitlab.com/anisinha/qemu/-/pipelines/1669159835
> See also Igor's comment on
> https://patchwork.ozlabs.org/project/qemu-devel/patch/20250128035526.3750043-1-anisinha@redhat.com/
>
> diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c
> index a8d354aabe..b8be1542ff 100644
> --- a/hw/i386/microvm.c
> +++ b/hw/i386/microvm.c
> @@ -458,7 +458,7 @@ static void microvm_machine_state_init(MachineState *machine)
>
> microvm_memory_init(mms);
>
> - x86_cpus_init(x86ms, CPU_VERSION_LATEST);
> + x86_cpus_init(x86ms, 1);
>
> microvm_devices_init(mms);
> }
> diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> index b5dd60d281..6d251c0025 100644
> --- a/target/i386/cpu.c
> +++ b/target/i386/cpu.c
> @@ -5513,18 +5513,6 @@ void x86_cpu_set_default_version(X86CPUVersion version)
> default_cpu_version = version;
> }
>
> -static X86CPUVersion x86_cpu_model_last_version(const X86CPUModel *model)
> -{
> - int v = 0;
> - const X86CPUVersionDefinition *vdef =
> - x86_cpu_def_get_versions(model->cpudef);
> - while (vdef->version) {
> - v = vdef->version;
> - vdef++;
> - }
> - return v;
> -}
> -
> /* Return the actual version being used for a specific CPU model */
> static X86CPUVersion x86_cpu_model_resolve_version(const X86CPUModel *model)
> {
> @@ -5532,9 +5520,6 @@ static X86CPUVersion x86_cpu_model_resolve_version(const X86CPUModel *model)
> if (v == CPU_VERSION_AUTO) {
> v = default_cpu_version;
> }
> - if (v == CPU_VERSION_LATEST) {
> - return x86_cpu_model_last_version(model);
> - }
> return v;
> }
>
> diff --git a/target/i386/cpu.h b/target/i386/cpu.h
> index c67b42d34f..71f150a05f 100644
> --- a/target/i386/cpu.h
> +++ b/target/i386/cpu.h
> @@ -2701,10 +2701,6 @@ void apic_handle_tpr_access_report(DeviceState *d, target_ulong ip,
> TPRAccess access);
>
> /* Special values for X86CPUVersion: */
> -
> -/* Resolve to latest CPU version */
> -#define CPU_VERSION_LATEST -1
> -
> /*
> * Resolve to version defined by current machine type.
> * See x86_cpu_set_default_version()
© 2016 - 2026 Red Hat, Inc.