]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu_firmware: Ignore stateless/combined when NVRAM is configured
authorAndrea Bolognani <abologna@redhat.com>
Wed, 26 Nov 2025 18:01:12 +0000 (19:01 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Thu, 8 Jan 2026 23:26:16 +0000 (00:26 +0100)
For combined firmware builds, the variable storage is part of the
same image as the executable code, whereas stateless builds don't
support variable storage at all.

In both cases, the use of a separate NVRAM storage area is not
supported, so if attributes connected to one are present in the
domain XML, firmware descriptors for stateless/combined builds
should be ignored.

ROM firmware builds are stateless by definition, so the same
handling applies to them as well.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_firmware.c

index a22853361ba12733ae5acf7f6803fce7549ce9dd..47a3987b64b1049411473b1bd1b532944ffa1b07 100644 (file)
@@ -1285,6 +1285,17 @@ qemuFirmwareMatchDomain(const virDomainDef *def,
                           flash->nvram_template.format);
                 return false;
             }
+        } else {
+            if (loader && loader->nvram &&
+                (loader->nvram->path || loader->nvram->format)) {
+                VIR_DEBUG("Discarding non split loader (nvram configured)");
+                return false;
+            }
+            if (loader &&
+                (loader->nvramTemplate || loader->nvramTemplateFormat)) {
+                VIR_DEBUG("Discarding non split loader (nvram template configured)");
+                return false;
+            }
         }
     } else if (fw->mapping.device == QEMU_FIRMWARE_DEVICE_MEMORY) {
         if (loader && loader->type &&
@@ -1302,6 +1313,17 @@ qemuFirmwareMatchDomain(const virDomainDef *def,
             VIR_DEBUG("Discarding readonly loader");
             return false;
         }
+
+        if (loader && loader->nvram &&
+            (loader->nvram->path || loader->nvram->format)) {
+            VIR_DEBUG("Discarding rom loader (nvram configured)");
+            return false;
+        }
+        if (loader &&
+            (loader->nvramTemplate || loader->nvramTemplateFormat)) {
+            VIR_DEBUG("Discarding rom loader (nvram template configured)");
+            return false;
+        }
     }
 
     if (def->sec) {