[PATCH] hw/i386/isapc.c: remove support for -cpu host and -cpu max

Mark Cave-Ayland posted 1 patch 4 days, 2 hours ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20250924124653.1395094-1-mark.caveayland@nutanix.com
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, Eduardo Habkost <eduardo@habkost.net>, "Michael S. Tsirkin" <mst@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
hw/i386/isapc.c | 27 ---------------------------
1 file changed, 27 deletions(-)
[PATCH] hw/i386/isapc.c: remove support for -cpu host and -cpu max
Posted by Mark Cave-Ayland 4 days, 2 hours ago
Following recent discussions on the mailing list, it has been decided
that instead of mapping -cpu host and -cpu max to a suitable 32-bit x86 CPU,
it is preferable to disallow them and use the existing valid_cpu_types
validation logic so that an error is returned to the user instead.

Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
---
 hw/i386/isapc.c | 27 ---------------------------
 1 file changed, 27 deletions(-)

diff --git a/hw/i386/isapc.c b/hw/i386/isapc.c
index 44f4a44672..6c35a397df 100644
--- a/hw/i386/isapc.c
+++ b/hw/i386/isapc.c
@@ -41,31 +41,6 @@ static void pc_init_isa(MachineState *machine)
     DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
     int i;
 
-    /*
-     * There is a small chance that someone unintentionally passes "-cpu max"
-     * for the isapc machine, which will provide a much more modern 32-bit
-     * CPU than would be expected for an ISA-era PC. If the "max" cpu type has
-     * been specified, choose the "best" 32-bit cpu possible which we consider
-     * be the pentium3 (deliberately choosing an Intel CPU given that the
-     * default 486 CPU for the isapc machine is also an Intel CPU).
-     */
-    if (!strcmp(machine->cpu_type, X86_CPU_TYPE_NAME("max"))) {
-        machine->cpu_type = X86_CPU_TYPE_NAME("pentium3");
-        warn_report("-cpu max is invalid for isapc machine, using pentium3");
-    }
-
-    /*
-     * Similarly if someone unintentionally passes "-cpu host" for the isapc
-     * machine then display a warning and also switch to the "best" 32-bit
-     * cpu possible which we consider to be the pentium3. This is because any
-     * host CPU will already be modern than this, but it also ensures any
-     * newer CPU flags/features are filtered out for older guests.
-     */
-    if (!strcmp(machine->cpu_type, X86_CPU_TYPE_NAME("host"))) {
-        machine->cpu_type = X86_CPU_TYPE_NAME("pentium3");
-        warn_report("-cpu host is invalid for isapc machine, using pentium3");
-    }
-
     if (machine->ram_size > 3.5 * GiB) {
         error_report("Too much memory for this machine: %" PRId64 " MiB, "
                      "maximum 3584 MiB", machine->ram_size / MiB);
@@ -162,8 +137,6 @@ static void isapc_machine_options(MachineClass *m)
         X86_CPU_TYPE_NAME("pentium2"),
         X86_CPU_TYPE_NAME("pentium3"),
         X86_CPU_TYPE_NAME("qemu32"),
-        X86_CPU_TYPE_NAME("max"),
-        X86_CPU_TYPE_NAME("host"),
         NULL
     };
     PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
-- 
2.43.0
Re: [PATCH] hw/i386/isapc.c: remove support for -cpu host and -cpu max
Posted by Markus Armbruster 3 days, 10 hours ago
Mark Cave-Ayland <mark.caveayland@nutanix.com> writes:

> Following recent discussions on the mailing list, it has been decided
> that instead of mapping -cpu host and -cpu max to a suitable 32-bit x86 CPU,
> it is preferable to disallow them and use the existing valid_cpu_types
> validation logic so that an error is returned to the user instead.
>
> Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>

Do we need to note this in docs/about/removed-features.rst and/or
release notes?
Re: [PATCH] hw/i386/isapc.c: remove support for -cpu host and -cpu max
Posted by Mark Cave-Ayland 2 days, 23 hours ago
On 25/09/2025 05:27, Markus Armbruster wrote:

> Mark Cave-Ayland <mark.caveayland@nutanix.com> writes:
> 
>> Following recent discussions on the mailing list, it has been decided
>> that instead of mapping -cpu host and -cpu max to a suitable 32-bit x86 CPU,
>> it is preferable to disallow them and use the existing valid_cpu_types
>> validation logic so that an error is returned to the user instead.
>>
>> Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
> 
> Do we need to note this in docs/about/removed-features.rst and/or
> release notes?

Good point, I think this (and the previously added 32-bit CPU 
restriction) is worth mentioning in the "Backwards compatibility" 
section. I'll see what I can come up with and send a v2 along with a 
documentation change.


ATB,

Mark.