From nobody Sun Oct 12 16:25:15 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=none dis=none) header.from=randomman.co.uk ARC-Seal: i=1; a=rsa-sha256; t=1749823878; cv=none; d=zohomail.com; s=zohoarc; b=PcJEC61iRX58Epwq3TViBZHf2zZvDyuws9tfu4IENw8O4vo4jRDjCeghBCDZKs800mJMC5JpiVFBSD3i4U24I0/eg9mG1Tk0CreA7fgq9MzWmObGQSnuvSuHK/6qPmXbU1s3op8H0KpOBdrRALlUV58KTkBy/9Y/f+UqMc+kIv8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749823878; 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=tZMKlaN7fczHOhzhVmHGnLtz8u3QhfWidB0hAdbpUMY=; b=bwtKl6LW3yc8hjLsEXCbH5WQFEsLeaPyI/VKCgHMS1NtCvkGXjb6r7Rwsq80YSmEF8tCkQHjD+bv3KZ4uEkkvrkMQMCr4HGdxFt7f71FYNlW2U/rDECEdqhaS7s44henL+hVgJkC3eY57sjJbvpQhwfBCIeMrlZ7Z9xi9CyjsPI= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17498238785921006.2637564420739; Fri, 13 Jun 2025 07:11:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uQ57g-0000Lj-TA; Fri, 13 Jun 2025 10:11:13 -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 1uQ57b-0008Eh-Ae for qemu-devel@nongnu.org; Fri, 13 Jun 2025 10:11:07 -0400 Received: from smtp-out-60.livemail.co.uk ([213.171.216.60] helo=dkim.livemail.co.uk) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uQ57Y-0002AK-0H for qemu-devel@nongnu.org; Fri, 13 Jun 2025 10:11:07 -0400 Received: from smtp.livemail.co.uk (unknown [10.44.132.81]) by dkim.livemail.co.uk (Postfix) with ESMTPS id 4C065201AB; Fri, 13 Jun 2025 15:11:01 +0100 (BST) Received: from localhost.localdomain (unknown [145.40.191.116]) (Authenticated sender: roy.hopkins@randomman.co.uk) by smtp.livemail.co.uk (Postfix) with ESMTPSA id B8EAE4032A; Fri, 13 Jun 2025 15:10:56 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=randomman.co.uk; s=livemail2; t=1749823861; bh=ihgXP9VYIPe7IIMnaZhSQ3ipe9TIN+zvA+5AW5ZG/9Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S5Rz9owM0PzOTOl7X0Digu73Sf0CDKW0PsMty1UjYD/ZtOuBhQQaslfVT0A65TLZZ YEmTOBIk6uLZVMYqhLgHFxypyHCIV3sNL5QkH6LrRYs/obil1nyvoGnmkeXcJ55Q8j ZYlGFtA66zeprIvm4Uk0jUblwxEnFRyyZWUcWdAo= From: Roy Hopkins To: qemu-devel@nongnu.org Cc: Roy Hopkins , Paolo Bonzini , "Daniel P . Berrange" , Stefano Garzarella , Marcelo Tosatti , "Michael S . Tsirkin" , Cornelia Huck , Marcel Apfelbaum , Sergio Lopez , Eduardo Habkost , Alistair Francis , Peter Xu , David Hildenbrand , Igor Mammedov , Tom Lendacky , Michael Roth , Ani Sinha , Gerd Hoffman , Pankaj Gupta , Joerg Roedel Subject: [PATCH v8 05/16] i386/pc_sysfw: Ensure sysfw flash configuration does not conflict with IGVM Date: Fri, 13 Jun 2025 14:53:20 +0100 Message-ID: <7d5eee4ba03ad11b1ee6d32fea96b160b4d3931c.1749820158.git.roy.hopkins@randomman.co.uk> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: 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=213.171.216.60; envelope-from=roy.hopkins@randomman.co.uk; helo=dkim.livemail.co.uk 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, 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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=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 @randomman.co.uk) X-ZM-MESSAGEID: 1749823880514116600 When using an IGVM file the configuration of the system firmware is defined by IGVM directives contained in the file. In this case the user should not configure any pflash devices. This commit skips initialization of the ROM mode when pflash0 is not set then checks to ensure no pflash devices have been configured when using IGVM, exiting with an error message if this is not the case. Signed-off-by: Roy Hopkins Acked-by: Gerd Hoffman Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Michael S. Tsirkin Reviewed-by: Stefano Garzarella Reviewed-by: Pankaj Gupta --- hw/i386/pc_sysfw.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c index 821396c16e..1a12b635ad 100644 --- a/hw/i386/pc_sysfw.c +++ b/hw/i386/pc_sysfw.c @@ -220,7 +220,13 @@ void pc_system_firmware_init(PCMachineState *pcms, BlockBackend *pflash_blk[ARRAY_SIZE(pcms->flash)]; =20 if (!pcmc->pci_enabled) { - x86_bios_rom_init(X86_MACHINE(pcms), "bios.bin", rom_memory, true); + /* + * If an IGVM file is specified then the firmware must be provided + * in the IGVM file. + */ + if (!X86_MACHINE(pcms)->igvm) { + x86_bios_rom_init(X86_MACHINE(pcms), "bios.bin", rom_memory, t= rue); + } return; } =20 @@ -240,8 +246,13 @@ void pc_system_firmware_init(PCMachineState *pcms, } =20 if (!pflash_blk[0]) { - /* Machine property pflash0 not set, use ROM mode */ - x86_bios_rom_init(X86_MACHINE(pcms), "bios.bin", rom_memory, false= ); + /* + * Machine property pflash0 not set, use ROM mode unless using IGV= M, + * in which case the firmware must be provided by the IGVM file. + */ + if (!X86_MACHINE(pcms)->igvm) { + x86_bios_rom_init(X86_MACHINE(pcms), "bios.bin", rom_memory, f= alse); + } } else { if (kvm_enabled() && !kvm_readonly_mem_enabled()) { /* @@ -257,6 +268,20 @@ void pc_system_firmware_init(PCMachineState *pcms, } =20 pc_system_flash_cleanup_unused(pcms); + + /* + * The user should not have specified any pflash devices when using IG= VM + * to configure the guest. + */ + if (X86_MACHINE(pcms)->igvm) { + for (i =3D 0; i < ARRAY_SIZE(pcms->flash); i++) { + if (pcms->flash[i]) { + error_report("pflash devices cannot be configured when " + "using IGVM"); + exit(1); + } + } + } } =20 void x86_firmware_configure(hwaddr gpa, void *ptr, int size) --=20 2.43.0