From nobody Fri Nov 14 19:45:28 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1761673105; cv=none; d=zohomail.com; s=zohoarc; b=VIVoKpJ4O0kIXQvAFBnS3BgHrJJ5ctC/Z34gfhjX6EV0B3zBG/n3hoiom8o2iggus03A9WvBFsKkguEIZaD28xDquhUfUuIHUklzb8zJbPOre9se4jF8yjHbbtRM/t8tbJkUq/29oEtVaNTSHUjB3M786cGZDiI4VbPFYsJUuV4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761673105; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=eLhLVJ2XarzKVk+Slx8EqzVV2n5CC0vk3GBdbky8+bk=; b=O1ufAQ53xd+z5poqu+8II9pWzC6xLgy89/B1sBCoWMJV3byHn7BmPZzPuVnTpgPauP+v8vVbj/Ph2kMPMsgWfsxYHU5lZTnCO4fopJAwhCA8ps8BgTMQn1J2/uUbtkWSKixdm0jRLJUT8diDSFaezlGnSffTKYoDjGjlbF/EF4w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 176167310554375.12258488913164; Tue, 28 Oct 2025 10:38:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDnbt-0006Ws-Ki; Tue, 28 Oct 2025 13:35:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnbW-0006Oo-Og for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:35:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vDnbP-0004hx-Tj for qemu-devel@nongnu.org; Tue, 28 Oct 2025 13:35:30 -0400 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-546-bC7CMogrOjei_uKmrT1kSQ-1; Tue, 28 Oct 2025 13:35:20 -0400 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-475c422fd70so50648885e9.2 for ; Tue, 28 Oct 2025 10:35:20 -0700 (PDT) Received: from [192.168.10.48] ([151.95.110.222]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-429952df473sm21505827f8f.42.2025.10.28.10.35.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Oct 2025 10:35:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1761672922; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eLhLVJ2XarzKVk+Slx8EqzVV2n5CC0vk3GBdbky8+bk=; b=YbF7G3QQzntxJwTEiMLAuFM8CuZTdHvLPX9Mr3LVqxmWRuKwLFhWIP9HvbiZ6rpnFjYxQG HkcG3NizHBVceX87W8bK7iv8S/Cfj1/fP/BHw4xftAxk0OFtN/nt2LOyknd+H1Qzomam3v nKsIzQcuSxPH/SltghMjbiLaiVZ1eOY= X-MC-Unique: bC7CMogrOjei_uKmrT1kSQ-1 X-Mimecast-MFC-AGG-ID: bC7CMogrOjei_uKmrT1kSQ_1761672919 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761672919; x=1762277719; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eLhLVJ2XarzKVk+Slx8EqzVV2n5CC0vk3GBdbky8+bk=; b=he+/+zpwFlKe+YIbKTltQCSJlzQyxRW/CuZUYgLNnHEM90Ty2SWPtueuqtPiRbSJRx Xb0IRepVp/oyImGllFdRf9VGB+vyQbiL2640XrQhCwMzHfWrcovQquWneA6s0ygMR9Pa GJDzp26cmWRvLjyE7FmrTtvh6QYfQDVrpNWz1wYFdDGd0pEFySlny+NZsnH3b4T4WOCD S/z+o/9+rYULFfUmu1H8H5ACdMs5SulS9tbzJ+MYHBLM2pntokwXBInoPTIeqsOdQZ5C 0w8BQyWie7t5/K3dpZfQzlMiwK9VjhXMrchJhNxZ/1VUMqM5ldPwLRUexP3DVrBX2ru/ o0IQ== X-Gm-Message-State: AOJu0YyjmKphXWCEy8ExJyD2FHAhJIlN+WQhLr4sDLzCzzphB2U1xXOQ Gb30OZXHNq3ryikJ0pya7IM9RclsbP14idBECxoImxI13kDFRWgFlrlcohuHtHMz7I/XxgxEQUL Uc9rsO272QFG559qDD7SfapwWITb9vwhAgEllvTZJ50pwC4F9DWqtKEQxbdOs+SagCRDiWpeqXx WjP46hrJ0TtK6PgzkV+h82kkol312eABrI44xV/LA0 X-Gm-Gg: ASbGnctAwKY7uujId+CVV8IZ7lYul6cBGv86gvyioQ2RZWqY7ZS4Ej1YVVSA2cKrXQM k/+XwcJ0VqEXYk4c/i4pmKuZa4cAQks77hiPYWaRnE21nJkCn770TFPtSAoPORuX830m0Bfan1q H02h7sRqg0n4XSKOCGx1FI/qITm16Y6wOF8IIEby0yOPJ+NRvWWvAwn7m0PP2lY0OY2uI+L9f5s /3ojF+BYTYOunfsexBGN4rjDFOEWAexIs71blMgNBSe6sLpDmnJ+W7E1msgVljgOsIOxxCV69iC dhIBE5Nij4GgXFZmBPK+BLyEgs/iESwq/Z0RZ4csJ0rOtkF5jxF1jjjd2mut6YwBUiejhiATEut lLREIhP5NGloD9bWCswty7DScDsiNhINf1wOUYOncw6kLceEp2CnAh5RW8bRfgDmBjxb7lqLugf vwN94= X-Received: by 2002:a05:6000:1786:b0:426:fb28:7962 with SMTP id ffacd0b85a97d-429a7e86fdfmr4110812f8f.61.1761672918516; Tue, 28 Oct 2025 10:35:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGYISxoFXRWT4CSQFkij0/JYLnvkQ9ZHEUxIVRSWMIjdtVxfJZ2pB4Kvct1JEbXqJvyYeHsRg== X-Received: by 2002:a05:6000:1786:b0:426:fb28:7962 with SMTP id ffacd0b85a97d-429a7e86fdfmr4110553f8f.61.1761672916739; Tue, 28 Oct 2025 10:35:16 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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 Message-ID: <20251028173430.2180057-16-pbonzini@redhat.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251028173430.2180057-1-pbonzini@redhat.com> References: <20251028173430.2180057-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1761673111659158502 From: Mark Cave-Ayland Commit e1e2909f8e ("hw/i386/pc_piix.c: restrict isapc machine to 32-bit CPU= s") 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 x= 86 CPUs issue a deprecation warning but allow the user to continue. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Link: https://lore.kernel.org/r/20251023142926.964718-2-mark.caveayland@nut= anix.com Signed-off-by: Paolo Bonzini --- 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; =20 - /* - * There is a small chance that someone unintentionally passes "-cpu m= ax" - * 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 cons= ider - * 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 =3D X86_CPU_TYPE_NAME("pentium3"); - warn_report("-cpu max is invalid for isapc machine, using pentium3= "); - } + bool valid_cpu_type =3D false; + static const char * const valid_cpu_types[] =3D { + 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"), + }; =20 /* - * Similarly if someone unintentionally passes "-cpu host" for the isa= pc - * 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 wit= h a + * 32-bit processor. For historical reasons the machine can still acce= pt + * 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 =3D X86_CPU_TYPE_NAME("pentium3"); - warn_report("-cpu host is invalid for isapc machine, using pentium= 3"); + for (i =3D 0; i < ARRAY_SIZE(valid_cpu_types); i++) { + if (!strcmp(machine->cpu_type, valid_cpu_types[i])) { + valid_cpu_type =3D true; + } + } + + if (!valid_cpu_type) { + warn_report("cpu type %s is deprecated for isapc machine", machine= ->cpu_type); } =20 if (machine->ram_size > 3.5 * GiB) { @@ -154,18 +156,6 @@ static void pc_init_isa(MachineState *machine) =20 static void isapc_machine_options(MachineClass *m) { - static const char * const valid_cpu_types[] =3D { - 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 =3D PC_MACHINE_CLASS(m); =20 m->desc =3D "ISA-only PC"; @@ -180,7 +170,6 @@ static void isapc_machine_options(MachineClass *m) pcmc->has_reserved_memory =3D false; m->default_nic =3D "ne2k_isa"; m->default_cpu_type =3D X86_CPU_TYPE_NAME("486"); - m->valid_cpu_types =3D valid_cpu_types; m->no_floppy =3D !module_object_class_by_name(TYPE_ISA_FDC); m->no_parallel =3D !module_object_class_by_name(TYPE_ISA_PARALLEL); } --=20 2.51.1