From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Mark Cave-Ayland" <mark.caveayland@nutanix.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PULL 15/18] hw/i386/isapc.c: warn rather than reject modern x86 CPU models
Date: Tue, 28 Oct 2025 18:34:27 +0100 [thread overview]
Message-ID: <20251028173430.2180057-16-pbonzini@redhat.com> (raw)
In-Reply-To: <20251028173430.2180057-1-pbonzini@redhat.com>
From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
Commit e1e2909f8e ("hw/i386/pc_piix.c: restrict isapc machine to 32-bit CPUs")
restricted the isapc machine to 32-bit CPUs, but subsequent concern has been
expressed as to the effect this could have on users.
The outcome of the latest discussion is that we should exercise more caution
and follow the official deprecation route, so instead of rejecting modern x86
CPUs issue a deprecation warning but allow the user to continue.
Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Link: https://lore.kernel.org/r/20251023142926.964718-2-mark.caveayland@nutanix.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/i386/isapc.c | 55 ++++++++++++++++++++-----------------------------
1 file changed, 22 insertions(+), 33 deletions(-)
diff --git a/hw/i386/isapc.c b/hw/i386/isapc.c
index 44f4a446724..1ba9ae22cc3 100644
--- a/hw/i386/isapc.c
+++ b/hw/i386/isapc.c
@@ -41,29 +41,31 @@ 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");
- }
+ bool valid_cpu_type = false;
+ static const char * const valid_cpu_types[] = {
+ X86_CPU_TYPE_NAME("486"),
+ X86_CPU_TYPE_NAME("athlon"),
+ X86_CPU_TYPE_NAME("kvm32"),
+ X86_CPU_TYPE_NAME("pentium"),
+ X86_CPU_TYPE_NAME("pentium2"),
+ X86_CPU_TYPE_NAME("pentium3"),
+ X86_CPU_TYPE_NAME("qemu32"),
+ };
/*
- * 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.
+ * The isapc machine is supposed to represent a legacy ISA-only PC with a
+ * 32-bit processor. For historical reasons the machine can still accept
+ * almost any valid processor, but this is now deprecated in 10.2. Emit
+ * a warning if anyone tries to use a deprecated CPU.
*/
- 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");
+ for (i = 0; i < ARRAY_SIZE(valid_cpu_types); i++) {
+ if (!strcmp(machine->cpu_type, valid_cpu_types[i])) {
+ valid_cpu_type = true;
+ }
+ }
+
+ if (!valid_cpu_type) {
+ warn_report("cpu type %s is deprecated for isapc machine", machine->cpu_type);
}
if (machine->ram_size > 3.5 * GiB) {
@@ -154,18 +156,6 @@ static void pc_init_isa(MachineState *machine)
static void isapc_machine_options(MachineClass *m)
{
- static const char * const valid_cpu_types[] = {
- X86_CPU_TYPE_NAME("486"),
- X86_CPU_TYPE_NAME("athlon"),
- X86_CPU_TYPE_NAME("kvm32"),
- X86_CPU_TYPE_NAME("pentium"),
- 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);
m->desc = "ISA-only PC";
@@ -180,7 +170,6 @@ static void isapc_machine_options(MachineClass *m)
pcmc->has_reserved_memory = false;
m->default_nic = "ne2k_isa";
m->default_cpu_type = X86_CPU_TYPE_NAME("486");
- m->valid_cpu_types = valid_cpu_types;
m->no_floppy = !module_object_class_by_name(TYPE_ISA_FDC);
m->no_parallel = !module_object_class_by_name(TYPE_ISA_PARALLEL);
}
--
2.51.1
next prev parent reply other threads:[~2025-10-28 17:38 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-28 17:34 [PULL 00/18] Miscellaneous changes for 2025-10-28 Paolo Bonzini
2025-10-28 17:34 ` [PULL 01/18] scripts: clean up meson-buildoptions.py Paolo Bonzini
2025-10-28 17:34 ` [PULL 02/18] i386/kvm/cpu: Init SMM cpu address space for hotplugged CPUs Paolo Bonzini
2025-10-29 7:01 ` Zhao Liu
2025-10-30 2:19 ` Xiaoyao Li
2025-10-30 7:36 ` Michael Tokarev
2025-10-30 7:49 ` Xiaoyao Li
2025-10-30 8:03 ` Michael Tokarev
2025-10-28 17:34 ` [PULL 03/18] rcu: Unify force quiescent state Paolo Bonzini
2025-11-03 13:59 ` Regression with the "replay" test on target alpha (was: [PULL 03/18] rcu: Unify force quiescent state) Thomas Huth
2025-11-04 1:45 ` Regression with the "replay" test on target alpha Akihiko Odaki
2025-11-04 7:41 ` Thomas Huth
2025-11-04 8:08 ` Akihiko Odaki
2025-11-04 8:38 ` Thomas Huth
2025-11-04 12:18 ` Paolo Bonzini
2025-11-05 6:29 ` Akihiko Odaki
2025-11-07 7:41 ` Thomas Huth
2025-11-07 7:49 ` Paolo Bonzini
2025-11-14 6:11 ` Thomas Huth
2025-11-18 16:22 ` Paolo Bonzini
2025-10-28 17:34 ` [PULL 04/18] rust: remove useless glib_sys bindings Paolo Bonzini
2025-10-28 17:34 ` [PULL 05/18] rust: only leave leaf crates as workspace members Paolo Bonzini
2025-10-28 17:34 ` [PULL 06/18] qobject: make refcount atomic Paolo Bonzini
2025-10-28 17:34 ` [PULL 07/18] char: rename CharBackend->CharFrontend Paolo Bonzini
2025-10-28 17:34 ` [PULL 08/18] accel/mshv: initialize thread name Paolo Bonzini
2025-10-28 17:34 ` [PULL 09/18] accel/mshv: use return value of handle_pio_str_read Paolo Bonzini
2025-10-28 17:34 ` [PULL 10/18] esp.c: fix esp_cdb_ready() FIFO wraparound limit calculation Paolo Bonzini
2025-10-29 11:42 ` Michael Tokarev
2025-10-28 17:34 ` [PULL 11/18] qtest/am53c974-test: add additional test for cmdfifo overflow Paolo Bonzini
2025-10-28 17:34 ` [PULL 12/18] rust/qemu-macros: Convert bit value to u8 within #[property] Paolo Bonzini
2025-10-28 17:34 ` [PULL 13/18] scsi: make SCSIRequest refcount atomic Paolo Bonzini
2025-10-28 17:34 ` [PULL 14/18] qdev: Change PropertyInfo method print() to return malloc'ed string Paolo Bonzini
2025-10-28 17:34 ` Paolo Bonzini [this message]
2025-10-28 17:34 ` [PULL 16/18] docs/about/deprecated.rst: document isapc deprecation for modern x86 CPU models Paolo Bonzini
2025-10-28 17:34 ` [PULL 17/18] target/i386: clear CPU_INTERRUPT_SIPI for all accelerators Paolo Bonzini
2025-10-28 17:34 ` [PULL 18/18] rust: migration: allow passing ParentField<> to vmstate_of! Paolo Bonzini
2025-10-29 6:34 ` Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251028173430.2180057-16-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=mark.caveayland@nutanix.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).