From nobody Sun Feb 8 12:14:01 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.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=1591777829; cv=none; d=zohomail.com; s=zohoarc; b=aSkXaJdxBTf0ixb90e2uP8uSvWcHqR7d5e4orfa0GXX1zNRS5cYIZrNHy79sTFN5T7i5YtDLFdZYgpKznzN6ANbIEc6xmYnx/q1AmT2K2pX85XUCaWyflcRs1JB9Dzaa3erxoQKA5A0nfE3onUQ2saAtBW+U/dP0bPOnPK+we8g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591777829; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SI4Ay/OTtykVNT8dPWjuF59f2rtH9gpOvV2La5G0JZc=; b=eb5eEfX2wkb1A1lcJ2WPXLA+UwLOqkEHYxFOCt+zs/1Dik3ftMQQpKf4GgmBvvcqVt+cpUpK5cAr484dEuAlnv3JocvcA38QrpLM1y2wARAz0EYn8uXxZ3AA+/sfesRdjTHaGxs1rduXQjRWjsLpCdA4pbYUi3TVg0JdDpTqzgQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.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 [207.211.31.120]) by mx.zohomail.com with SMTPS id 1591777829945814.8191790036625; Wed, 10 Jun 2020 01:30:29 -0700 (PDT) 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-477-D_lX1Tr1OLaM2eC1qMdXvA-1; Wed, 10 Jun 2020 04:30:26 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3E6D2188360F; Wed, 10 Jun 2020 08:30:19 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D60165C3FD; Wed, 10 Jun 2020 08:30:18 +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 0B11FB34A2; Wed, 10 Jun 2020 08:30:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 05A8NfiJ006920 for ; Wed, 10 Jun 2020 04:23:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 76CA85C3FD; Wed, 10 Jun 2020 08:23:41 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.195.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id C34B05C1BD for ; Wed, 10 Jun 2020 08:23:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591777828; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=SI4Ay/OTtykVNT8dPWjuF59f2rtH9gpOvV2La5G0JZc=; b=LUmHcVc7bnDxVRU+77wcc6MRIWCK3D02u2jyFVfPZkDnGNhWCxLryUIq2H/S8wwa14FAkV Ao4uPXnfU7i4mBaQIv4m5H+h2pKfaHQNLerD9E150YFmQQ2ML7soJiTWpDYwt5FpDWf+nn Uo0aYn/ZDuE2xgc5TMU2JJwaQEgrDZk= X-MC-Unique: D_lX1Tr1OLaM2eC1qMdXvA-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v3 1/6] conf: Add firmware blob configuration Date: Wed, 10 Jun 2020 10:23:29 +0200 Message-Id: <5de08094b42c08c847eafe00eb53b8a470731380.1591776548.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" QEMU has -fw_cfg which allows users to tweak how firmware configures itself and/or provide new configuration blobs. Introduce new type "fwcfg" that will hold these new blobs. It's possible to either specify new value as a string or provide a filename which contents then serve as the value. Signed-off-by: Michal Privoznik Reviewed-by: Daniel P. Berrang=C3=A9 --- docs/formatdomain.html.in | 32 +++ docs/schemas/domaincommon.rng | 145 +++++++------ src/conf/domain_conf.c | 193 ++++++++++++++---- src/conf/domain_conf.h | 4 +- src/qemu/qemu_command.c | 10 +- src/util/virsysinfo.c | 52 ++++- src/util/virsysinfo.h | 16 +- tests/qemuxml2argvdata/smbios-type-fwcfg.xml | 63 ++++++ .../qemuxml2xmloutdata/smbios-type-fwcfg.xml | 1 + tests/qemuxml2xmltest.c | 1 + 10 files changed, 403 insertions(+), 114 deletions(-) create mode 100644 tests/qemuxml2argvdata/smbios-type-fwcfg.xml create mode 120000 tests/qemuxml2xmloutdata/smbios-type-fwcfg.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 6ebf19ae57..20c28a47e3 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -479,6 +479,10 @@ <entry>otherappname:more arbitrary data</entry> </oemStrings> </sysinfo> +<sysinfo type=3D'fwcfg'> + <entry name=3D'opt/com.example/name'>example value</entry> + <entry name=3D'opt/com.coreos/config' file=3D'/tmp/provision.ign'/> +</sysinfo> ... =20

@@ -593,6 +597,34 @@ + +

fwcfg
+
+ Some hypervisors provide unified way to tweak how firmware configur= es + itself, or may contain tables to be installed for the guest OS, for + instance boot order, ACPI, SMBIOS, etc. It even allows users to def= ine + their own config blobs. In case of QEMU, these then appear under do= main's + sysfs, under /sys/firmware/qemu_fw_cfg. Note, that the= se + values apply regardless the <smbios/> mode under <os/>. + Since 6.5.0 + +
+  <smbios type=3D'fwcfg'>
+    <entry name=3D'opt/com.example/name'>example value</entry>
+    <entry name=3D'opt/com.coreos/config' file=3D'/tmp/provision.ign'/&=
gt;
+  </smbios>
+
+ + The smbios element can have multiple entry + child elements. Each element then has mandatory name + attribute, which defines the name of the blob and must begin with + "opt/" and to avoid clashing with other names is advis= ed to + be in form "opt/$RFQDN/$name" where $RFQDN is a + reverse fully qualified domain name you control. + Then, the element can either contain the value (to set the blob val= ue + directly), or file attribute (to set the blob value fr= om + the file). +
=20

CPU Allocation

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 19242a9a32..e3bf7f5d55 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -46,9 +46,9 @@ - + - + @@ -5511,68 +5511,95 @@ --> - - smbios - - - - - - - - - - + + + + smbios + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - + + + + + + + + - - - - + + + + + + fwcfg + + + + + + + + + + + + + + + + + + + + + =20 diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 57a5b7befe..e9336fd72d 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3551,7 +3551,9 @@ void virDomainDefFree(virDomainDefPtr def) =20 virDomainNumaFree(def->numa); =20 - virSysinfoDefFree(def->sysinfo); + for (i =3D 0; i < def->nsysinfo; i++) + virSysinfoDefFree(def->sysinfo[i]); + VIR_FREE(def->sysinfo); =20 virDomainRedirFilterDefFree(def->redirfilter); =20 @@ -15708,67 +15710,153 @@ virSysinfoChassisParseXML(xmlNodePtr node, } =20 =20 -static virSysinfoDefPtr -virSysinfoParseXML(xmlNodePtr node, - xmlXPathContextPtr ctxt, - unsigned char *domUUID, - bool uuid_generated) +static int +virSysinfoParseSMBIOSDef(virSysinfoDefPtr def, + xmlXPathContextPtr ctxt, + unsigned char *domUUID, + bool uuid_generated) { - VIR_XPATH_NODE_AUTORESTORE(ctxt); - virSysinfoDefPtr def; xmlNodePtr tmpnode; - g_autofree char *type =3D NULL; - - ctxt->node =3D node; - - if (!virXMLNodeNameEqual(node, "sysinfo")) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("XML does not contain expected 'sysinfo' element"= )); - return NULL; - } - - if (VIR_ALLOC(def) < 0) - return NULL; - - type =3D virXMLPropString(node, "type"); - if (type =3D=3D NULL) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("sysinfo must contain a type attribute")); - goto error; - } - if ((def->type =3D virSysinfoTypeFromString(type)) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown sysinfo type '%s'"), type); - goto error; - } =20 /* Extract BIOS related metadata */ if ((tmpnode =3D virXPathNode("./bios[1]", ctxt)) !=3D NULL) { if (virSysinfoBIOSParseXML(tmpnode, ctxt, &def->bios) < 0) - goto error; + return -1; } =20 /* Extract system related metadata */ if ((tmpnode =3D virXPathNode("./system[1]", ctxt)) !=3D NULL) { if (virSysinfoSystemParseXML(tmpnode, ctxt, &def->system, domUUID, uuid_generated) < 0) - goto error; + return -1; } =20 /* Extract system base board metadata */ if (virSysinfoBaseBoardParseXML(ctxt, &def->baseBoard, &def->nbaseBoar= d) < 0) - goto error; + return -1; =20 /* Extract chassis related metadata */ if ((tmpnode =3D virXPathNode("./chassis[1]", ctxt)) !=3D NULL) { if (virSysinfoChassisParseXML(tmpnode, ctxt, &def->chassis) < 0) - goto error; + return -1; } =20 /* Extract system related metadata */ if ((tmpnode =3D virXPathNode("./oemStrings[1]", ctxt)) !=3D NULL) { if (virSysinfoOEMStringsParseXML(tmpnode, ctxt, &def->oemStrings) = < 0) + return -1; + } + + return 0; +} + + +static int +virSysinfoParseFWCfgDef(virSysinfoDefPtr def, + xmlNodePtr node, + xmlXPathContextPtr ctxt) +{ + VIR_XPATH_NODE_AUTORESTORE(ctxt); + g_autofree xmlNodePtr *nodes =3D NULL; + int n; + size_t i; + + ctxt->node =3D node; + + if ((n =3D virXPathNodeSet("./entry", ctxt, &nodes)) < 0) + return -1; + + if (n =3D=3D 0) + return 0; + + def->fw_cfgs =3D g_new0(virSysinfoFWCfgDef, n); + + for (i =3D 0; i < n; i++) { + g_autofree char *name =3D NULL; + g_autofree char *value =3D NULL; + g_autofree char *file =3D NULL; + g_autofree char *sanitizedFile =3D NULL; + + if (!(name =3D virXMLPropString(nodes[i], "name"))) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("Firmware entry is missing 'name' attribute")= ); + return -1; + } + + value =3D virXMLNodeContentString(nodes[i]); + file =3D virXMLPropString(nodes[i], "file"); + + if (virStringIsEmpty(value)) + VIR_FREE(value); + + if (!value && !file) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("Firmware entry must have either value or " + "'file' attribute")); + return -1; + } + + if (file) + sanitizedFile =3D virFileSanitizePath(file); + + def->fw_cfgs[i].name =3D g_steal_pointer(&name); + def->fw_cfgs[i].value =3D g_steal_pointer(&value); + def->fw_cfgs[i].file =3D g_steal_pointer(&sanitizedFile); + def->nfw_cfgs++; + } + + return 0; +} + + +static virSysinfoDefPtr +virSysinfoParseXML(xmlNodePtr node, + xmlXPathContextPtr ctxt, + unsigned char *domUUID, + bool uuid_generated) +{ + VIR_XPATH_NODE_AUTORESTORE(ctxt); + virSysinfoDefPtr def; + g_autofree char *typeStr =3D NULL; + int type; + + ctxt->node =3D node; + + if (!virXMLNodeNameEqual(node, "sysinfo")) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("XML does not contain expected 'sysinfo' element"= )); + return NULL; + } + + if (VIR_ALLOC(def) < 0) + return NULL; + + typeStr =3D virXMLPropString(node, "type"); + if (typeStr =3D=3D NULL) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("sysinfo must contain a type attribute")); + goto error; + } + if ((type =3D virSysinfoTypeFromString(typeStr)) < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown sysinfo type '%s'"), typeStr); + goto error; + } + def->type =3D type; + + switch (def->type) { + case VIR_SYSINFO_SMBIOS: + if (virSysinfoParseSMBIOSDef(def, ctxt, domUUID, uuid_generated) <= 0) goto error; + break; + + case VIR_SYSINFO_FWCFG: + if (virSysinfoParseFWCfgDef(def, node, ctxt) < 0) + goto error; + break; + + case VIR_SYSINFO_LAST: + break; } =20 return def; @@ -22173,6 +22261,7 @@ virDomainDefParseXML(xmlDocPtr xml, =20 def->idmap.ngidmap =3D n; } + VIR_FREE(nodes); =20 if ((def->idmap.uidmap && !def->idmap.gidmap) || (!def->idmap.uidmap && def->idmap.gidmap)) { @@ -22181,13 +22270,21 @@ virDomainDefParseXML(xmlDocPtr xml, goto error; } =20 - if ((node =3D virXPathNode("./sysinfo[1]", ctxt)) !=3D NULL) { - def->sysinfo =3D virSysinfoParseXML(node, ctxt, - def->uuid, uuid_generated); + if ((n =3D virXPathNodeSet("./sysinfo", ctxt, &nodes)) < 0) + goto error; =20 - if (def->sysinfo =3D=3D NULL) + def->sysinfo =3D g_new0(virSysinfoDefPtr, n); + + for (i =3D 0; i < n; i++) { + virSysinfoDefPtr sysinfo =3D virSysinfoParseXML(nodes[i], ctxt, + def->uuid, uuid_gene= rated); + + if (!sysinfo) goto error; + + def->sysinfo[def->nsysinfo++] =3D sysinfo; } + VIR_FREE(nodes); =20 if ((tmp =3D virXPathString("string(./os/smbios/@mode)", ctxt))) { int mode; @@ -24072,8 +24169,16 @@ virDomainDefCheckABIStabilityFlags(virDomainDefPtr= src, if (!virCPUDefIsEqual(src->cpu, dst->cpu, true)) goto error; =20 - if (!virSysinfoIsEqual(src->sysinfo, dst->sysinfo)) - goto error; + if (src->nsysinfo !=3D dst->nsysinfo) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Target domain count of sysinfo does not match so= urce")); + goto error; + } + + for (i =3D 0; i < src->nsysinfo; i++) { + if (!virSysinfoIsEqual(src->sysinfo[i], dst->sysinfo[i])) + goto error; + } =20 if (src->ndisks !=3D dst->ndisks) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -29507,8 +29612,8 @@ virDomainDefFormatInternalSetRootName(virDomainDefP= tr def, if (def->resource) virDomainResourceDefFormat(buf, def->resource); =20 - if (def->sysinfo) - ignore_value(virSysinfoFormat(buf, def->sysinfo)); + for (i =3D 0; i < def->nsysinfo; i++) + virSysinfoFormat(buf, def->sysinfo[i]); =20 if (def->os.bootloader) { virBufferEscapeString(buf, "%s\n", diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index e152c599ca..bda8fb6bce 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2624,13 +2624,15 @@ struct _virDomainDef { size_t npanics; virDomainPanicDefPtr *panics; =20 + size_t nsysinfo; + virSysinfoDefPtr *sysinfo; + /* Only 1 */ virDomainWatchdogDefPtr watchdog; virDomainMemballoonDefPtr memballoon; virDomainNVRAMDefPtr nvram; virDomainTPMDefPtr tpm; virCPUDefPtr cpu; - virSysinfoDefPtr sysinfo; virDomainRedirFilterDefPtr redirfilter; virDomainIOMMUDefPtr iommu; virDomainVsockDefPtr vsock; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index d9e99d9d1a..86db7d0606 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -5736,13 +5736,19 @@ qemuBuildSmbiosCommandLine(virCommandPtr cmd, /* Host and guest uuid must differ, by definition of UUID. */ skip_uuid =3D true; } else if (def->os.smbios_mode =3D=3D VIR_DOMAIN_SMBIOS_SYSINFO) { - if (def->sysinfo =3D=3D NULL) { + for (i =3D 0; i < def->nsysinfo; i++) { + if (def->sysinfo[i]->type =3D=3D VIR_SYSINFO_SMBIOS) { + source =3D def->sysinfo[i]; + break; + } + } + + if (!source) { virReportError(VIR_ERR_XML_ERROR, _("Domain '%s' sysinfo are not available"), def->name); return -1; } - source =3D def->sysinfo; /* domain_conf guaranteed that system_uuid matches guest uuid. */ } if (source !=3D NULL) { diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c index 41f4d1cff9..5b0ad2e6ce 100644 --- a/src/util/virsysinfo.c +++ b/src/util/virsysinfo.c @@ -43,6 +43,7 @@ VIR_LOG_INIT("util.sysinfo"); VIR_ENUM_IMPL(virSysinfo, VIR_SYSINFO_LAST, "smbios", + "fwcfg" ); =20 static const char *sysinfoDmidecode =3D DMIDECODE; @@ -1436,6 +1437,40 @@ virSysinfoOEMStringsFormat(virBufferPtr buf, virSysi= nfoOEMStringsDefPtr def) virBufferAddLit(buf, "\n"); } =20 + +static void +virSysinfoFormatSMBIOS(virBufferPtr buf, + virSysinfoDefPtr def) +{ + virSysinfoBIOSFormat(buf, def->bios); + virSysinfoSystemFormat(buf, def->system); + virSysinfoBaseBoardFormat(buf, def->baseBoard, def->nbaseBoard); + virSysinfoChassisFormat(buf, def->chassis); + virSysinfoProcessorFormat(buf, def); + virSysinfoMemoryFormat(buf, def); + virSysinfoOEMStringsFormat(buf, def->oemStrings); +} + + +static void +virSysinfoFormatFWCfg(virBufferPtr buf, + virSysinfoDefPtr def) +{ + size_t i; + + for (i =3D 0; i < def->nfw_cfgs; i++) { + const virSysinfoFWCfgDef *f =3D &def->fw_cfgs[i]; + + virBufferAsprintf(buf, "name); + + if (f->file) + virBufferEscapeString(buf, " file=3D'%s'/>\n", f->file); + else + virBufferEscapeString(buf, ">%s\n", f->value); + } +} + + /** * virSysinfoFormat: * @buf: buffer to append output to (may use auto-indentation) @@ -1458,13 +1493,16 @@ virSysinfoFormat(virBufferPtr buf, virSysinfoDefPtr= def) return -1; } =20 - virSysinfoBIOSFormat(&childrenBuf, def->bios); - virSysinfoSystemFormat(&childrenBuf, def->system); - virSysinfoBaseBoardFormat(&childrenBuf, def->baseBoard, def->nbaseBoar= d); - virSysinfoChassisFormat(&childrenBuf, def->chassis); - virSysinfoProcessorFormat(&childrenBuf, def); - virSysinfoMemoryFormat(&childrenBuf, def); - virSysinfoOEMStringsFormat(&childrenBuf, def->oemStrings); + switch (def->type) { + case VIR_SYSINFO_SMBIOS: + virSysinfoFormatSMBIOS(&childrenBuf, def); + break; + case VIR_SYSINFO_FWCFG: + virSysinfoFormatFWCfg(&childrenBuf, def); + break; + case VIR_SYSINFO_LAST: + break; + } =20 virBufferAsprintf(&attrBuf, " type=3D'%s'", type); =20 diff --git a/src/util/virsysinfo.h b/src/util/virsysinfo.h index f1d280e1c9..6b25969a4b 100644 --- a/src/util/virsysinfo.h +++ b/src/util/virsysinfo.h @@ -27,6 +27,7 @@ =20 typedef enum { VIR_SYSINFO_SMBIOS, + VIR_SYSINFO_FWCFG, =20 VIR_SYSINFO_LAST } virSysinfoType; @@ -112,11 +113,20 @@ struct _virSysinfoOEMStringsDef { char **values; }; =20 +typedef struct _virSysinfoFWCfgDef virSysinfoFWCfgDef; +typedef virSysinfoFWCfgDef *virSysinfoFWCfgDefPtr; +struct _virSysinfoFWCfgDef { + char *name; + char *value; + char *file; +}; + typedef struct _virSysinfoDef virSysinfoDef; typedef virSysinfoDef *virSysinfoDefPtr; struct _virSysinfoDef { - int type; + virSysinfoType type; =20 + /* The following members are valid for type =3D=3D VIR_SYSINFO_SMBIOS = */ virSysinfoBIOSDefPtr bios; virSysinfoSystemDefPtr system; =20 @@ -132,6 +142,10 @@ struct _virSysinfoDef { virSysinfoMemoryDefPtr memory; =20 virSysinfoOEMStringsDefPtr oemStrings; + + /* The following members are valid for type =3D=3D VIR_SYSINFO_FWCFG */ + size_t nfw_cfgs; + virSysinfoFWCfgDefPtr fw_cfgs; }; =20 virSysinfoDefPtr virSysinfoRead(void); diff --git a/tests/qemuxml2argvdata/smbios-type-fwcfg.xml b/tests/qemuxml2a= rgvdata/smbios-type-fwcfg.xml new file mode 100644 index 0000000000..72da0fe045 --- /dev/null +++ b/tests/qemuxml2argvdata/smbios-type-fwcfg.xml @@ -0,0 +1,63 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + + LENOVO + 6FET82WW (3.12 ) + + + Fedora + Virt-Manager + 0.8.2-3.fc14 + 32dfcb37-5af1-552b-357c-be8c3aa38310 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 1234567890 + Red Hat + + + Lenovo + 20BE0061MC + 0B98401 Pro + W1KS427111E + Not Available + + + + example value + + + + hvm + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i386 + + + + +
+ + +
+ + +
+ + + + + +
+ + + diff --git a/tests/qemuxml2xmloutdata/smbios-type-fwcfg.xml b/tests/qemuxml= 2xmloutdata/smbios-type-fwcfg.xml new file mode 120000 index 0000000000..09a2682910 --- /dev/null +++ b/tests/qemuxml2xmloutdata/smbios-type-fwcfg.xml @@ -0,0 +1 @@ +../qemuxml2argvdata/smbios-type-fwcfg.xml \ No newline at end of file diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index dcc7b29ded..157e686f2a 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1125,6 +1125,7 @@ mymain(void) DO_TEST("shmem-plain-doorbell", NONE); DO_TEST("smbios", NONE); DO_TEST("smbios-multiple-type2", NONE); + DO_TEST("smbios-type-fwcfg", NONE); =20 DO_TEST_CAPS_LATEST("os-firmware-bios"); DO_TEST_CAPS_LATEST("os-firmware-efi"); --=20 2.26.2