From: Andrea Bolognani Date: Thu, 31 Jul 2025 14:50:46 +0000 (+0200) Subject: qemu: Fix matching for read/write firmware X-Git-Tag: v11.8.0-rc1~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2800ce362003c7d41d0f8414bad4fcae909ed2e0;p=thirdparty%2Flibvirt.git qemu: Fix matching for read/write firmware 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 Reviewed-by: Jim Fehlig --- 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) {