[PATCH v2 06/10] qemu: Fix matching for read/write firmware

Andrea Bolognani via Devel posted 10 patches 1 week, 5 days ago
[PATCH v2 06/10] qemu: Fix matching for read/write firmware
Posted by Andrea Bolognani via Devel 1 week, 5 days ago
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>
---
 src/qemu/qemu_firmware.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c
index 6ead61d59c..5bd34ea87f 100644
--- a/src/qemu/qemu_firmware.c
+++ b/src/qemu/qemu_firmware.c
@@ -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) {
-- 
2.51.0
Re: [PATCH v2 06/10] qemu: Fix matching for read/write firmware
Posted by Jim Fehlig via Devel 1 week, 2 days ago
On 8/25/25 10:19, Andrea Bolognani via Devel wrote:
> 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>
> ---
>   src/qemu/qemu_firmware.c | 7 +++++++
>   1 file changed, 7 insertions(+)

Reviewed-by: Jim Fehlig <jfehlig@suse.com>

Regards,
Jim