From nobody Sun Feb 8 13:11:11 2026 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.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1492691300619707.0868892421021; Thu, 20 Apr 2017 05:28:20 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4684A9F728; Thu, 20 Apr 2017 12:28:18 +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 193AF808EC; Thu, 20 Apr 2017 12:28: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 14F5E18523C4; Thu, 20 Apr 2017 12:28:02 +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 v3KCJSwq020092 for ; Thu, 20 Apr 2017 08:19:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3D9A71711B; Thu, 20 Apr 2017 12:19:28 +0000 (UTC) Received: from dnr.brq.redhat.com (dhcp129-199.brq.redhat.com [10.34.129.199]) by smtp.corp.redhat.com (Postfix) with ESMTP id BB5DC17110 for ; Thu, 20 Apr 2017 12:19:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4684A9F728 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 4684A9F728 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Thu, 20 Apr 2017 14:19:15 +0200 Message-Id: <27646ad996d32bb0f07628ada9869b6e49e01c04.1492690592.git.jtomko@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCHv2 3/6] conf: add to 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 20 Apr 2017 12:28:19 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add a new attribute to control interrupt remapping. https://bugzilla.redhat.com/show_bug.cgi?id=3D1427005 --- docs/formatdomain.html.in | 22 ++++++++++++- docs/schemas/domaincommon.rng | 9 +++++ src/conf/domain_conf.c | 38 ++++++++++++++++++= +--- src/conf/domain_conf.h | 1 + .../qemuxml2argv-intel-iommu-irqchip.xml | 4 ++- 5 files changed, 68 insertions(+), 6 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index abf089a..f5a8e76 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -7335,7 +7335,9 @@ qemu-kvm -net nic,model=3D? /dev/null
 ...
 <devices>
-  <iommu model=3D'intel'/>
+  <iommu model=3D'intel'>
+    <driver intremap=3D'on'/>
+  </iommu>
 </devices>
 ...
 
@@ -7346,6 +7348,24 @@ qemu-kvm -net nic,model=3D? /dev/null Currently only the intel model is supported.

+
driver
+
+

+ The driver subelement can be used to configure + additional options: +

+
+
intremap
+
+

+ The intremap attribute with possible values + on and off can be used to + turn on interrupt remapping. Since 3.3= .0 + (QEMU only) +

+
+
+
=20

Security label

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index df3143e..7930d85 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3889,6 +3889,15 @@ intel + + + + + + + + + =20 diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 931320e..d40d129 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -14057,12 +14057,16 @@ virDomainMemoryDefParseXML(xmlNodePtr memdevNode, =20 =20 static virDomainIOMMUDefPtr -virDomainIOMMUDefParseXML(xmlNodePtr node) +virDomainIOMMUDefParseXML(xmlNodePtr node, + xmlXPathContextPtr ctxt) { virDomainIOMMUDefPtr iommu =3D NULL, ret =3D NULL; + xmlNodePtr save =3D ctxt->node; char *tmp =3D NULL; int val; =20 + ctxt->node =3D node; + if (VIR_ALLOC(iommu) < 0) goto cleanup; =20 @@ -14079,10 +14083,20 @@ virDomainIOMMUDefParseXML(xmlNodePtr node) =20 iommu->model =3D val; =20 + VIR_FREE(tmp); + if ((tmp =3D virXPathString("string(./driver/@intremap)", ctxt))) { + if ((val =3D virTristateSwitchTypeFromString(tmp)) < 0) { + virReportError(VIR_ERR_XML_ERROR, _("unknown intremap value: %= s"), tmp); + goto cleanup; + } + iommu->intremap =3D val; + } + ret =3D iommu; iommu =3D NULL; =20 cleanup: + ctxt->node =3D save; VIR_FREE(iommu); VIR_FREE(tmp); return ret; @@ -14235,7 +14249,7 @@ virDomainDeviceDefParse(const char *xmlStr, goto error; break; case VIR_DOMAIN_DEVICE_IOMMU: - if (!(dev->data.iommu =3D virDomainIOMMUDefParseXML(node))) + if (!(dev->data.iommu =3D virDomainIOMMUDefParseXML(node, ctxt))) goto error; break; case VIR_DOMAIN_DEVICE_NONE: @@ -18365,7 +18379,7 @@ virDomainDefParseXML(xmlDocPtr xml, } =20 if (n > 0) { - if (!(def->iommu =3D virDomainIOMMUDefParseXML(nodes[0]))) + if (!(def->iommu =3D virDomainIOMMUDefParseXML(nodes[0], ctxt))) goto error; } VIR_FREE(nodes); @@ -24019,8 +24033,24 @@ static void virDomainIOMMUDefFormat(virBufferPtr buf, const virDomainIOMMUDef *iommu) { - virBufferAsprintf(buf, "\n", + virBuffer childBuf =3D VIR_BUFFER_INITIALIZER; + + virBufferAdjustIndent(&childBuf, virBufferGetIndent(buf, false) + 2); + + if (iommu->intremap !=3D VIR_TRISTATE_SWITCH_ABSENT) { + virBufferAsprintf(&childBuf, "\n", + virTristateSwitchTypeToString(iommu->intremap)); + } + + virBufferAsprintf(buf, "model)); + if (virBufferUse(&childBuf)) { + virBufferAddLit(buf, ">\n"); + virBufferAddBuffer(buf, &childBuf); + virBufferAddLit(buf, "\n"); + } else { + virBufferAddLit(buf, "/>\n"); + } } =20 =20 diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 97c4418..f95649c 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2211,6 +2211,7 @@ typedef enum { =20 struct _virDomainIOMMUDef { virDomainIOMMUModel model; + virTristateSwitch intremap; }; /* * Guest VM main configuration diff --git a/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-irqchip.xml b/= tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-irqchip.xml index cc895af..2100c08 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-irqchip.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-irqchip.xml @@ -24,6 +24,8 @@ - + + + --=20 2.10.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list