From nobody Wed May 14 16:35:09 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524239227286513.2961801426707; Fri, 20 Apr 2018 08:47:07 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 17307308210B; Fri, 20 Apr 2018 15:47:05 +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 57D625D9CD; Fri, 20 Apr 2018 15:47:04 +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 6B02418033EB; Fri, 20 Apr 2018 15:47:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3KFicaw001412 for ; Fri, 20 Apr 2018 11:44:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id EDCDA11701C2; Fri, 20 Apr 2018 15:44:37 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 912CC10AF9CA for ; Fri, 20 Apr 2018 15:44:37 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Fri, 20 Apr 2018 17:44:29 +0200 Message-Id: <20180420154431.31536-2-abologna@redhat.com> In-Reply-To: <20180420154431.31536-1-abologna@redhat.com> References: <20180420154431.31536-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/3] conf: Add rom.enabled attribute for PCI devices 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Fri, 20 Apr 2018 15:47:06 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The attribute can be used to disable ROM loading completely for a device. Signed-off-by: Andrea Bolognani --- docs/formatdomain.html.in | 3 +++ docs/schemas/domaincommon.rng | 5 +++++ src/conf/device_conf.h | 1 + src/conf/domain_conf.c | 26 +++++++++++++++++++++++++- 4 files changed, 34 insertions(+), 1 deletion(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index ada0df227f..0afc310e25 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -4476,6 +4476,9 @@ virtual function of an sr-iov capable ethernet device (which has no boot ROMs for the VFs). Since 0.9.10 (QEMU and KVM only). + The optional enabled attribute can be set to + no to disable PCI ROM loading completely for the devi= ce. + Since 4.3.0 (QEMU and KVM only).
address
The address element for USB devices has a diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 4cab55f05d..3569b92127 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -5108,6 +5108,11 @@ =20 + + + + + diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h index f87d6f1fc6..a31ce9c376 100644 --- a/src/conf/device_conf.h +++ b/src/conf/device_conf.h @@ -153,6 +153,7 @@ struct _virDomainDeviceInfo { } master; /* rombar and romfile are only used for pci hostdev and network * devices. */ + int romenabled; /* enum virTristateBool */ int rombar; /* enum virTristateSwitch */ char *romfile; /* bootIndex is only used for disk, network interface, hostdev diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 35666c1347..3c152441df 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -6095,9 +6095,17 @@ virDomainDeviceInfoFormat(virBufferPtr buf, } =20 if ((flags & VIR_DOMAIN_DEF_FORMAT_ALLOW_ROM) && - (info->rombar !=3D VIR_TRISTATE_SWITCH_ABSENT || info->romfile)) { + (info->romenabled !=3D VIR_TRISTATE_BOOL_ABSENT || + info->rombar !=3D VIR_TRISTATE_SWITCH_ABSENT || + info->romfile)) { =20 virBufferAddLit(buf, "romenabled !=3D VIR_TRISTATE_BOOL_ABSENT) { + const char *romenabled =3D virTristateBoolTypeToString(info->r= omenabled); + + if (romenabled) + virBufferAsprintf(buf, " enabled=3D'%s'", romenabled); + } if (info->rombar !=3D VIR_TRISTATE_SWITCH_ABSENT) { const char *rombar =3D virTristateSwitchTypeToString(info->rom= bar); =20 @@ -6738,6 +6746,7 @@ virDomainDeviceInfoParseXML(virDomainXMLOptionPtr xml= opt ATTRIBUTE_UNUSED, xmlNodePtr boot =3D NULL; xmlNodePtr rom =3D NULL; char *type =3D NULL; + char *romenabled =3D NULL; char *rombar =3D NULL; char *aliasStr =3D NULL; int ret =3D -1; @@ -6791,6 +6800,12 @@ virDomainDeviceInfoParseXML(virDomainXMLOptionPtr xm= lopt ATTRIBUTE_UNUSED, } =20 if (rom) { + if ((romenabled =3D virXMLPropString(rom, "enabled")) && + ((info->romenabled =3D virTristateBoolTypeFromString(romenable= d)) <=3D 0)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown rom enabled value '%s'"), romenabled= ); + goto cleanup; + } if ((rombar =3D virXMLPropString(rom, "bar")) && ((info->rombar =3D virTristateSwitchTypeFromString(rombar)) <= =3D 0)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -6798,6 +6813,14 @@ virDomainDeviceInfoParseXML(virDomainXMLOptionPtr xm= lopt ATTRIBUTE_UNUSED, goto cleanup; } info->romfile =3D virXMLPropString(rom, "file"); + + if (info->romenabled =3D=3D VIR_TRISTATE_BOOL_NO && + (info->rombar !=3D VIR_TRISTATE_SWITCH_ABSENT || info->romfile= )) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", + _("ROM tuning is not supported when ROM is disa= bled")); + goto cleanup; + } } =20 if (address && @@ -6811,6 +6834,7 @@ virDomainDeviceInfoParseXML(virDomainXMLOptionPtr xml= opt ATTRIBUTE_UNUSED, virDomainDeviceInfoClear(info); VIR_FREE(type); VIR_FREE(rombar); + VIR_FREE(romenabled); VIR_FREE(aliasStr); return ret; } --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list