Motivation for these changes can be found in the commit message for patch 20 ("qemu: Move firmware selection from startup to postparse") as well as [RHBZ#2161965]. Patches 01-17 are preparatory fixes/improvements/cleanups. Patches 19-20 move firmware selection from startup to postparse, and patches 21-22 clean up a bit after that change. Patch 20 in particular is significantly larger than I would have liked, but I haven't been able to come up with a way to split it while still preserving bisectability and making things clearer instead of complicating them. If anyone has ideas in this regard, please let me know! Patches 23-27 add support for choosing a firmware format, but are effectively no-op because formats other than raw are still rejected at this point. Patches 28-30 add support for QCOW2 format firmware in the QEMU driver. Patches 31-33 document the changes. [RHBZ#2161965] https://bugzilla.redhat.com/show_bug.cgi?id=2161965 Andrea Bolognani (33): docs: Fix documentation for loader.stateless attribute tests: Set nvramDir in qemuxml2xmltest tests: Rename firmware-manual-efi-rw* tests tests: Use x86_64 for all x86 firmware tests tests: Move firmware tests to CAPS_LATEST tests: Unify input files for firmware tests tests: Enable qemuxml2xml for more firmware tests tests: Add more firmware tests qemu: Introduce qemuDomainDefMachinePostParse() qemu: Introduce qemuDomainDefBootPostParse() conf: Introduce virDomainLoaderDefParseXMLLoader() conf: introduce virDomainLoaderDefNew() qemu: Add convenience local variables qemu: Only fill nvramTemplate for local sources qemu: Clear os.firmwareFeatures after autoselection qemu: Don't pick firmware that requires SMM when smm=off qemu: Don't pick firmware with unsupported format tests: Add descriptors for QCOW2 format firmware builds conf: Export virDomainDefOSValidate() qemu: Move firmware selection from startup to postparse qemu: Move qemuDomainNVRAMPathFormat() to qemu_firmware qemu: Introduce qemuFirmwareEnsureNVRAM() conf: Change handling for empty NVRAM path conf: Parse firmware format drivers: Reject unsupported firmware formats qemu: Filter firmwares based on format qemu: Propagate firmware format conf: Accept QCOW2 firmware format qemu: Add support for QCOW2 format firmware tests: Add more firmware tests docs: Document firmware format attribute news: Document changes to firmware autoselection news: Document support for QCOW2 format firmware NEWS.rst | 16 + docs/formatdomain.rst | 11 +- src/bhyve/bhyve_firmware.c | 9 +- src/conf/domain_conf.c | 123 ++++- src/conf/domain_conf.h | 2 + src/conf/domain_validate.c | 4 +- src/conf/domain_validate.h | 3 + src/conf/schemas/domaincommon.rng | 15 + src/libvirt_private.syms | 2 + src/libxl/libxl_conf.c | 9 +- src/libxl/xen_xl.c | 4 +- src/libxl/xen_xm.c | 2 +- src/qemu/qemu_domain.c | 113 +++-- src/qemu/qemu_domain.h | 5 - src/qemu/qemu_driver.c | 2 - src/qemu/qemu_firmware.c | 460 +++++++++++++----- src/qemu/qemu_firmware.h | 3 +- src/qemu/qemu_process.c | 33 +- .../share/qemu/firmware/65-ovmf-qcow2.json | 35 ++ .../share/qemu/firmware/66-aavmf-qcow2.json | 36 ++ tests/qemufirmwaretest.c | 11 +- .../firmware-auto-bios-not-stateless.xml | 4 +- .../firmware-auto-bios-nvram.xml | 6 +- ...are-auto-bios-stateless.x86_64-latest.args | 16 +- .../firmware-auto-bios-stateless.xml | 4 +- .../firmware-auto-bios.x86_64-latest.args | 16 +- tests/qemuxml2argvdata/firmware-auto-bios.xml | 4 +- ...mware-auto-efi-aarch64.aarch64-latest.args | 22 +- .../firmware-auto-efi-aarch64.xml | 4 +- ...ware-auto-efi-enrolled-keys-no-secboot.xml | 4 +- ...-auto-efi-enrolled-keys.x86_64-latest.args | 18 +- .../firmware-auto-efi-enrolled-keys.xml | 4 +- ...fi-format-loader-qcow2.x86_64-latest.args} | 24 +- ...firmware-auto-efi-format-loader-qcow2.xml} | 6 +- ...efi-format-loader-raw.aarch64-latest.args} | 5 +- ...> firmware-auto-efi-format-loader-raw.xml} | 5 +- ...auto-efi-format-mismatch.x86_64-latest.err | 1 + ... => firmware-auto-efi-format-mismatch.xml} | 7 +- ...vram-qcow2-network-nbd.x86_64-latest.args} | 22 +- ...to-efi-format-nvram-qcow2-network-nbd.xml} | 11 +- ...ormat-nvram-qcow2-path.x86_64-latest.args} | 24 +- ...ware-auto-efi-format-nvram-qcow2-path.xml} | 6 +- ...efi-format-nvram-qcow2.x86_64-latest.args} | 24 +- ... firmware-auto-efi-format-nvram-qcow2.xml} | 6 +- .../firmware-auto-efi-loader-insecure.xml | 4 +- .../firmware-auto-efi-loader-path.xml | 4 +- ...-auto-efi-loader-secure.x86_64-latest.args | 18 +- .../firmware-auto-efi-loader-secure.xml | 4 +- ...to-efi-no-enrolled-keys.x86_64-latest.args | 18 +- .../firmware-auto-efi-no-enrolled-keys.xml | 4 +- ...are-auto-efi-no-secboot.x86_64-latest.args | 18 +- .../firmware-auto-efi-no-secboot.xml | 4 +- ...re-auto-efi-nvram-file.x86_64-latest.args} | 13 +- ...5.xml => firmware-auto-efi-nvram-file.xml} | 9 +- ...fi-nvram-network-iscsi.x86_64-latest.args} | 16 +- ...firmware-auto-efi-nvram-network-iscsi.xml} | 9 +- ...-efi-nvram-network-nbd.x86_64-latest.args} | 16 +- ...> firmware-auto-efi-nvram-network-nbd.xml} | 9 +- ...firmware-auto-efi-nvram.x86_64-latest.args | 18 +- .../firmware-auto-efi-nvram.xml | 6 +- ...rmware-auto-efi-secboot.x86_64-latest.args | 18 +- .../firmware-auto-efi-secboot.xml | 4 +- ...mware-auto-efi-smm-off.x86_64-latest.args} | 17 +- ...-efi.xml => firmware-auto-efi-smm-off.xml} | 5 +- ...ware-auto-efi-stateless.x86_64-latest.args | 16 +- .../firmware-auto-efi-stateless.xml | 4 +- .../firmware-auto-efi.x86_64-latest.args | 18 +- tests/qemuxml2argvdata/firmware-auto-efi.xml | 4 +- ...nual-bios-not-stateless.x86_64-latest.err} | 0 .../firmware-manual-bios-not-stateless.xml | 8 +- .../firmware-manual-bios-stateless.args | 30 -- ...-manual-bios-stateless.x86_64-latest.args} | 12 +- .../firmware-manual-bios-stateless.xml | 8 +- .../firmware-manual-bios.args | 30 -- ...> firmware-manual-bios.x86_64-latest.args} | 12 +- .../qemuxml2argvdata/firmware-manual-bios.xml | 8 +- ...nual-efi-acpi-aarch64.aarch64-latest.args} | 11 +- .../firmware-manual-efi-acpi-aarch64.xml | 6 +- ...re-manual-efi-acpi-q35.x86_64-latest.args} | 11 +- .../firmware-manual-efi-acpi-q35.xml | 6 +- .../firmware-manual-efi-features.xml | 6 +- ...ware-manual-efi-no-path.x86_64-latest.err} | 0 .../firmware-manual-efi-no-path.xml | 6 +- ...al-efi-noacpi-aarch64.aarch64-latest.args} | 11 +- .../firmware-manual-efi-noacpi-aarch64.xml | 6 +- ...e-manual-efi-noacpi-q35.x86_64-latest.err} | 0 .../firmware-manual-efi-noacpi-q35.xml | 6 +- ...e-manual-efi-nvram-file.x86_64-latest.args | 18 +- .../firmware-manual-efi-nvram-file.xml | 8 +- ...efi-nvram-network-iscsi.x86_64-latest.args | 16 +- ...irmware-manual-efi-nvram-network-iscsi.xml | 6 +- ...l-efi-nvram-network-nbd.x86_64-latest.args | 16 +- .../firmware-manual-efi-nvram-network-nbd.xml | 6 +- .../firmware-manual-efi-nvram-stateless.xml | 8 +- ...re-manual-efi-nvram-template-stateless.xml | 6 +- ...nual-efi-nvram-template.x86_64-latest.args | 18 +- .../firmware-manual-efi-nvram-template.xml | 6 +- ...manual-efi-rw-implicit.x86_64-latest.args} | 18 +- ...ml => firmware-manual-efi-rw-implicit.xml} | 8 +- ...firmware-manual-efi-rw.x86_64-latest.args} | 18 +- ...bios-rw.xml => firmware-manual-efi-rw.xml} | 8 +- .../firmware-manual-efi-secure.args | 35 -- ...ware-manual-efi-secure.x86_64-latest.args} | 20 +- .../firmware-manual-efi-secure.xml | 8 +- ...re-manual-efi-stateless.x86_64-latest.args | 16 +- .../firmware-manual-efi-stateless.xml | 6 +- .../qemuxml2argvdata/firmware-manual-efi.args | 32 -- ...=> firmware-manual-efi.x86_64-latest.args} | 13 +- .../qemuxml2argvdata/firmware-manual-efi.xml | 8 +- ...ual-noefi-acpi-aarch64.aarch64-latest.err} | 0 .../firmware-manual-noefi-acpi-aarch64.xml | 4 +- ...-manual-noefi-acpi-q35.x86_64-latest.args} | 9 +- .../firmware-manual-noefi-acpi-q35.xml | 4 +- ...-noefi-noacpi-aarch64.aarch64-latest.args} | 9 +- .../firmware-manual-noefi-noacpi-aarch64.xml | 4 +- ...anual-noefi-noacpi-q35.x86_64-latest.args} | 9 +- .../firmware-manual-noefi-noacpi-q35.xml | 4 +- .../virtio-iommu-aarch64.aarch64-latest.args | 8 +- tests/qemuxml2argvtest.c | 51 +- .../aarch64-virt-graphics.aarch64-latest.xml | 2 +- .../aarch64-virt-headless.aarch64-latest.xml | 2 +- ...ware-auto-bios-stateless.x86_64-latest.xml | 10 +- .../firmware-auto-bios.x86_64-latest.xml | 9 +- ...rmware-auto-efi-aarch64.aarch64-latest.xml | 8 +- ...e-auto-efi-enrolled-keys.x86_64-latest.xml | 15 +- ...efi-format-loader-qcow2.x86_64-latest.xml} | 11 +- ...-efi-format-loader-raw.aarch64-latest.xml} | 8 +- ...nvram-qcow2-network-nbd.x86_64-latest.xml} | 10 +- ...format-nvram-qcow2-path.x86_64-latest.xml} | 11 +- ...-efi-format-nvram-qcow2.x86_64-latest.xml} | 11 +- ...e-auto-efi-loader-secure.x86_64-latest.xml | 12 +- ...uto-efi-no-enrolled-keys.x86_64-latest.xml | 13 +- ...ware-auto-efi-no-secboot.x86_64-latest.xml | 13 +- ...are-auto-efi-nvram-file.x86_64-latest.xml} | 10 +- ...efi-nvram-network-iscsi.x86_64-latest.xml} | 6 +- ...o-efi-nvram-network-nbd.x86_64-latest.xml} | 6 +- .../firmware-auto-efi-nvram.x86_64-latest.xml | 12 +- ...irmware-auto-efi-secboot.x86_64-latest.xml | 14 +- ...rmware-auto-efi-smm-off.x86_64-latest.xml} | 12 +- ...ware-auto-efi-stateless.x86_64-latest.xml} | 10 +- .../firmware-auto-efi.x86_64-latest.xml | 11 +- ...e-manual-bios-stateless.x86_64-latest.xml} | 11 +- ...=> firmware-manual-bios.x86_64-latest.xml} | 11 +- ...anual-efi-acpi-aarch64.aarch64-latest.xml} | 8 +- ...are-manual-efi-acpi-q35.x86_64-latest.xml} | 13 +- ...ual-efi-noacpi-aarch64.aarch64-latest.xml} | 9 +- ...re-manual-efi-nvram-file.x86_64-latest.xml | 10 +- ...-efi-nvram-network-iscsi.x86_64-latest.xml | 6 +- ...al-efi-nvram-network-nbd.x86_64-latest.xml | 6 +- ...nual-efi-nvram-template.x86_64-latest.xml} | 10 +- ...-manual-efi-rw-implicit.x86_64-latest.xml} | 11 +- ... firmware-manual-efi-rw.x86_64-latest.xml} | 11 +- ...mware-manual-efi-secure.x86_64-latest.xml} | 14 +- ...re-manual-efi-stateless.x86_64-latest.xml} | 11 +- ... => firmware-manual-efi.x86_64-latest.xml} | 11 +- ...e-manual-noefi-acpi-q35.x86_64-latest.xml} | 10 +- ...l-noefi-noacpi-aarch64.aarch64-latest.xml} | 7 +- ...manual-noefi-noacpi-q35.x86_64-latest.xml} | 13 +- .../virtio-iommu-aarch64.aarch64-latest.xml | 4 +- tests/qemuxml2xmltest.c | 32 +- 160 files changed, 1408 insertions(+), 990 deletions(-) create mode 100644 tests/qemufirmwaredata/usr/share/qemu/firmware/65-ovmf-qcow2.json create mode 100644 tests/qemufirmwaredata/usr/share/qemu/firmware/66-aavmf-qcow2.json copy tests/qemuxml2argvdata/{firmware-auto-efi-no-enrolled-keys.x86_64-latest.args => firmware-auto-efi-format-loader-qcow2.x86_64-latest.args} (61%) copy tests/qemuxml2argvdata/{firmware-auto-efi-stateless.xml => firmware-auto-efi-format-loader-qcow2.xml} (81%) copy tests/qemuxml2argvdata/{virtio-iommu-aarch64.aarch64-latest.args => firmware-auto-efi-format-loader-raw.aarch64-latest.args} (89%) copy tests/qemuxml2argvdata/{firmware-auto-efi-aarch64.xml => firmware-auto-efi-format-loader-raw.xml} (79%) create mode 100644 tests/qemuxml2argvdata/firmware-auto-efi-format-mismatch.x86_64-latest.err copy tests/qemuxml2argvdata/{firmware-auto-efi-nvram.xml => firmware-auto-efi-format-mismatch.xml} (75%) copy tests/qemuxml2argvdata/{firmware-manual-efi-nvram-network-nbd.x86_64-latest.args => firmware-auto-efi-format-nvram-qcow2-network-nbd.x86_64-latest.args} (61%) copy tests/qemuxml2argvdata/{firmware-manual-efi-nvram-network-nbd.xml => firmware-auto-efi-format-nvram-qcow2-network-nbd.xml} (63%) copy tests/qemuxml2argvdata/{firmware-auto-efi-no-enrolled-keys.x86_64-latest.args => firmware-auto-efi-format-nvram-qcow2-path.x86_64-latest.args} (58%) copy tests/qemuxml2argvdata/{firmware-auto-efi-nvram.xml => firmware-auto-efi-format-nvram-qcow2-path.xml} (76%) copy tests/qemuxml2argvdata/{firmware-auto-efi-no-enrolled-keys.x86_64-latest.args => firmware-auto-efi-format-nvram-qcow2.x86_64-latest.args} (61%) copy tests/qemuxml2argvdata/{firmware-auto-efi-loader-secure.xml => firmware-auto-efi-format-nvram-qcow2.xml} (81%) copy tests/qemuxml2argvdata/{firmware-manual-efi-acpi-q35.args => firmware-auto-efi-nvram-file.x86_64-latest.args} (63%) copy tests/qemuxml2argvdata/{firmware-manual-noefi-acpi-q35.xml => firmware-auto-efi-nvram-file.xml} (60%) copy tests/qemuxml2argvdata/{firmware-manual-efi-nvram-network-iscsi.x86_64-latest.args => firmware-auto-efi-nvram-network-iscsi.x86_64-latest.args} (77%) copy tests/qemuxml2argvdata/{firmware-manual-efi-nvram-network-iscsi.xml => firmware-auto-efi-nvram-network-iscsi.xml} (73%) copy tests/qemuxml2argvdata/{firmware-manual-efi-nvram-network-nbd.x86_64-latest.args => firmware-auto-efi-nvram-network-nbd.x86_64-latest.args} (72%) copy tests/qemuxml2argvdata/{firmware-manual-efi-nvram-network-nbd.xml => firmware-auto-efi-nvram-network-nbd.xml} (67%) copy tests/qemuxml2argvdata/{virtio-iommu-aarch64.aarch64-latest.args => firmware-auto-efi-smm-off.x86_64-latest.args} (67%) copy tests/qemuxml2argvdata/{firmware-auto-efi.xml => firmware-auto-efi-smm-off.xml} (82%) rename tests/qemuxml2argvdata/{firmware-manual-bios-not-stateless.err => firmware-manual-bios-not-stateless.x86_64-latest.err} (100%) delete mode 100644 tests/qemuxml2argvdata/firmware-manual-bios-stateless.args copy tests/qemuxml2argvdata/{firmware-manual-noefi-noacpi-q35.args => firmware-manual-bios-stateless.x86_64-latest.args} (60%) delete mode 100644 tests/qemuxml2argvdata/firmware-manual-bios.args copy tests/qemuxml2argvdata/{firmware-manual-noefi-noacpi-q35.args => firmware-manual-bios.x86_64-latest.args} (60%) rename tests/qemuxml2argvdata/{firmware-manual-efi-acpi-aarch64.args => firmware-manual-efi-acpi-aarch64.aarch64-latest.args} (62%) copy tests/qemuxml2argvdata/{firmware-manual-efi-acpi-q35.args => firmware-manual-efi-acpi-q35.x86_64-latest.args} (64%) rename tests/qemuxml2argvdata/{firmware-manual-efi-no-path.err => firmware-manual-efi-no-path.x86_64-latest.err} (100%) rename tests/qemuxml2argvdata/{firmware-manual-efi-noacpi-aarch64.args => firmware-manual-efi-noacpi-aarch64.aarch64-latest.args} (62%) rename tests/qemuxml2argvdata/{firmware-manual-efi-noacpi-q35.err => firmware-manual-efi-noacpi-q35.x86_64-latest.err} (100%) rename tests/qemuxml2argvdata/{firmware-manual-bios-rw.x86_64-latest.args => firmware-manual-efi-rw-implicit.x86_64-latest.args} (57%) rename tests/qemuxml2argvdata/{firmware-manual-bios-rw-implicit.xml => firmware-manual-efi-rw-implicit.xml} (60%) rename tests/qemuxml2argvdata/{firmware-manual-bios-rw-implicit.x86_64-latest.args => firmware-manual-efi-rw.x86_64-latest.args} (57%) rename tests/qemuxml2argvdata/{firmware-manual-bios-rw.xml => firmware-manual-efi-rw.xml} (59%) delete mode 100644 tests/qemuxml2argvdata/firmware-manual-efi-secure.args copy tests/qemuxml2argvdata/{firmware-auto-efi-nvram.x86_64-latest.args => firmware-manual-efi-secure.x86_64-latest.args} (70%) delete mode 100644 tests/qemuxml2argvdata/firmware-manual-efi.args rename tests/qemuxml2argvdata/{firmware-manual-efi-acpi-q35.args => firmware-manual-efi.x86_64-latest.args} (63%) rename tests/qemuxml2argvdata/{firmware-manual-noefi-acpi-aarch64.err => firmware-manual-noefi-acpi-aarch64.aarch64-latest.err} (100%) rename tests/qemuxml2argvdata/{firmware-manual-noefi-acpi-q35.args => firmware-manual-noefi-acpi-q35.x86_64-latest.args} (63%) rename tests/qemuxml2argvdata/{firmware-manual-noefi-noacpi-aarch64.args => firmware-manual-noefi-noacpi-aarch64.aarch64-latest.args} (60%) rename tests/qemuxml2argvdata/{firmware-manual-noefi-noacpi-q35.args => firmware-manual-noefi-noacpi-q35.x86_64-latest.args} (64%) copy tests/qemuxml2xmloutdata/{firmware-auto-efi-loader-secure.x86_64-latest.xml => firmware-auto-efi-format-loader-qcow2.x86_64-latest.xml} (74%) copy tests/qemuxml2xmloutdata/{firmware-auto-efi-aarch64.aarch64-latest.xml => firmware-auto-efi-format-loader-raw.aarch64-latest.xml} (74%) copy tests/qemuxml2xmloutdata/{firmware-manual-efi-nvram-network-nbd.x86_64-latest.xml => firmware-auto-efi-format-nvram-qcow2-network-nbd.x86_64-latest.xml} (76%) copy tests/qemuxml2xmloutdata/{firmware-auto-efi-loader-secure.x86_64-latest.xml => firmware-auto-efi-format-nvram-qcow2-path.x86_64-latest.xml} (75%) copy tests/qemuxml2xmloutdata/{firmware-auto-efi-loader-secure.x86_64-latest.xml => firmware-auto-efi-format-nvram-qcow2.x86_64-latest.xml} (74%) copy tests/qemuxml2xmloutdata/{firmware-manual-efi-nvram-file.x86_64-latest.xml => firmware-auto-efi-nvram-file.x86_64-latest.xml} (78%) copy tests/qemuxml2xmloutdata/{firmware-manual-efi-nvram-network-iscsi.x86_64-latest.xml => firmware-auto-efi-nvram-network-iscsi.x86_64-latest.xml} (89%) copy tests/qemuxml2xmloutdata/{firmware-manual-efi-nvram-network-nbd.x86_64-latest.xml => firmware-auto-efi-nvram-network-nbd.x86_64-latest.xml} (88%) copy tests/qemuxml2xmloutdata/{firmware-auto-efi-loader-secure.x86_64-latest.xml => firmware-auto-efi-smm-off.x86_64-latest.xml} (75%) copy tests/qemuxml2xmloutdata/{firmware-auto-bios-stateless.x86_64-latest.xml => firmware-auto-efi-stateless.x86_64-latest.xml} (82%) rename tests/qemuxml2xmloutdata/{firmware-manual-bios-stateless.xml => firmware-manual-bios-stateless.x86_64-latest.xml} (69%) rename tests/qemuxml2xmloutdata/{firmware-manual-bios.xml => firmware-manual-bios.x86_64-latest.xml} (69%) copy tests/qemuxml2xmloutdata/{firmware-auto-efi-aarch64.aarch64-latest.xml => firmware-manual-efi-acpi-aarch64.aarch64-latest.xml} (76%) copy tests/qemuxml2xmloutdata/{firmware-auto-efi-loader-secure.x86_64-latest.xml => firmware-manual-efi-acpi-q35.x86_64-latest.xml} (76%) copy tests/qemuxml2xmloutdata/{firmware-auto-efi-aarch64.aarch64-latest.xml => firmware-manual-efi-noacpi-aarch64.aarch64-latest.xml} (76%) copy tests/qemuxml2xmloutdata/{firmware-manual-efi-nvram-file.x86_64-latest.xml => firmware-manual-efi-nvram-template.x86_64-latest.xml} (78%) copy tests/qemuxml2xmloutdata/{firmware-manual-efi-nvram-file.x86_64-latest.xml => firmware-manual-efi-rw-implicit.x86_64-latest.xml} (72%) copy tests/qemuxml2xmloutdata/{firmware-manual-efi-nvram-file.x86_64-latest.xml => firmware-manual-efi-rw.x86_64-latest.xml} (72%) copy tests/qemuxml2xmloutdata/{firmware-auto-efi-loader-secure.x86_64-latest.xml => firmware-manual-efi-secure.x86_64-latest.xml} (73%) copy tests/qemuxml2xmloutdata/{firmware-manual-efi-nvram-file.x86_64-latest.xml => firmware-manual-efi-stateless.x86_64-latest.xml} (72%) rename tests/qemuxml2xmloutdata/{firmware-manual-efi.xml => firmware-manual-efi.x86_64-latest.xml} (70%) copy tests/qemuxml2xmloutdata/{firmware-auto-efi.x86_64-latest.xml => firmware-manual-noefi-acpi-q35.x86_64-latest.xml} (86%) copy tests/qemuxml2xmloutdata/{firmware-auto-efi-aarch64.aarch64-latest.xml => firmware-manual-noefi-noacpi-aarch64.aarch64-latest.xml} (88%) copy tests/qemuxml2xmloutdata/{firmware-auto-efi.x86_64-latest.xml => firmware-manual-noefi-noacpi-q35.x86_64-latest.xml} (83%) -- 2.39.1