From nobody Thu Jan 8 12:14:04 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1766965225; cv=none; d=zohomail.com; s=zohoarc; b=ngSGKEd27Cl+17+yZKDveJ5O9rMBmybe83c2A27V2FVPHoEuGyuulxsKXZXg5RhtfzwhAWjlHSqDm+LwcjiOoZimPla3CHD76GZrIRcfx7sByVktC8UQtkKq6F6IZxPQOiggSfeKkg+5yxsCLKE0THuydQ5Fpn1YJh+bJMyC5nA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766965225; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=8pJmYV7JW1f35hSNw19n/7yYcL6pza1klPAqBuuRGh4=; b=l5IWj0VVBgQwStqdRzvCxTWTruGBwS4SIeUzPN1yYqNXohxyvPg0rSiR/FCdbWMfunGEcDQxalg55T1h5+yVI7Umj8G5BcM1V1R+PWr4T7VfQrw41pxfsshcSVmV8hUhiJcKaJcp7O7YQM1zMTJPAcmAg4Cng0wPXI5aQAQqSzY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1766965225906620.2897457970266; Sun, 28 Dec 2025 15:40:25 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id CF40841AAF; Sun, 28 Dec 2025 18:40:19 -0500 (EST) Received: from [172.19.199.83] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 7691E419A3; Sun, 28 Dec 2025 18:39:14 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 203DD3FD11; Sun, 28 Dec 2025 18:34:21 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id DE1E6417F2 for ; Sun, 28 Dec 2025 18:34:19 -0500 (EST) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-564-kbUQd5NTPD-AWA7oyXcX_A-1; Sun, 28 Dec 2025 18:34:18 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2D7ED1800358 for ; Sun, 28 Dec 2025 23:34:17 +0000 (UTC) Received: from harajuku.usersys.redhat.com.homenet.telecomitalia.it (unknown [10.45.224.19]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6ED0E30001A8 for ; Sun, 28 Dec 2025 23:34:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766964859; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8pJmYV7JW1f35hSNw19n/7yYcL6pza1klPAqBuuRGh4=; b=bEKUyV/hjBvhZHusDSrJ99yOldTNlGyDj2jO/aJI/gQP5tXU1f1xfOwJK4krXrNk7St3/7 A5bMwA8zsNEkml/ASmL5zDBWFqiG5HR52L3Ksl0c4qYVwwlJjft1AQgb9h9/wqQUHIJVmE y9+nEksOHoIZyxMWXpBL0oqHfA/mrxI= X-MC-Unique: kbUQd5NTPD-AWA7oyXcX_A-1 X-Mimecast-MFC-AGG-ID: kbUQd5NTPD-AWA7oyXcX_A_1766964857 To: devel@lists.libvirt.org Subject: [PATCH 01/36] qemu_firmware: Drop support for kernel descriptors Date: Mon, 29 Dec 2025 00:33:37 +0100 Message-ID: <20251228233412.1709869-2-abologna@redhat.com> In-Reply-To: <20251228233412.1709869-1-abologna@redhat.com> References: <20251228233412.1709869-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: E00D0rr34LLvov1a8V0w6o6ovyYf7BHV5-RrdJ7V8I8_1766964857 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: BRSATJU7OGFM4ONNXDIDA24LN2E4OCOW X-Message-ID-Hash: BRSATJU7OGFM4ONNXDIDA24LN2E4OCOW X-MailFrom: abologna@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Andrea Bolognani via Devel Reply-To: Andrea Bolognani X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1766965228608158500 Content-Type: text/plain; charset="utf-8"; x-default="true" I have been able to find exactly zero evidence of this type of firmware descriptor actually existing in the wild, so this is essentialy dead code. Dropping it simplifies the task of further tweaking the firmware selection code. Signed-off-by: Andrea Bolognani Reviewed-by: Michal Privoznik --- src/qemu/qemu_firmware.c | 83 ++-------------------------------------- 1 file changed, 3 insertions(+), 80 deletions(-) diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c index 5bd34ea87f..b168ec7cf7 100644 --- a/src/qemu/qemu_firmware.c +++ b/src/qemu/qemu_firmware.c @@ -92,12 +92,6 @@ struct _qemuFirmwareMappingFlash { }; =20 =20 -typedef struct _qemuFirmwareMappingKernel qemuFirmwareMappingKernel; -struct _qemuFirmwareMappingKernel { - char *filename; -}; - - typedef struct _qemuFirmwareMappingMemory qemuFirmwareMappingMemory; struct _qemuFirmwareMappingMemory { char *filename; @@ -107,7 +101,6 @@ struct _qemuFirmwareMappingMemory { typedef enum { QEMU_FIRMWARE_DEVICE_NONE =3D 0, QEMU_FIRMWARE_DEVICE_FLASH, - QEMU_FIRMWARE_DEVICE_KERNEL, QEMU_FIRMWARE_DEVICE_MEMORY, =20 QEMU_FIRMWARE_DEVICE_LAST @@ -118,7 +111,6 @@ VIR_ENUM_IMPL(qemuFirmwareDevice, QEMU_FIRMWARE_DEVICE_LAST, "", "flash", - "kernel", "memory", ); =20 @@ -129,7 +121,6 @@ struct _qemuFirmwareMapping { =20 union { qemuFirmwareMappingFlash flash; - qemuFirmwareMappingKernel kernel; qemuFirmwareMappingMemory memory; } data; }; @@ -222,13 +213,6 @@ qemuFirmwareMappingFlashFreeContent(qemuFirmwareMappin= gFlash *flash) } =20 =20 -static void -qemuFirmwareMappingKernelFreeContent(qemuFirmwareMappingKernel *kernel) -{ - g_free(kernel->filename); -} - - static void qemuFirmwareMappingMemoryFreeContent(qemuFirmwareMappingMemory *memory) { @@ -243,9 +227,6 @@ qemuFirmwareMappingFreeContent(qemuFirmwareMapping *map= ping) case QEMU_FIRMWARE_DEVICE_FLASH: qemuFirmwareMappingFlashFreeContent(&mapping->data.flash); break; - case QEMU_FIRMWARE_DEVICE_KERNEL: - qemuFirmwareMappingKernelFreeContent(&mapping->data.kernel); - break; case QEMU_FIRMWARE_DEVICE_MEMORY: qemuFirmwareMappingMemoryFreeContent(&mapping->data.memory); break; @@ -418,24 +399,6 @@ qemuFirmwareMappingFlashParse(const char *path, } =20 =20 -static int -qemuFirmwareMappingKernelParse(const char *path, - virJSONValue *doc, - qemuFirmwareMappingKernel *kernel) -{ - const char *filename; - - if (!(filename =3D virJSONValueObjectGetString(doc, "filename"))) { - VIR_DEBUG("missing 'filename' in '%s'", path); - return -1; - } - - kernel->filename =3D g_strdup(filename); - - return 0; -} - - static int qemuFirmwareMappingMemoryParse(const char *path, virJSONValue *doc, @@ -485,10 +448,6 @@ qemuFirmwareMappingParse(const char *path, if (qemuFirmwareMappingFlashParse(path, mapping, &fw->mapping.data= .flash) < 0) return -1; break; - case QEMU_FIRMWARE_DEVICE_KERNEL: - if (qemuFirmwareMappingKernelParse(path, mapping, &fw->mapping.dat= a.kernel) < 0) - return -1; - break; case QEMU_FIRMWARE_DEVICE_MEMORY: if (qemuFirmwareMappingMemoryParse(path, mapping, &fw->mapping.dat= a.memory) < 0) return -1; @@ -732,19 +691,6 @@ qemuFirmwareMappingFlashFormat(virJSONValue *mapping, } =20 =20 -static int -qemuFirmwareMappingKernelFormat(virJSONValue *mapping, - qemuFirmwareMappingKernel *kernel) -{ - if (virJSONValueObjectAppendString(mapping, - "filename", - kernel->filename) < 0) - return -1; - - return 0; -} - - static int qemuFirmwareMappingMemoryFormat(virJSONValue *mapping, qemuFirmwareMappingMemory *memory) @@ -774,10 +720,6 @@ qemuFirmwareMappingFormat(virJSONValue *doc, if (qemuFirmwareMappingFlashFormat(mapping, &fw->mapping.data.flas= h) < 0) return -1; break; - case QEMU_FIRMWARE_DEVICE_KERNEL: - if (qemuFirmwareMappingKernelFormat(mapping, &fw->mapping.data.ker= nel) < 0) - return -1; - break; case QEMU_FIRMWARE_DEVICE_MEMORY: if (qemuFirmwareMappingMemoryFormat(mapping, &fw->mapping.data.mem= ory) < 0) return -1; @@ -920,21 +862,17 @@ qemuFirmwareMatchesMachineArch(const qemuFirmware *fw, * qemuFirmwareMatchesPaths: * @fw: firmware definition * @loader: loader definition - * @kernelPath: path to kernel image * * Checks whether @fw is compatible with the information provided as * part of the domain definition. * - * Returns: true if @fw is compatible with @loader and @kernelPath, - * false otherwise + * Returns: true if @fw is compatible with @loader, false otherwise */ static bool qemuFirmwareMatchesPaths(const qemuFirmware *fw, - const virDomainLoaderDef *loader, - const char *kernelPath) + const virDomainLoaderDef *loader) { const qemuFirmwareMappingFlash *flash =3D &fw->mapping.data.flash; - const qemuFirmwareMappingKernel *kernel =3D &fw->mapping.data.kernel; const qemuFirmwareMappingMemory *memory =3D &fw->mapping.data.memory; =20 switch (fw->mapping.device) { @@ -954,11 +892,6 @@ qemuFirmwareMatchesPaths(const qemuFirmware *fw, !virFileComparePaths(loader->path, memory->filename)) return false; break; - case QEMU_FIRMWARE_DEVICE_KERNEL: - if (kernelPath && - !virFileComparePaths(kernelPath, kernel->filename)) - return false; - break; case QEMU_FIRMWARE_DEVICE_NONE: case QEMU_FIRMWARE_DEVICE_LAST: return false; @@ -1183,7 +1116,7 @@ qemuFirmwareMatchDomain(const virDomainDef *def, return false; } =20 - if (!qemuFirmwareMatchesPaths(fw, def->os.loader, def->os.kernel)) { + if (!qemuFirmwareMatchesPaths(fw, def->os.loader)) { VIR_DEBUG("No matching path in '%s'", path); return false; } @@ -1424,7 +1357,6 @@ qemuFirmwareEnableFeaturesModern(virDomainDef *def, const qemuFirmware *fw) { const qemuFirmwareMappingFlash *flash =3D &fw->mapping.data.flash; - const qemuFirmwareMappingKernel *kernel =3D &fw->mapping.data.kernel; const qemuFirmwareMappingMemory *memory =3D &fw->mapping.data.memory; virDomainLoaderDef *loader =3D NULL; virStorageFileFormat format; @@ -1482,14 +1414,6 @@ qemuFirmwareEnableFeaturesModern(virDomainDef *def, loader->path, NULLSTR(loader->nvramTemplate)); break; =20 - case QEMU_FIRMWARE_DEVICE_KERNEL: - VIR_FREE(def->os.kernel); - def->os.kernel =3D g_strdup(kernel->filename); - - VIR_DEBUG("decided on kernel '%s'", - def->os.kernel); - break; - case QEMU_FIRMWARE_DEVICE_MEMORY: if (!def->os.loader) def->os.loader =3D virDomainLoaderDefNew(); @@ -2056,7 +1980,6 @@ qemuFirmwareGetSupported(const char *machine, fwpath =3D memory->filename; break; =20 - case QEMU_FIRMWARE_DEVICE_KERNEL: case QEMU_FIRMWARE_DEVICE_NONE: case QEMU_FIRMWARE_DEVICE_LAST: break; --=20 2.52.0 From nobody Thu Jan 8 12:14:04 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1766965297; cv=none; d=zohomail.com; s=zohoarc; b=gFL6SPIeQwWXadDVLKoCn/vn6ydcRUBuaMVewonnC+DIHgDpaUcs8bwSVpvtW/qjNR2jS9hWt5H6Nn5ZqVmig1AsKKeifE2+otI1dXT7Lj+w6NVfqH2dX+SW5V5+2Z8ld0BEyMYvSHH0hdFheDrBk0ZPprrBLrj7oDEWqsOIXrI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766965297; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=38ps0/DQiBxnV3TvnW79sH4BIkWMPN0STPO2C+AVflk=; b=Cwyhq9YH+zHC+vc0z9CSH8bDobAGx5csSVCjzA0gpRmMEMQNfpk7y2HGtunkY4ucn3bDykxToKUARU+n/OC9fd1zkLZMm8HmhmZXm8gJ4rQ6LUuJUQBnu1pvUfs2RKSQOQkJKOJNrz+LGQWaMOouIl50bLWzlaXONTpKPH2FTJ4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1766965297876859.1389965323082; Sun, 28 Dec 2025 15:41:37 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id E8ABC419FF; Sun, 28 Dec 2025 18:41:24 -0500 (EST) Received: from [172.19.199.83] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 843F141A11; Sun, 28 Dec 2025 18:39:30 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 2F009417EB; Sun, 28 Dec 2025 18:34:22 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 58DB8417EB for ; Sun, 28 Dec 2025 18:34:21 -0500 (EST) Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-433-XMNElJ2KMmGdOZMMDL9RXA-1; Sun, 28 Dec 2025 18:34:19 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 952C71956050 for ; Sun, 28 Dec 2025 23:34:18 +0000 (UTC) Received: from harajuku.usersys.redhat.com.homenet.telecomitalia.it (unknown [10.45.224.19]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A91B730001B9 for ; Sun, 28 Dec 2025 23:34:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766964861; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=38ps0/DQiBxnV3TvnW79sH4BIkWMPN0STPO2C+AVflk=; b=KVnG3GwmkUsE+cH2Q3JgOiuj0iAFAr1qb6lvTjqe9R/+Gjr1S09J1wtNze3XhoQ3/HuIdt XSN+N+Lh9s5lDeHyl8jmsvoFV7BbdbOO/mbmY9jXQ5rM7qOLwpvpmct7PfLl67il8hVwIq qNsy2Uk0xMxUtYuvLVsTFVIOMLupF2Y= X-MC-Unique: XMNElJ2KMmGdOZMMDL9RXA-1 X-Mimecast-MFC-AGG-ID: XMNElJ2KMmGdOZMMDL9RXA_1766964858 To: devel@lists.libvirt.org Subject: [PATCH 02/36] qemu_firmware: Drop 'nvram' local variable Date: Mon, 29 Dec 2025 00:33:38 +0100 Message-ID: <20251228233412.1709869-3-abologna@redhat.com> In-Reply-To: <20251228233412.1709869-1-abologna@redhat.com> References: <20251228233412.1709869-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: If16x_ohelXRWxOlNPgEk2obVFFTJereMzbFN-BHT90_1766964858 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: VZGRZUYAN5VJKLLY3BRITMZSLCXUXF6F X-Message-ID-Hash: VZGRZUYAN5VJKLLY3BRITMZSLCXUXF6F X-MailFrom: abologna@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Andrea Bolognani via Devel Reply-To: Andrea Bolognani X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1766965298681158500 Content-Type: text/plain; charset="utf-8"; x-default="true" We access the NVRAM information via the 'loader' local variable throughout the file, and this is the only spot where the 'nvram' local variable exists. It makes things inconsistent and opens up the possibility of the values for 'loader' and 'nvram' going out of sync, especially after a future commit will introduce the need to set the former. Just get rid of the additional variable. Signed-off-by: Andrea Bolognani Reviewed-by: Michal Privoznik --- src/qemu/qemu_firmware.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c index b168ec7cf7..903b0a984d 100644 --- a/src/qemu/qemu_firmware.c +++ b/src/qemu/qemu_firmware.c @@ -1780,7 +1780,6 @@ qemuFirmwareFillDomain(virQEMUDriver *driver, bool abiUpdate) { virDomainLoaderDef *loader =3D def->os.loader; - virStorageSource *nvram =3D loader ? loader->nvram : NULL; bool autoSelection =3D (def->os.firmware !=3D VIR_DOMAIN_OS_DEF_FIRMWA= RE_NONE); int ret; =20 @@ -1804,13 +1803,14 @@ qemuFirmwareFillDomain(virQEMUDriver *driver, virStorageFileFormatTypeToString(loader->format)); return -1; } - if (nvram && - nvram->format && - nvram->format !=3D VIR_STORAGE_FILE_RAW && - nvram->format !=3D VIR_STORAGE_FILE_QCOW2) { + if (loader && + loader->nvram && + loader->nvram->format && + loader->nvram->format !=3D VIR_STORAGE_FILE_RAW && + loader->nvram->format !=3D VIR_STORAGE_FILE_QCOW2) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Unsupported nvram format '%1$s'"), - virStorageFileFormatTypeToString(nvram->format)); + virStorageFileFormatTypeToString(loader->nvram->for= mat)); return -1; } =20 --=20 2.52.0 From nobody Thu Jan 8 12:14:04 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1766965425; cv=none; d=zohomail.com; s=zohoarc; b=kk5AD+wkcJD2k7kCYB+me8q/AP5rt3KNMC8nx9pYJAD7ETUB4gxkLwaRKDBdogS7ossdK8CC+gu3pDTDSh0fdTcqoYqpwUBYR03AkE8l7bL24RAxXikJppExe+/ejbKpYeeLcSmD3jpYeuropQVNUPi1iHzVgI2i78ZJhVvE4jQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766965425; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=6uVPk0fo+EeDJcyR345tRh/Fw1dt+YrHPB7gV+1x76M=; b=b9jjJWn4D8TG5VVsoByYz+lYTcSTEDtnbLDbWTlgFfAQNLxm1LA3K67gnsVehorAt23atCAA+6UrFKg/cBIySIlQxHAZykUk87Srqpq/yNnLHWAn1j348WwZgjSH6N570AIvXmz4McKCg54xzgLp4cPEKRRHvca51+bAyJ+dp+U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1766965424989214.6475122097729; Sun, 28 Dec 2025 15:43:44 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 94FB241802; Sun, 28 Dec 2025 18:42:37 -0500 (EST) Received: from [172.19.199.83] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 3344041873; Sun, 28 Dec 2025 18:39:44 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 363433FD11; Sun, 28 Dec 2025 18:34:23 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 0F6DE417F3 for ; Sun, 28 Dec 2025 18:34:22 -0500 (EST) Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-435-GSkRsLR2PiWcjcEIgHMKvg-1; Sun, 28 Dec 2025 18:34:20 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 93519195608D for ; Sun, 28 Dec 2025 23:34:19 +0000 (UTC) Received: from harajuku.usersys.redhat.com.homenet.telecomitalia.it (unknown [10.45.224.19]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D53B330001A8 for ; Sun, 28 Dec 2025 23:34:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766964861; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6uVPk0fo+EeDJcyR345tRh/Fw1dt+YrHPB7gV+1x76M=; b=DG5zQLU8QGN8E42FAhH+oM5+pNub/3NYNcVHVbiuXTF9mX6zNRRb6xkJx+73uK2sWfZE4a YmF6zHxNKYC15hh65EARrdWdUALOLF+QRowY4eIw4fll6QEuN38g9jyegKeeuecEd7wqrt dgKpI/emddoH1tQYWIjwOcP5T6Dcyhs= X-MC-Unique: GSkRsLR2PiWcjcEIgHMKvg-1 X-Mimecast-MFC-AGG-ID: GSkRsLR2PiWcjcEIgHMKvg_1766964859 To: devel@lists.libvirt.org Subject: [PATCH 03/36] qemu_firmware: Move format=raw compat exception Date: Mon, 29 Dec 2025 00:33:39 +0100 Message-ID: <20251228233412.1709869-4-abologna@redhat.com> In-Reply-To: <20251228233412.1709869-1-abologna@redhat.com> References: <20251228233412.1709869-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: hcjtqk-5UuyDG4RwRdy4Vy-yAopPBw81qKoOJLw-s78_1766964859 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: NTRND4C3LHUL4JI45EDJAMSANHL4AJR4 X-Message-ID-Hash: NTRND4C3LHUL4JI45EDJAMSANHL4AJR4 X-MailFrom: abologna@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Andrea Bolognani via Devel Reply-To: Andrea Bolognani X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1766965427226158500 Content-Type: text/plain; charset="utf-8"; x-default="true" We currently apply this exception, which is critical to ensure that the correct firmware is selected when working with older VMs, in the postparse callback. Move it to the firmware selection process instead, where it should have been added in the first place. Signed-off-by: Andrea Bolognani Reviewed-by: Michal Privoznik --- src/qemu/qemu_firmware.c | 20 ++++++++++++++++++++ src/qemu/qemu_postparse.c | 17 ----------------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c index 903b0a984d..6c609ece6a 100644 --- a/src/qemu/qemu_firmware.c +++ b/src/qemu/qemu_firmware.c @@ -1783,6 +1783,26 @@ qemuFirmwareFillDomain(virQEMUDriver *driver, bool autoSelection =3D (def->os.firmware !=3D VIR_DOMAIN_OS_DEF_FIRMWA= RE_NONE); int ret; =20 + /* If we're loading an existing configuration from disk, we + * should try as hard as possible to preserve historical + * behavior. In particular, firmware autoselection being enabled + * could never have resulted, before libvirt 9.2.0, in anything + * but a raw firmware image being selected. + * + * In order to ensure that existing domains keep working even if + * a firmware descriptor for a build with a different format is + * given higher priority, explicitly add this requirement to the + * definition before performing firmware selection */ + if (!abiUpdate && autoSelection) { + if (!loader) { + def->os.loader =3D virDomainLoaderDefNew(); + loader =3D def->os.loader; + } + if (!loader->format) { + loader->format =3D VIR_STORAGE_FILE_RAW; + } + } + /* Start by performing a thorough validation of the input. * * We need to do this here because the firmware selection logic diff --git a/src/qemu/qemu_postparse.c b/src/qemu/qemu_postparse.c index 840d6a1174..8940cb09b3 100644 --- a/src/qemu/qemu_postparse.c +++ b/src/qemu/qemu_postparse.c @@ -1051,23 +1051,6 @@ qemuDomainDefBootPostParse(virDomainDef *def, { bool abiUpdate =3D !!(parseFlags & VIR_DOMAIN_DEF_PARSE_ABI_UPDATE); =20 - /* If we're loading an existing configuration from disk, we - * should try as hard as possible to preserve historical - * behavior. In particular, firmware autoselection being enabled - * could never have resulted, before libvirt 9.2.0, in anything - * but a raw firmware image being selected. - * - * In order to ensure that existing domains keep working even if - * a firmware descriptor for a build with a different format is - * given higher priority, explicitly add this requirement to the - * definition before performing firmware selection */ - if (!abiUpdate && def->os.firmware) { - if (!def->os.loader) - def->os.loader =3D virDomainLoaderDefNew(); - if (!def->os.loader->format) - def->os.loader->format =3D VIR_STORAGE_FILE_RAW; - } - /* Firmware selection can fail for a number of reasons, but the * most likely one is that the requested configuration contains * mistakes or includes constraints that are impossible to --=20 2.52.0 From nobody Thu Jan 8 12:14:04 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1766965482; cv=none; d=zohomail.com; s=zohoarc; b=aGJ4+98EyfXdYfWD9yFPb5MyEAR07m+/p3q0rwcSxAD8h9CTDcDdPlg3ZaEz5c2na6ZzQnKuoJvo3yPsPQ+PktM+9kceB3nhMZ1o8fWQQagrBOHhSO1nd7iVdu+jwK5DaH+NbrA0NF+1r9yPVVsOQIsYA93aw2FJZGzsYBV0t5o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766965482; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=9D8QA9BqDD5Q/96KV9hB9b419N53nXHfgzKaMdU1Wec=; b=ZsDKWlxt7svpkPd0KHawJnr29akNxdFV4s/6FKKZ2Q2FHBaMhT2SEJEejOxIVFlQ3GiWjUAuKUtoul1Y6yfeER/dlOuUZDTQOa7B6WveHzAnkq4S8bf96awDb11gFx1R3kTBHxS4/cO8R6WMMcrQpIrmbEGXSiXSsePIt9XDhVs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1766965482594491.02318670599334; Sun, 28 Dec 2025 15:44:42 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id A11C7418AF; Sun, 28 Dec 2025 18:43:50 -0500 (EST) Received: from [172.19.199.83] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 0CB1F41A1A; Sun, 28 Dec 2025 18:39:57 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 782573FD11; Sun, 28 Dec 2025 18:34:24 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 952E1417EB for ; Sun, 28 Dec 2025 18:34:23 -0500 (EST) Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-439-CY7VhH4OPUGLSVJr6C3DkA-1; Sun, 28 Dec 2025 18:34:21 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C62861800342 for ; Sun, 28 Dec 2025 23:34:20 +0000 (UTC) Received: from harajuku.usersys.redhat.com.homenet.telecomitalia.it (unknown [10.45.224.19]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 13C9530001A8 for ; Sun, 28 Dec 2025 23:34:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766964863; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9D8QA9BqDD5Q/96KV9hB9b419N53nXHfgzKaMdU1Wec=; b=XMFjenQkyHEG385tkf19S4sTwBChopQDbQXYcQAWO6UU2XqHLnQn7oQIsfhR9PyA0nBpzf Xl7gJlsP9QoNfuveSrMgAqs/1xjW7HWEI+YkQzd3n6FkyfCYnEKPIuzwgHDHUmvgnnm2i2 dv9a4tJu2IQ06rdOIFGzA9Ay9nA5Uk8= X-MC-Unique: CY7VhH4OPUGLSVJr6C3DkA-1 X-Mimecast-MFC-AGG-ID: CY7VhH4OPUGLSVJr6C3DkA_1766964860 To: devel@lists.libvirt.org Subject: [PATCH 04/36] qemu_firmware: Move copying of nvram.format to loader.format Date: Mon, 29 Dec 2025 00:33:40 +0100 Message-ID: <20251228233412.1709869-5-abologna@redhat.com> In-Reply-To: <20251228233412.1709869-1-abologna@redhat.com> References: <20251228233412.1709869-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: fdeuS963pzJnHU1pjdilzChKjSPDXZblOvwy6mOucYM_1766964860 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: R6SYIFHZ4OF26YIFZ5VTK3243A6QVTAY X-Message-ID-Hash: R6SYIFHZ4OF26YIFZ5VTK3243A6QVTAY X-MailFrom: abologna@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Andrea Bolognani via Devel Reply-To: Andrea Bolognani X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1766965483321158500 Content-Type: text/plain; charset="utf-8"; x-default="true" As explained in the comment that comes along with it, this code ensures that the user's preference is taken into account when nvram.format is the only information that's provided. Currently it lives in the parser, but it makes more sense for it to be together with the rest of the firmware selection code instead. Note that this move is not completely seamless: once the code is moved outside of the parser, it can no longer reliably know whether the element actually existed in the domain XML. The difference is subtle enough that the test suite is completely unaffected, and we are going to rework the handling of this scenario in a way that restores the original behavior later anyway, so it ultimately doesn't matter. Signed-off-by: Andrea Bolognani Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 18 +----------------- src/qemu/qemu_firmware.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 541dad5bdc..25494cb01a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -17823,24 +17823,8 @@ virDomainLoaderDefParseXMLLoader(virDomainLoaderDe= f *loader, { unsigned int format =3D 0; =20 - if (!loaderNode) { - /* If there is no element but the element - * was present, copy the format from the latter to the - * former. - * - * This ensures that a configuration such as - * - * - * - * - * - * behaves as expected, that is, results in a firmware build - * with format 'foo' being selected */ - if (loader->nvram) - loader->format =3D loader->nvram->format; - + if (!loaderNode) return 0; - } =20 if (virXMLPropTristateBool(loaderNode, "readonly", VIR_XML_PROP_NONE, &loader->readonly) < 0) diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c index 6c609ece6a..a22853361b 100644 --- a/src/qemu/qemu_firmware.c +++ b/src/qemu/qemu_firmware.c @@ -1783,6 +1783,21 @@ qemuFirmwareFillDomain(virQEMUDriver *driver, bool autoSelection =3D (def->os.firmware !=3D VIR_DOMAIN_OS_DEF_FIRMWA= RE_NONE); int ret; =20 + /* If there is no element but the element + * was present, copy the format from the latter to the + * former. + * + * This ensures that a configuration such as + * + * + * + * + * + * behaves as expected, that is, results in a firmware build + * with format 'foo' being selected */ + if (loader && loader->nvram && !loader->format) + loader->format =3D loader->nvram->format; + /* If we're loading an existing configuration from disk, we * should try as hard as possible to preserve historical * behavior. In particular, firmware autoselection being enabled --=20 2.52.0 From nobody Thu Jan 8 12:14:04 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1766965559; cv=none; d=zohomail.com; s=zohoarc; b=mKNXpaLUpNwvTpGENlKFi6KMpzIjCRgxnMOfsCcprBMNGSio8IjNoVzIQ9Zft4HvmzVCOy9NfuVJ6NPkgimoEd0YV5fBeBSjv/9w0rEqHIoVbxRG3keDHGK+bjhsGUeO/drfbKOB8i87KdB2moDJG/RunzAduDFTidD94UDKPvY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766965559; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=8Ffujjk7Gkepenequ6iXpyAZwPhp+3eYFyUZHE1u09Y=; b=cMnaunHXnFTJT1/mMwrdJZr60+1lQl+27AA77OdJ/ZaXt62o9eIO7BEJ8wFKSopwzxCn90fqE0n1eAERDqxDVTPqtO60haMKkqKatG3HCjLbKeD/ozP8GGwViqg8khaxMHjBFFWXC3Oqmoc2n0VlCVm+zc7o5SWw5TrmPAGitlk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 176696555940269.1369731867502; Sun, 28 Dec 2025 15:45:59 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 5549B419D0; Sun, 28 Dec 2025 18:45:23 -0500 (EST) Received: from [172.19.199.83] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id B500B41B3F; Sun, 28 Dec 2025 18:40:08 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id E3EBC417F0; Sun, 28 Dec 2025 18:34:25 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id DCB303FD11 for ; Sun, 28 Dec 2025 18:34:24 -0500 (EST) Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-497-sep9m-aiPqW1zvcT_kHQlg-1; Sun, 28 Dec 2025 18:34:22 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id F16BB1956080 for ; Sun, 28 Dec 2025 23:34:21 +0000 (UTC) Received: from harajuku.usersys.redhat.com.homenet.telecomitalia.it (unknown [10.45.224.19]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3FC3C30001A8 for ; Sun, 28 Dec 2025 23:34:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766964864; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8Ffujjk7Gkepenequ6iXpyAZwPhp+3eYFyUZHE1u09Y=; b=bBdTuadkEXnw++g5yUPAzFvUCnXIFn7YWpiy+RWRqAvcxjfZnqXkgqDK7yEpUOWThdiFOG DMKx30r6IVuUTyKKtYKrUlrDazYXJGOPlxw6MRyDCW2ydT4vz+/rNaFUcXOZvEBIs4IGbO 8ZTW4EHUHX9wCpvN+E6ISMt7SP0Uss0= X-MC-Unique: sep9m-aiPqW1zvcT_kHQlg-1 X-Mimecast-MFC-AGG-ID: sep9m-aiPqW1zvcT_kHQlg_1766964862 To: devel@lists.libvirt.org Subject: [PATCH 05/36] tests: Add firmware-manual-efi-rw-nvram Date: Mon, 29 Dec 2025 00:33:41 +0100 Message-ID: <20251228233412.1709869-6-abologna@redhat.com> In-Reply-To: <20251228233412.1709869-1-abologna@redhat.com> References: <20251228233412.1709869-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: n7jEWyZfxmKLiV1tYX_lNEUVBFKI9tBIWbe3jt9HpZ4_1766964862 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: PDIKJTZAMTCQVC76ELCQWYAWWZO3LOX4 X-Message-ID-Hash: PDIKJTZAMTCQVC76ELCQWYAWWZO3LOX4 X-MailFrom: abologna@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Andrea Bolognani via Devel Reply-To: Andrea Bolognani X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1766965561609158500 Content-Type: text/plain; charset="utf-8"; x-default="true" This test case demonstrates a flaw in the XML validation process. Read/write firmare images already contain an area dedicated to variable storage, which they use, so attempting to use a separate NVRAM file together with them should have resulted in the domain XML being rejected. The issue will be addressed in an upcoming commit. Signed-off-by: Andrea Bolognani Reviewed-by: Michal Privoznik --- ...are-manual-efi-rw-nvram.x86_64-latest.args | 37 +++++++++++++++++ ...ware-manual-efi-rw-nvram.x86_64-latest.xml | 40 +++++++++++++++++++ .../firmware-manual-efi-rw-nvram.xml | 19 +++++++++ tests/qemuxmlconftest.c | 1 + 4 files changed, 97 insertions(+) create mode 100644 tests/qemuxmlconfdata/firmware-manual-efi-rw-nvram.x86_= 64-latest.args create mode 100644 tests/qemuxmlconfdata/firmware-manual-efi-rw-nvram.x86_= 64-latest.xml create mode 100644 tests/qemuxmlconfdata/firmware-manual-efi-rw-nvram.xml diff --git a/tests/qemuxmlconfdata/firmware-manual-efi-rw-nvram.x86_64-late= st.args b/tests/qemuxmlconfdata/firmware-manual-efi-rw-nvram.x86_64-latest.= args new file mode 100644 index 0000000000..6b3eec0a27 --- /dev/null +++ b/tests/qemuxmlconfdata/firmware-manual-efi-rw-nvram.x86_64-latest.args @@ -0,0 +1,37 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/var/lib/libvirt/qemu/domain--1-guest \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/var/lib/libvirt/qemu/domain--1-guest/.local/share \ +XDG_CACHE_HOME=3D/var/lib/libvirt/qemu/domain--1-guest/.cache \ +XDG_CONFIG_HOME=3D/var/lib/libvirt/qemu/domain--1-guest/.config \ +/usr/bin/qemu-system-x86_64 \ +-name guest=3Dguest,debug-threads=3Don \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/va= r/lib/libvirt/qemu/domain--1-guest/master-key.aes"}' \ +-blockdev '{"driver":"file","filename":"/usr/share/edk2/ovmf/OVMF.combined= .fd","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":= "unmap"}' \ +-blockdev '{"node-name":"libvirt-pflash0-format","read-only":false,"driver= ":"raw","file":"libvirt-pflash0-storage"}' \ +-blockdev '{"driver":"file","filename":"/path/to/guest_VARS.fd","node-name= ":"libvirt-pflash1-storage","read-only":false}' \ +-machine pc-q35-10.0,usb=3Doff,smm=3Don,dump-guest-core=3Doff,memory-backe= nd=3Dpc.ram,pflash0=3Dlibvirt-pflash0-format,pflash1=3Dlibvirt-pflash1-stor= age,acpi=3Don \ +-accel kvm \ +-cpu qemu64 \ +-global driver=3Dcfi.pflash01,property=3Dsecure,value=3Don \ +-m size=3D1048576k \ +-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":1073741824}= ' \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid 63840878-0deb-4095-97e6-fc444d9bc9fa \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server=3Don,wait=3Doff \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-boot strict=3Don \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-global ICH9-LPC.noreboot=3Doff \ +-watchdog-action reset \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxmlconfdata/firmware-manual-efi-rw-nvram.x86_64-late= st.xml b/tests/qemuxmlconfdata/firmware-manual-efi-rw-nvram.x86_64-latest.x= ml new file mode 100644 index 0000000000..f6436df80f --- /dev/null +++ b/tests/qemuxmlconfdata/firmware-manual-efi-rw-nvram.x86_64-latest.xml @@ -0,0 +1,40 @@ + + guest + 63840878-0deb-4095-97e6-fc444d9bc9fa + 1048576 + 1048576 + 1 + + hvm + + + + = /usr/share/edk2/ovmf/OVMF.combined.fd + /path/to/guest_VARS.fd + + + + + + + + qemu64 + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + +
+ + + + +