From nobody Thu May 2 22:09:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1573490560; cv=none; d=zoho.com; s=zohoarc; b=b1dd/3JX8TIeWYRjlSnMQbjSYLnFCC3dhqNXfiuvFhAd3vK23zQwiaS/8L7z3zmaty7MLXvNlZsKxBmUyXBKrvsv1IIkjyw6dyj5XYDMibFJ44kjdBvhDZkGqx3EOWA5SW6iehSbQJTYtyht9aU7ar1vSBZ6ItEnwOoBQxLe3Ys= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573490560; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=uFgUC5XGnMKCAahOZkM4eG28M797jj5f/YNibouNqio=; b=dB1mjYT5d8+8JLEsN29hXcY5D8TwDYVSiRrVYjf3up9/VfmpnNAhYQTofVd1jsm+YS4L0Vouah5yJmKEoFu0Itz/i1xoXvtG3fN9yG/aYz3XYvGq0BTuHl8/qjSJNUz46X+d9FdDrWGeyHs7vKxqKxsU8ew93GWorqrjNwt4VkY= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1573490560016228.02399302191316; Mon, 11 Nov 2019 08:42:40 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-284-bzUhvXsgPmO3keeAlQyrCQ-1; Mon, 11 Nov 2019 11:42:37 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7454C801E65; Mon, 11 Nov 2019 16:42:32 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D5DC428DC0; Mon, 11 Nov 2019 16:42:31 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 12CE5183269C; Mon, 11 Nov 2019 16:42:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xABGgSbu028931 for ; Mon, 11 Nov 2019 11:42:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id 30FF21B42C; Mon, 11 Nov 2019 16:42:28 +0000 (UTC) Received: from moe.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id AF7F25E242 for ; Mon, 11 Nov 2019 16:42:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573490558; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=uFgUC5XGnMKCAahOZkM4eG28M797jj5f/YNibouNqio=; b=RZV/InD4fQ/o7GqkRiOg/2eT5EP0WMJkiZ5XwXaDHrKSpNMVXvLtfWfcOWE1bmNk1Hrxv/ nkrbd6C1DZaHTOkRNPcWqLkEmteD3Dg1gkmLJxvlF3JkP2DxfX+hCkkTYM4pd98x0tnFLR 3/6CvdIL52PnN9wZ7EEJgk22IQQW/Y8= From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 11 Nov 2019 17:42:17 +0100 Message-Id: <5a4a2b7d580a3aa232ae671e002b06ea241df9ee.1573490537.git.mprivozn@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] qemu: Warn verbosely if using old loader:nvram pairs X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: bzUhvXsgPmO3keeAlQyrCQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" There are two ways for specifying loader:nvram pairs: 1) --with-loader-nvram configure option 2) nvram variable in qemu.conf Since we have FW descriptors, using this old style is discouraged, but not as strong as one would expect. Produce more warnings: 1) produce a warning if somebody tries the configure option 2) produce a warning if somebody sets nvram variable and at least on FW descriptor was found The reason for producing warning in case 1) is that package maintainers, who set the configure option in the first place should start moving towards FW descriptors and abandon the configure option. After all, the warning is printed into config output only in this case. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1763477 Signed-off-by: Michal Privoznik Reviewed-by: Daniel P. Berrang=C3=A9 --- m4/virt-loader-nvram.m4 | 10 +++++++++- src/qemu/qemu.conf | 3 +++ src/qemu/qemu_conf.c | 19 +++++++++++++++++-- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/m4/virt-loader-nvram.m4 b/m4/virt-loader-nvram.m4 index d7e0c8ca18..ed2ae0cf27 100644 --- a/m4/virt-loader-nvram.m4 +++ b/m4/virt-loader-nvram.m4 @@ -30,6 +30,8 @@ AC_DEFUN([LIBVIRT_CHECK_LOADER_NVRAM], [ l=3D$(echo $with_loader_nvram | tr ':' '\n' | wc -l) if test $(expr $l % 2) -ne 0 ; then AC_MSG_ERROR([Malformed --with-loader-nvram argument]) + elif test $l -gt 0 ; then + AC_MSG_WARN([Note that --with-loader-nvram is obsolete and will be r= emoved soon]) fi AC_DEFINE_UNQUOTED([DEFAULT_LOADER_NVRAM], ["$with_loader_nvram"], [List of loader:nvram pairs]) @@ -37,5 +39,11 @@ AC_DEFUN([LIBVIRT_CHECK_LOADER_NVRAM], [ ]) =20 AC_DEFUN([LIBVIRT_RESULT_LOADER_NVRAM], [ - LIBVIRT_RESULT([Loader/NVRAM], [$with_loader_nvram]) + if test "x$with_loader_nvram" !=3D "xno" && \ + test "x$with_loader_nvram" !=3D "x" ; then + LIBVIRT_RESULT([Loader/NVRAM], [$with_loader_nvram], + [!!! Using this configure option is strongly discourage= d !!!]) + else + LIBVIRT_RESULT([Loader/NVRAM], [$with_loader_nvram]) + fi ]) diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf index b3a3428e4c..7a056b037e 100644 --- a/src/qemu/qemu.conf +++ b/src/qemu/qemu.conf @@ -761,6 +761,9 @@ # source tree. These metadata files are distributed alongside any # firmware images intended for use with QEMU. # +# NOTE: if ANY firmware metadata files are detected, this setting +# will be COMPLETELY IGNORED. +# # ------------------------------------------ # # When a domain is configured to use UEFI instead of standard diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index fae697a2ef..293f2635cc 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -32,6 +32,7 @@ #include "qemu_conf.h" #include "qemu_capabilities.h" #include "qemu_domain.h" +#include "qemu_firmware.h" #include "qemu_security.h" #include "viruuid.h" #include "virbuffer.h" @@ -799,7 +800,8 @@ virQEMUDriverConfigLoadLogEntry(virQEMUDriverConfigPtr = cfg, =20 static int virQEMUDriverConfigLoadNVRAMEntry(virQEMUDriverConfigPtr cfg, - virConfPtr conf) + virConfPtr conf, + bool privileged) { VIR_AUTOSTRINGLIST nvram =3D NULL; size_t i; @@ -807,8 +809,21 @@ virQEMUDriverConfigLoadNVRAMEntry(virQEMUDriverConfigP= tr cfg, if (virConfGetValueStringList(conf, "nvram", false, &nvram) < 0) return -1; if (nvram) { + VIR_AUTOSTRINGLIST fwList =3D NULL; + virFirmwareFreeList(cfg->firmwares, cfg->nfirmwares); =20 + if (qemuFirmwareFetchConfigs(&fwList, privileged) < 0) + return -1; + + if (fwList) { + VIR_WARN("Obsolete nvram variable is set while firmware metada= ta " + "files found. Note that the nvram config file variabl= e is " + "going to be ignored."); + cfg->nfirmwares =3D 0; + return 0; + } + cfg->nfirmwares =3D virStringListLength((const char *const *)nvram= ); if (nvram[0] && VIR_ALLOC_N(cfg->firmwares, cfg->nfirmwares) < 0) return -1; @@ -1041,7 +1056,7 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPt= r cfg, if (virQEMUDriverConfigLoadLogEntry(cfg, conf) < 0) return -1; =20 - if (virQEMUDriverConfigLoadNVRAMEntry(cfg, conf) < 0) + if (virQEMUDriverConfigLoadNVRAMEntry(cfg, conf, privileged) < 0) return -1; =20 if (virQEMUDriverConfigLoadGlusterDebugEntry(cfg, conf) < 0) --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list