[libvirt] [PATCH 0/3] qemu: more firmware path improvements

Daniel P. Berrangé (3): m4: allow default firmware list to be empty rpm: disable default firmware list on RHEL and Fedora >= 31 qemu: stop including real paths in nvram config option libvirt.spec.in | 6 +++++- m4/virt-loader-nvram.m4 | 16 ++++++++++------ src/qemu/qemu.conf | 11 +++++------ 3 files changed, 20 insertions(+), 13 deletions(-) -- 2.20.1

Currently behaviour of --with-loader-nvram is as follows * No arg given -> use built-in default * --with-loader-nvram=STRING -> use STRING instead of built-in default * --with-loader-nvram= -> use built-in default * --without-loader-nvram -> use built-in default IOW, there is no way to disable the built-in default. We thus change the behaviour to * No arg given -> use built-in default * --with-loader-nvram=STRING -> use STRING instead of built-in default * --with-loader-nvram= -> disable built-in default * --without-loader-nvram -> disable built-in default Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- m4/virt-loader-nvram.m4 | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/m4/virt-loader-nvram.m4 b/m4/virt-loader-nvram.m4 index 0eb77fa923..9089a16f82 100644 --- a/m4/virt-loader-nvram.m4 +++ b/m4/virt-loader-nvram.m4 @@ -21,15 +21,19 @@ AC_DEFUN([LIBVIRT_ARG_LOADER_NVRAM], [ LIBVIRT_ARG_WITH([LOADER_NVRAM], [Pass list of pairs of <loader>:<nvram> paths. Both pairs and list items are separated by a colon.], - ['']) + ['builtin']) ]) AC_DEFUN([LIBVIRT_CHECK_LOADER_NVRAM], [ - if test "x$with_loader_nvram" != "xno" && \ - test "x$with_loader_nvram" != "x" ; then - l=$(echo $with_loader_nvram | tr ':' '\n' | wc -l) - if test $(expr $l % 2) -ne 0 ; then - AC_MSG_ERROR([Malformed --with-loader-nvram argument]) + if test "x$with_loader_nvram" != "xbuiltin" ; then + if test "x$with_loader_nvram" = "xno" ; then + with_loader_nvram= + fi + if test "x$with_loader_nvram" != "x" ; then + l=$(echo $with_loader_nvram | tr ':' '\n' | wc -l) + if test $(expr $l % 2) -ne 0 ; then + AC_MSG_ERROR([Malformed --with-loader-nvram argument string '$with_loader_nvram']) + fi fi AC_DEFINE_UNQUOTED([DEFAULT_LOADER_NVRAM], ["$with_loader_nvram"], [List of loader:nvram pairs]) -- 2.20.1

RHEL 7 & 8 and Fedora >= 31 are expected to ship firmware metdata files alongside any firmware binaries used for QEMU. As such we should disable the built-in paths for the nvram config variable in libvirt. At best they are duplicating information libvirt can already get from the metadata files; at worst they are simply wrong. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- libvirt.spec.in | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 18f0a0e217..a15160f211 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -1130,7 +1130,7 @@ exit 1 %define arg_selinux_mount --with-selinux-mount="/sys/fs/selinux" -%if 0%{?fedora} +%if 0%{?fedora} && 0%{?fedora} < 31 # Nightly edk2.git-ovmf-x64 LOADERS="/usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd:/usr/share/edk2.git/ovmf-x64/OVMF_VARS-pure-efi.fd" # Nightly edk2.git-ovmf-ia32 @@ -1149,6 +1149,10 @@ exit 1 # Fedora edk2-arm LOADERS="$LOADERS:/usr/share/edk2/arm/QEMU_EFI-pflash.raw:/usr/share/edk2/arm/vars-template-pflash.raw" %define arg_loader_nvram --with-loader-nvram="$LOADERS" +%else + # These distros use QEMU firmware metadata files, so + # disable libvirts built-in default nvram list + %define arg_loader_nvram --without-loader-nvram %endif # place macros above and build commands below this comment -- 2.20.1

The qemu.conf docs list paths to firmware images, but these only reflect the libvirt built-in default paths. Distros will typically override this information at built time with --with-loader-nvram. Thus the paths in the config are misleading to users. While we could subsistute in the real built-in paths are build time, since we are switching to use the firmware metadata files, this instead just uses dummy paths for illustrating the syntax. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/qemu/qemu.conf | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf index 334b4cd4ee..d157a5b058 100644 --- a/src/qemu/qemu.conf +++ b/src/qemu/qemu.conf @@ -750,13 +750,12 @@ # Later, when libvirt creates per domain variable store, this list is # searched for the master image. The UEFI firmware can be called # differently for different guest architectures. For instance, it's OVMF -# for x86_64 and i686, but it's AAVMF for aarch64. The libvirt default -# follows this scheme. +# for x86_64 and i686, but it's AAVMF for aarch64. #nvram = [ -# "/usr/share/OVMF/OVMF_CODE.fd:/usr/share/OVMF/OVMF_VARS.fd", -# "/usr/share/OVMF/OVMF_CODE.secboot.fd:/usr/share/OVMF/OVMF_VARS.fd", -# "/usr/share/AAVMF/AAVMF_CODE.fd:/usr/share/AAVMF/AAVMF_VARS.fd", -# "/usr/share/AAVMF/AAVMF32_CODE.fd:/usr/share/AAVMF/AAVMF32_VARS.fd" +# "/some/path/to/OVMF_CODE.fd:/some/path/to/OVMF_VARS.fd", +# "/some/path/to/OVMF_CODE.secboot.fd:/some/path/to/OVMF_VARS.fd", +# "/some/path/to/AAVMF_CODE.fd:/some/path/to/AAVMF_VARS.fd", +# "/some/path/to/AAVMF32_CODE.fd:/some/path/to/AAVMF32_VARS.fd" #] # The backend to use for handling stdout/stderr output from -- 2.20.1

On 4/18/19 3:39 PM, Daniel P. Berrangé wrote:
Daniel P. Berrangé (3): m4: allow default firmware list to be empty rpm: disable default firmware list on RHEL and Fedora >= 31 qemu: stop including real paths in nvram config option
libvirt.spec.in | 6 +++++- m4/virt-loader-nvram.m4 | 16 ++++++++++------ src/qemu/qemu.conf | 11 +++++------ 3 files changed, 20 insertions(+), 13 deletions(-)
ACK Michal
participants (2)
-
Daniel P. Berrangé
-
Michal Privoznik