diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index ec82ee229107accc76c384c7e60129786cf3df9c..788c19c248f5c738c7f74d6cf8929aeefe5e5989 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -6969,7 +6969,8 @@ virDomainDefParserConfig virQEMUDriverDomainDefParserConfig = {
.features = VIR_DOMAIN_DEF_FEATURE_MEMORY_HOTPLUG |
VIR_DOMAIN_DEF_FEATURE_OFFLINE_VCPUPIN |
VIR_DOMAIN_DEF_FEATURE_INDIVIDUAL_VCPUS |
- VIR_DOMAIN_DEF_FEATURE_USER_ALIAS,
+ VIR_DOMAIN_DEF_FEATURE_USER_ALIAS |
+ VIR_DOMAIN_DEF_FEATURE_FW_AUTOSELECT,
};
diff --git a/tests/Makefile.am b/tests/Makefile.am
index d9b23e7a57308d2a5f0b09b6ef41028b50c77d08..d9fe65ad4e9a3e9775ac27f7b79236c521bd2f08 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -585,7 +585,9 @@ qemucpumock_la_LIBADD = $(MOCKLIBS_LIBS)
qemuxml2argvtest_SOURCES = \
qemuxml2argvtest.c testutilsqemu.c testutilsqemu.h \
- testutils.c testutils.h
+ testutils.c testutils.h \
+ virfilewrapper.c virfilewrapper.h \
+ $(NULL)
qemuxml2argvtest_LDADD = libqemutestdriver.la \
$(LDADDS) $(LIBXML_LIBS)
diff --git a/tests/qemuxml2argvdata/aarch64-os-firmware-efi.aarch64-latest.args b/tests/qemuxml2argvdata/aarch64-os-firmware-efi.aarch64-latest.args
new file mode 100644
index 0000000000000000000000000000000000000000..ab8836a3ab810af82311e2b623322dc7574a865e
--- /dev/null
+++ b/tests/qemuxml2argvdata/aarch64-os-firmware-efi.aarch64-latest.args
@@ -0,0 +1,37 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-aarch64 \
+-name guest=aarch64test,debug-threads=on \
+-S \
+-object secret,id=masterKey0,format=raw,\
+file=/tmp/lib/domain--1-aarch64test/master-key.aes \
+-machine virt-4.0,accel=tcg,usb=off,dump-guest-core=off,gic-version=2 \
+-cpu cortex-a53 \
+-drive file=/usr/share/AAVMF/AAVMF_CODE.fd,if=pflash,format=raw,unit=0,\
+readonly=on \
+-drive file=/var/lib/libvirt/qemu/nvram/aarch64test_VARS.fd,if=pflash,\
+format=raw,unit=1 \
+-m 1024 \
+-realtime mlock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid 496d7ea8-9739-544b-4ebd-ef08be936e8b \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-no-acpi \
+-boot strict=on \
+-kernel /aarch64.kernel \
+-initrd /aarch64.initrd \
+-append 'earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait' \
+-dtb /aarch64.dtb \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
+resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/aarch64-os-firmware-efi.xml b/tests/qemuxml2argvdata/aarch64-os-firmware-efi.xml
new file mode 100644
index 0000000000000000000000000000000000000000..c3e25f305260369d02916e4d7fc55f763585dc27
--- /dev/null
+++ b/tests/qemuxml2argvdata/aarch64-os-firmware-efi.xml
@@ -0,0 +1,30 @@
+
+ aarch64test
+ 496d7ea8-9739-544b-4ebd-ef08be936e8b
+ 1048576
+ 1048576
+ 1
+
+ hvm
+ /aarch64.kernel
+ /aarch64.initrd
+ earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait
+ /aarch64.dtb
+
+
+
+
+
+
+
+
+ cortex-a53
+
+
+ destroy
+ restart
+ restart
+
+ /usr/bin/qemu-system-aarch64
+
+
diff --git a/tests/qemuxml2argvdata/os-firmware-bios.x86_64-latest.args b/tests/qemuxml2argvdata/os-firmware-bios.x86_64-latest.args
new file mode 100644
index 0000000000000000000000000000000000000000..ffda40a7111c962d855040ebf2c253a57c5e9db4
--- /dev/null
+++ b/tests/qemuxml2argvdata/os-firmware-bios.x86_64-latest.args
@@ -0,0 +1,39 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-x86_64 \
+-name guest=fedora,debug-threads=on \
+-S \
+-object secret,id=masterKey0,format=raw,\
+file=/tmp/lib/domain--1-fedora/master-key.aes \
+-machine pc-q35-4.0,accel=kvm,usb=off,dump-guest-core=off \
+-bios /usr/share/seabios/bios-256k.bin \
+-m 8 \
+-realtime mlock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid 63840878-0deb-4095-97e6-fc444d9bc9fa \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-global ICH9-LPC.disable_s3=0 \
+-global ICH9-LPC.disable_s4=1 \
+-boot menu=on,strict=on \
+-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e \
+-device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x0 \
+-device ioh3420,port=0x8,chassis=3,id=pci.3,bus=pcie.0,addr=0x1 \
+-device ich9-usb-ehci1,id=usb,bus=pcie.0,addr=0x1d.0x7 \
+-device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pcie.0,multifunction=on,\
+addr=0x1d \
+-device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pcie.0,addr=0x1d.0x1 \
+-device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pcie.0,addr=0x1d.0x2 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.2,addr=0x1 \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
+resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/os-firmware-bios.xml b/tests/qemuxml2argvdata/os-firmware-bios.xml
new file mode 100644
index 0000000000000000000000000000000000000000..63886666dd57ae37d2c33b7daedbc4469429cc8e
--- /dev/null
+++ b/tests/qemuxml2argvdata/os-firmware-bios.xml
@@ -0,0 +1,68 @@
+
+ fedora
+ 63840878-0deb-4095-97e6-fc444d9bc9fa
+ 8192
+ 8192
+ 1
+
+ hvm
+
+ /var/lib/libvirt/qemu/nvram/fedora_VARS.fd
+
+
+
+
+
+
+
+
+
+ destroy
+ restart
+ restart
+
+
+
+
+
+ /usr/bin/qemu-system-x86_64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2argvdata/os-firmware-efi-secboot.x86_64-latest.args b/tests/qemuxml2argvdata/os-firmware-efi-secboot.x86_64-latest.args
new file mode 100644
index 0000000000000000000000000000000000000000..e26729ecc1edf1a7e2b3e6430fbcfc7fd42ed25b
--- /dev/null
+++ b/tests/qemuxml2argvdata/os-firmware-efi-secboot.x86_64-latest.args
@@ -0,0 +1,43 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-x86_64 \
+-name guest=fedora,debug-threads=on \
+-S \
+-object secret,id=masterKey0,format=raw,\
+file=/tmp/lib/domain--1-fedora/master-key.aes \
+-machine pc-q35-4.0,accel=kvm,usb=off,smm=on,dump-guest-core=off \
+-global driver=cfi.pflash01,property=secure,value=on \
+-drive file=/usr/share/OVMF/OVMF_CODE.secboot.fd,if=pflash,format=raw,unit=0,\
+readonly=on \
+-drive file=/var/lib/libvirt/qemu/nvram/fedora_VARS.fd,if=pflash,format=raw,\
+unit=1 \
+-m 8 \
+-realtime mlock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid 63840878-0deb-4095-97e6-fc444d9bc9fa \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-global ICH9-LPC.disable_s3=0 \
+-global ICH9-LPC.disable_s4=1 \
+-boot menu=on,strict=on \
+-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e \
+-device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x0 \
+-device ioh3420,port=0x8,chassis=3,id=pci.3,bus=pcie.0,addr=0x1 \
+-device ich9-usb-ehci1,id=usb,bus=pcie.0,addr=0x1d.0x7 \
+-device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pcie.0,multifunction=on,\
+addr=0x1d \
+-device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pcie.0,addr=0x1d.0x1 \
+-device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pcie.0,addr=0x1d.0x2 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.2,addr=0x1 \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
+resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/os-firmware-efi-secboot.xml b/tests/qemuxml2argvdata/os-firmware-efi-secboot.xml
new file mode 100644
index 0000000000000000000000000000000000000000..a285e063349b492c84cc4661522fdc1693567976
--- /dev/null
+++ b/tests/qemuxml2argvdata/os-firmware-efi-secboot.xml
@@ -0,0 +1,68 @@
+
+ fedora
+ 63840878-0deb-4095-97e6-fc444d9bc9fa
+ 8192
+ 8192
+ 1
+
+ hvm
+
+ /var/lib/libvirt/qemu/nvram/fedora_VARS.fd
+
+
+
+
+
+
+
+
+
+ destroy
+ restart
+ restart
+
+
+
+
+
+ /usr/bin/qemu-system-x86_64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2argvdata/os-firmware-efi.x86_64-latest.args b/tests/qemuxml2argvdata/os-firmware-efi.x86_64-latest.args
new file mode 100644
index 0000000000000000000000000000000000000000..c0925f1e3b48f9f5ce159a526da7fa2c88ef3827
--- /dev/null
+++ b/tests/qemuxml2argvdata/os-firmware-efi.x86_64-latest.args
@@ -0,0 +1,42 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-x86_64 \
+-name guest=fedora,debug-threads=on \
+-S \
+-object secret,id=masterKey0,format=raw,\
+file=/tmp/lib/domain--1-fedora/master-key.aes \
+-machine pc-q35-4.0,accel=kvm,usb=off,smm=on,dump-guest-core=off \
+-drive file=/usr/share/OVMF/OVMF_CODE.secboot.fd,if=pflash,format=raw,unit=0,\
+readonly=on \
+-drive file=/var/lib/libvirt/qemu/nvram/fedora_VARS.fd,if=pflash,format=raw,\
+unit=1 \
+-m 8 \
+-realtime mlock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid 63840878-0deb-4095-97e6-fc444d9bc9fa \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-global ICH9-LPC.disable_s3=0 \
+-global ICH9-LPC.disable_s4=1 \
+-boot menu=on,strict=on \
+-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e \
+-device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x0 \
+-device ioh3420,port=0x8,chassis=3,id=pci.3,bus=pcie.0,addr=0x1 \
+-device ich9-usb-ehci1,id=usb,bus=pcie.0,addr=0x1d.0x7 \
+-device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pcie.0,multifunction=on,\
+addr=0x1d \
+-device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pcie.0,addr=0x1d.0x1 \
+-device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pcie.0,addr=0x1d.0x2 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.2,addr=0x1 \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
+resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/os-firmware-efi.xml b/tests/qemuxml2argvdata/os-firmware-efi.xml
new file mode 100644
index 0000000000000000000000000000000000000000..46a7b1b780c52d60bccc19f286d42f18aef65f78
--- /dev/null
+++ b/tests/qemuxml2argvdata/os-firmware-efi.xml
@@ -0,0 +1,68 @@
+
+ fedora
+ 63840878-0deb-4095-97e6-fc444d9bc9fa
+ 8192
+ 8192
+ 1
+
+ hvm
+
+ /var/lib/libvirt/qemu/nvram/fedora_VARS.fd
+
+
+
+
+
+
+
+
+
+ destroy
+ restart
+ restart
+
+
+
+
+
+ /usr/bin/qemu-system-x86_64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index a50bd188453de4e5f238ababc4f485bb685879b3..bd9619ae389f403eb9159b5a9b0e634c04fbbf42 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -23,6 +23,8 @@
# include "virstring.h"
# include "storage/storage_driver.h"
# include "virmock.h"
+# include "virfilewrapper.h"
+# include "configmake.h"
# define LIBVIRT_QEMU_CAPSPRIV_H_ALLOW
# include "qemu/qemu_capspriv.h"
@@ -705,6 +707,9 @@ mymain(void)
VIR_FREE(driver.config->memoryBackingDir);
if (VIR_STRDUP_QUIET(driver.config->memoryBackingDir, "/var/lib/libvirt/qemu/ram") < 0)
return EXIT_FAILURE;
+ VIR_FREE(driver.config->nvramDir);
+ if (VIR_STRDUP(driver.config->nvramDir, "/var/lib/libvirt/qemu/nvram") < 0)
+ return EXIT_FAILURE;
capslatest = virHashCreate(4, virHashValueFree);
if (!capslatest)
@@ -724,6 +729,13 @@ mymain(void)
VIR_TEST_VERBOSE("\n");
+ virFileWrapperAddPrefix(SYSCONFDIR "/qemu/firmware",
+ abs_srcdir "/qemufirmwaredata/etc/qemu/firmware");
+ virFileWrapperAddPrefix(PREFIX "/share/qemu/firmware",
+ abs_srcdir "/qemufirmwaredata/usr/share/qemu/firmware");
+ virFileWrapperAddPrefix("/home/user/.config/qemu/firmware",
+ abs_srcdir "/qemufirmwaredata/home/user/.config/qemu/firmware");
+
/**
* The following set of macros allows testing of XML -> argv conversion with a
* real set of capabilities gathered from a real qemu copy. It is desired to use
@@ -3020,6 +3032,11 @@ mymain(void)
DO_TEST_CAPS_ARCH_LATEST("x86_64-pc-graphics", "x86_64");
DO_TEST_CAPS_ARCH_LATEST("x86_64-q35-graphics", "x86_64");
+ DO_TEST_CAPS_LATEST("os-firmware-bios");
+ DO_TEST_CAPS_LATEST("os-firmware-efi");
+ DO_TEST_CAPS_LATEST("os-firmware-efi-secboot");
+ DO_TEST_CAPS_ARCH_LATEST("aarch64-os-firmware-efi", "aarch64");
+
if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL)
virFileDeleteTree(fakerootdir);
diff --git a/tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.xml b/tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.xml
new file mode 120000
index 0000000000000000000000000000000000000000..beea6b29553c657b2fe38e19315000eafb63297b
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.xml
@@ -0,0 +1 @@
+../qemuxml2argvdata/aarch64-os-firmware-efi.xml
\ No newline at end of file
diff --git a/tests/qemuxml2xmloutdata/os-firmware-bios.xml b/tests/qemuxml2xmloutdata/os-firmware-bios.xml
new file mode 120000
index 0000000000000000000000000000000000000000..3d36d5df68476c845986de32d556bc548f0c78c1
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/os-firmware-bios.xml
@@ -0,0 +1 @@
+../qemuxml2argvdata/os-firmware-bios.xml
\ No newline at end of file
diff --git a/tests/qemuxml2xmloutdata/os-firmware-efi-secboot.xml b/tests/qemuxml2xmloutdata/os-firmware-efi-secboot.xml
new file mode 120000
index 0000000000000000000000000000000000000000..93e184e2d26e90d26ee5a08b69fb0e65f3dc52fd
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/os-firmware-efi-secboot.xml
@@ -0,0 +1 @@
+../qemuxml2argvdata/os-firmware-efi-secboot.xml
\ No newline at end of file
diff --git a/tests/qemuxml2xmloutdata/os-firmware-efi.xml b/tests/qemuxml2xmloutdata/os-firmware-efi.xml
new file mode 120000
index 0000000000000000000000000000000000000000..15cfad1ea05d5c0a7ac9a6f024420ae292bc8800
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/os-firmware-efi.xml
@@ -0,0 +1 @@
+../qemuxml2argvdata/os-firmware-efi.xml
\ No newline at end of file
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 3efa49811456acdc9f8fe86181ffe215d9017bc9..83a0d1cf7b6e0025c75f7011abdd6e437b2da99d 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1023,9 +1023,36 @@ mymain(void)
DO_TEST("smbios", NONE);
DO_TEST("smbios-multiple-type2", NONE);
+ DO_TEST("os-firmware-bios",
+ QEMU_CAPS_DEVICE_PCI_BRIDGE,
+ QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
+ QEMU_CAPS_DEVICE_IOH3420,
+ QEMU_CAPS_ICH9_AHCI,
+ QEMU_CAPS_ICH9_USB_EHCI1,
+ QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
+ QEMU_CAPS_DEVICE_QXL);
+ DO_TEST("os-firmware-efi",
+ QEMU_CAPS_DEVICE_PCI_BRIDGE,
+ QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
+ QEMU_CAPS_DEVICE_IOH3420,
+ QEMU_CAPS_ICH9_AHCI,
+ QEMU_CAPS_ICH9_USB_EHCI1,
+ QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
+ QEMU_CAPS_DEVICE_QXL);
+ DO_TEST("os-firmware-efi-secboot",
+ QEMU_CAPS_DEVICE_PCI_BRIDGE,
+ QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
+ QEMU_CAPS_DEVICE_IOH3420,
+ QEMU_CAPS_ICH9_AHCI,
+ QEMU_CAPS_ICH9_USB_EHCI1,
+ QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
+ QEMU_CAPS_DEVICE_QXL);
+
DO_TEST("aarch64-aavmf-virtio-mmio",
QEMU_CAPS_DEVICE_VIRTIO_MMIO,
QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
+ DO_TEST("aarch64-os-firmware-efi",
+ QEMU_CAPS_DEVICE_VIRTIO_MMIO);
DO_TEST("aarch64-virtio-pci-default",
QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
QEMU_CAPS_DEVICE_VIRTIO_MMIO,