]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Fix matching for read/write firmware
authorAndrea Bolognani <abologna@redhat.com>
Thu, 31 Jul 2025 14:50:46 +0000 (16:50 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Wed, 24 Sep 2025 12:15:26 +0000 (14:15 +0200)
We currently always pick a read-only firmware unless we are
explicitly asked for a read/write one, which is probably what
most people expect anyway but doesn't really make sense
otherwise: if no specific requirement has been provided by the
user, both read-only and read/write firmwares should be
allowed to match.

This won't result in any change in practice, since distros are
not shipping read/write builds of edk2 anyway. If they started
doing that, it would be their responsibility to ensure that
they are ordered after the read-only builds.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
src/qemu/qemu_firmware.c

index 6ead61d59c624ea0aecef83aa1bf4f9072191a18..5bd34ea87f25d8d9e4171d179e2f0b51f9b4c6c4 100644 (file)
@@ -1318,6 +1318,13 @@ qemuFirmwareMatchDomain(const virDomainDef *def,
             return false;
         }
 
+        /* Same for read-only status */
+        if (loader &&
+            loader->readonly == VIR_TRISTATE_BOOL_YES &&
+            flash->mode == QEMU_FIRMWARE_FLASH_MODE_COMBINED) {
+            VIR_DEBUG("Discarding read/write loader");
+            return false;
+        }
         if (loader &&
             loader->readonly == VIR_TRISTATE_BOOL_NO &&
             flash->mode != QEMU_FIRMWARE_FLASH_MODE_COMBINED) {