From nobody Mon May 6 17:54:40 2024 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 149614879017733.17231722989959; Tue, 30 May 2017 05:53:10 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 3025EC0467DD; Tue, 30 May 2017 12:53:06 +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 E9D2574AB7; Tue, 30 May 2017 12:53:05 +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 9F3F6180BAF8; Tue, 30 May 2017 12:53:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v4UCqvd1013128 for ; Tue, 30 May 2017 08:52:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id BC4BA19C98; Tue, 30 May 2017 12:52:57 +0000 (UTC) Received: from icr.brq.redhat.com (dhcp129-58.brq.redhat.com [10.34.129.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1D6FC19E97; Tue, 30 May 2017 12:52:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3025EC0467DD Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.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 3025EC0467DD From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 30 May 2017 14:50:24 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: jasowang@redhat.com Subject: [libvirt] [PATCH 01/18] conf: introduce virDomainControllerDriverFormat 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 30 May 2017 12:53:06 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Split out formatting the subelement of to make adding new options easier. --- src/conf/domain_conf.c | 55 +++++++++++++++++++++++++++++-----------------= ---- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index c7e20b8..318e254 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -21357,6 +21357,37 @@ virDomainDiskDefFormat(virBufferPtr buf, #undef FORMAT_IOTUNE =20 =20 +static void +virDomainControllerDriverFormat(virBufferPtr buf, + virDomainControllerDefPtr def) +{ + virBuffer driverBuf =3D VIR_BUFFER_INITIALIZER; + + if (def->queues) + virBufferAsprintf(&driverBuf, " queues=3D'%u'", def->queues); + + if (def->cmd_per_lun) + virBufferAsprintf(&driverBuf, " cmd_per_lun=3D'%u'", def->cmd_per_= lun); + + if (def->max_sectors) + virBufferAsprintf(&driverBuf, " max_sectors=3D'%u'", def->max_sect= ors); + + if (def->ioeventfd) { + virBufferAsprintf(&driverBuf, " ioeventfd=3D'%s'", + virTristateSwitchTypeToString(def->ioeventfd)); + } + + if (def->iothread) + virBufferAsprintf(&driverBuf, " iothread=3D'%u'", def->iothread); + + if (virBufferUse(&driverBuf)) { + virBufferAddLit(buf, "\n"); + } +} + + static int virDomainControllerDefFormat(virBufferPtr buf, virDomainControllerDefPtr def, @@ -21366,7 +21397,6 @@ virDomainControllerDefFormat(virBufferPtr buf, const char *model =3D NULL; const char *modelName =3D NULL; bool pcihole64 =3D false, pciModel =3D false, pciTarget =3D false; - virBuffer driverBuf =3D VIR_BUFFER_INITIALIZER; =20 if (!type) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -21471,28 +21501,7 @@ virDomainControllerDefFormat(virBufferPtr buf, } } =20 - if (def->queues) - virBufferAsprintf(&driverBuf, " queues=3D'%u'", def->queues); - - if (def->cmd_per_lun) - virBufferAsprintf(&driverBuf, " cmd_per_lun=3D'%u'", def->cmd_= per_lun); - - if (def->max_sectors) - virBufferAsprintf(&driverBuf, " max_sectors=3D'%u'", def->max_= sectors); - - if (def->ioeventfd) { - virBufferAsprintf(&driverBuf, " ioeventfd=3D'%s'", - virTristateSwitchTypeToString(def->ioeventfd= )); - } - - if (def->iothread) - virBufferAsprintf(&driverBuf, " iothread=3D'%u'", def->iothrea= d); - - if (virBufferUse(&driverBuf)) { - virBufferAddLit(buf, "\n"); - } + virDomainControllerDriverFormat(buf, def); =20 if (virDomainDeviceInfoNeedsFormat(&def->info, flags) && virDomainDeviceInfoFormat(buf, &def->info, flags) < 0) --=20 2.10.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 17:54:40 2024 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 1496148783921814.6238541123781; Tue, 30 May 2017 05:53:03 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DB706C0B39C0; Tue, 30 May 2017 12:53:01 +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 A8CD25B81B; Tue, 30 May 2017 12:53:01 +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 ABF414BB7F; Tue, 30 May 2017 12:53:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v4UCqwr1013136 for ; Tue, 30 May 2017 08:52:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id B33D519C98; Tue, 30 May 2017 12:52:58 +0000 (UTC) Received: from icr.brq.redhat.com (dhcp129-58.brq.redhat.com [10.34.129.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id 156A95B80E; Tue, 30 May 2017 12:52:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DB706C0B39C0 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.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 DB706C0B39C0 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 30 May 2017 14:50:25 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: jasowang@redhat.com Subject: [libvirt] [PATCH 02/18] conf: use a separate buffer for the subelements of 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 30 May 2017 12:53:02 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We need to decide whether to format as a single tag or if it has any subelements. Rewrite the function to use a separate buffer for subelements, to make adding new options easier. --- src/conf/domain_conf.c | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 318e254..fe0eaf2 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -21397,6 +21397,9 @@ virDomainControllerDefFormat(virBufferPtr buf, const char *model =3D NULL; const char *modelName =3D NULL; bool pcihole64 =3D false, pciModel =3D false, pciTarget =3D false; + virBuffer childBuf =3D VIR_BUFFER_INITIALIZER; + + virBufferAdjustIndent(&childBuf, virBufferGetIndent(buf, false) + 2); =20 if (!type) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -21462,7 +21465,6 @@ virDomainControllerDefFormat(virBufferPtr buf, def->iothread || virDomainDeviceInfoNeedsFormat(&def->info, flags) || pcihole64) { virBufferAddLit(buf, ">\n"); - virBufferAdjustIndent(buf, 2); =20 if (pciModel) { modelName =3D virDomainControllerPCIModelNameTypeToString(def-= >opts.pciopts.modelName); @@ -21472,47 +21474,47 @@ virDomainControllerDefFormat(virBufferPtr buf, def->opts.pciopts.modelName); return -1; } - virBufferAsprintf(buf, "\n", modelName); + virBufferAsprintf(&childBuf, "\n", modelNa= me); } =20 if (pciTarget) { - virBufferAddLit(buf, "opts.pciopts.chassisNr !=3D -1) - virBufferAsprintf(buf, " chassisNr=3D'%d'", + virBufferAsprintf(&childBuf, " chassisNr=3D'%d'", def->opts.pciopts.chassisNr); if (def->opts.pciopts.chassis !=3D -1) - virBufferAsprintf(buf, " chassis=3D'%d'", + virBufferAsprintf(&childBuf, " chassis=3D'%d'", def->opts.pciopts.chassis); if (def->opts.pciopts.port !=3D -1) - virBufferAsprintf(buf, " port=3D'0x%x'", + virBufferAsprintf(&childBuf, " port=3D'0x%x'", def->opts.pciopts.port); if (def->opts.pciopts.busNr !=3D -1) - virBufferAsprintf(buf, " busNr=3D'%d'", + virBufferAsprintf(&childBuf, " busNr=3D'%d'", def->opts.pciopts.busNr); if (def->opts.pciopts.numaNode =3D=3D -1) { - virBufferAddLit(buf, "/>\n"); + virBufferAddLit(&childBuf, "/>\n"); } else { - virBufferAddLit(buf, ">\n"); - virBufferAdjustIndent(buf, 2); - virBufferAsprintf(buf, "%d\n", + virBufferAddLit(&childBuf, ">\n"); + virBufferAdjustIndent(&childBuf, 2); + virBufferAsprintf(&childBuf, "%d\n", def->opts.pciopts.numaNode); - virBufferAdjustIndent(buf, -2); - virBufferAddLit(buf, "\n"); + virBufferAdjustIndent(&childBuf, -2); + virBufferAddLit(&childBuf, "\n"); } } =20 - virDomainControllerDriverFormat(buf, def); + virDomainControllerDriverFormat(&childBuf, def); =20 if (virDomainDeviceInfoNeedsFormat(&def->info, flags) && - virDomainDeviceInfoFormat(buf, &def->info, flags) < 0) + virDomainDeviceInfoFormat(&childBuf, &def->info, flags) < 0) return -1; =20 if (pcihole64) { - virBufferAsprintf(buf, "%lu%lu\n", def->opts.pciopts.pcihole64s= ize); } =20 - virBufferAdjustIndent(buf, -2); + virBufferAddBuffer(buf, &childBuf); virBufferAddLit(buf, "\n"); } else { virBufferAddLit(buf, "/>\n"); --=20 2.10.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 17:54:40 2024 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 1496148784102136.45509180619115; Tue, 30 May 2017 05:53:04 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F155D8046E; Tue, 30 May 2017 12:53:01 +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 CB6C25B820; Tue, 30 May 2017 12:53:01 +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 5BB304A48C; Tue, 30 May 2017 12:53:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v4UCqx6A013143 for ; Tue, 30 May 2017 08:52:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id D2EEC19E97; Tue, 30 May 2017 12:52:59 +0000 (UTC) Received: from icr.brq.redhat.com (dhcp129-58.brq.redhat.com [10.34.129.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id 30A005C7A5; Tue, 30 May 2017 12:52:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com F155D8046E Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.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 F155D8046E From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 30 May 2017 14:50:26 +0200 Message-Id: <160447fa085ab8da66bf21947d11f58f539fd7c6.1496148357.git.jtomko@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: jasowang@redhat.com Subject: [libvirt] [PATCH 03/18] conf: only format as a pair tag when needed 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 30 May 2017 12:53:02 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Make the decision based on the usage of childBuf buffer. This fixes the oddity in the test case introduced by commit c1c4d0d where we would format an empty pair tag. --- src/conf/domain_conf.c | 4 +++- tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-defaultconsole.xml | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index fe0eaf2..57f52be 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -21464,7 +21464,6 @@ virDomainControllerDefFormat(virBufferPtr buf, def->queues || def->cmd_per_lun || def->max_sectors || def->ioeven= tfd || def->iothread || virDomainDeviceInfoNeedsFormat(&def->info, flags) || pcihole64) { - virBufferAddLit(buf, ">\n"); =20 if (pciModel) { modelName =3D virDomainControllerPCIModelNameTypeToString(def-= >opts.pciopts.modelName); @@ -21513,7 +21512,10 @@ virDomainControllerDefFormat(virBufferPtr buf, virBufferAsprintf(&childBuf, "%lu\n", def->opts.pciopts.pcihole64s= ize); } + } =20 + if (virBufferUse(&childBuf)) { + virBufferAddLit(buf, ">\n"); virBufferAddBuffer(buf, &childBuf); virBufferAddLit(buf, "\n"); } else { diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-defaultconsole.xm= l b/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-defaultconsole.xml index 882d005..7eb1a76 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-defaultconsole.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-defaultconsole.xml @@ -14,8 +14,7 @@ destroy /usr/bin/qemu-system-s390x - - + --=20 2.10.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 17:54:40 2024 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 1496148789000789.2440789582338; Tue, 30 May 2017 05:53:09 -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 5952BC0467DF; Tue, 30 May 2017 12:53:06 +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 354E87E39E; Tue, 30 May 2017 12:53:06 +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 DFB7E180BAF9; Tue, 30 May 2017 12:53:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v4UCr0HZ013150 for ; Tue, 30 May 2017 08:53:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id D1CF75C7A9; Tue, 30 May 2017 12:53:00 +0000 (UTC) Received: from icr.brq.redhat.com (dhcp129-58.brq.redhat.com [10.34.129.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2ADCE5B810; Tue, 30 May 2017 12:53:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5952BC0467DF Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.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 5952BC0467DF From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 30 May 2017 14:50:27 +0200 Message-Id: <74db37b59b445afebbe5ded22600d50144906475.1496148357.git.jtomko@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: jasowang@redhat.com Subject: [libvirt] [PATCH 04/18] conf: eliminate monster condition in virDomainControllerDefFormat 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.31]); Tue, 30 May 2017 12:53:07 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Move most of the subelement formatting out of the giant if. --- src/conf/domain_conf.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 57f52be..81385d6 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -21460,11 +21460,7 @@ virDomainControllerDefFormat(virBufferPtr buf, break; } =20 - if (pciModel || pciTarget || - def->queues || def->cmd_per_lun || def->max_sectors || def->ioeven= tfd || - def->iothread || - virDomainDeviceInfoNeedsFormat(&def->info, flags) || pcihole64) { - + if (pciModel || pciTarget) { if (pciModel) { modelName =3D virDomainControllerPCIModelNameTypeToString(def-= >opts.pciopts.modelName); if (!modelName) { @@ -21501,17 +21497,17 @@ virDomainControllerDefFormat(virBufferPtr buf, virBufferAddLit(&childBuf, "\n"); } } + } =20 - virDomainControllerDriverFormat(&childBuf, def); + virDomainControllerDriverFormat(&childBuf, def); =20 - if (virDomainDeviceInfoNeedsFormat(&def->info, flags) && - virDomainDeviceInfoFormat(&childBuf, &def->info, flags) < 0) - return -1; + if (virDomainDeviceInfoNeedsFormat(&def->info, flags) && + virDomainDeviceInfoFormat(&childBuf, &def->info, flags) < 0) + return -1; =20 - if (pcihole64) { - virBufferAsprintf(&childBuf, "%lu\n", def->opts.pciopts.pcihole64s= ize); - } + if (pcihole64) { + virBufferAsprintf(&childBuf, "%lu\n", def->opts.pciopts.pcihole64size); } =20 if (virBufferUse(&childBuf)) { --=20 2.10.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 17:54:40 2024 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 1496148793270729.9111293561384; Tue, 30 May 2017 05:53:13 -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 63D532D9FFE; Tue, 30 May 2017 12:53:10 +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 386967E3A2; Tue, 30 May 2017 12:53:10 +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 D402D4A492; Tue, 30 May 2017 12:53:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v4UCr4vM013172 for ; Tue, 30 May 2017 08:53:04 -0400 Received: by smtp.corp.redhat.com (Postfix) id F287D19F00; Tue, 30 May 2017 12:53:03 +0000 (UTC) Received: from icr.brq.redhat.com (dhcp129-58.brq.redhat.com [10.34.129.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id 404C65B81A; Tue, 30 May 2017 12:53:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 63D532D9FFE Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.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 63D532D9FFE From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 30 May 2017 14:50:28 +0200 Message-Id: <02f08e6de6f94e8bf23898ccf0864cb57bfbc68b.1496148357.git.jtomko@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: jasowang@redhat.com Subject: [libvirt] [PATCH 05/18] virDomainControllerDefFormat: move PCI model and target formatting 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.30]); Tue, 30 May 2017 12:53:11 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" These can be formatted right when we know we will need them. No need for separate bool variables. --- src/conf/domain_conf.c | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 81385d6..b47a376 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -21396,7 +21396,7 @@ virDomainControllerDefFormat(virBufferPtr buf, const char *type =3D virDomainControllerTypeToString(def->type); const char *model =3D NULL; const char *modelName =3D NULL; - bool pcihole64 =3D false, pciModel =3D false, pciTarget =3D false; + bool pcihole64 =3D false; virBuffer childBuf =3D VIR_BUFFER_INITIALIZER; =20 virBufferAdjustIndent(&childBuf, virBufferGetIndent(buf, false) + 2); @@ -21446,22 +21446,7 @@ virDomainControllerDefFormat(virBufferPtr buf, case VIR_DOMAIN_CONTROLLER_TYPE_PCI: if (def->opts.pciopts.pcihole64) pcihole64 =3D true; - if (def->opts.pciopts.modelName !=3D VIR_DOMAIN_CONTROLLER_PCI_MOD= EL_NAME_NONE) - pciModel =3D true; - if (def->opts.pciopts.chassisNr !=3D -1 || - def->opts.pciopts.chassis !=3D -1 || - def->opts.pciopts.port !=3D -1 || - def->opts.pciopts.busNr !=3D -1 || - def->opts.pciopts.numaNode !=3D -1) - pciTarget =3D true; - break; - - default: - break; - } - - if (pciModel || pciTarget) { - if (pciModel) { + if (def->opts.pciopts.modelName !=3D VIR_DOMAIN_CONTROLLER_PCI_MOD= EL_NAME_NONE) { modelName =3D virDomainControllerPCIModelNameTypeToString(def-= >opts.pciopts.modelName); if (!modelName) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -21471,8 +21456,11 @@ virDomainControllerDefFormat(virBufferPtr buf, } virBufferAsprintf(&childBuf, "\n", modelNa= me); } - - if (pciTarget) { + if (def->opts.pciopts.chassisNr !=3D -1 || + def->opts.pciopts.chassis !=3D -1 || + def->opts.pciopts.port !=3D -1 || + def->opts.pciopts.busNr !=3D -1 || + def->opts.pciopts.numaNode !=3D -1) { virBufferAddLit(&childBuf, "opts.pciopts.chassisNr !=3D -1) virBufferAsprintf(&childBuf, " chassisNr=3D'%d'", @@ -21497,6 +21485,10 @@ virDomainControllerDefFormat(virBufferPtr buf, virBufferAddLit(&childBuf, "\n"); } } + break; + + default: + break; } =20 virDomainControllerDriverFormat(&childBuf, def); --=20 2.10.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 17:54:40 2024 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 149614879035752.81900363890088; Tue, 30 May 2017 05:53:10 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 450A520B1C; Tue, 30 May 2017 12:53:08 +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 1CC6C183E5; Tue, 30 May 2017 12:53:08 +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 C40DD4A491; Tue, 30 May 2017 12:53:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v4UCr5Ep013179 for ; Tue, 30 May 2017 08:53:05 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6E7B65C7B1; Tue, 30 May 2017 12:53:05 +0000 (UTC) Received: from icr.brq.redhat.com (dhcp129-58.brq.redhat.com [10.34.129.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4AAD719E97; Tue, 30 May 2017 12:53:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 450A520B1C Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.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 450A520B1C From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 30 May 2017 14:50:29 +0200 Message-Id: <3e2e106fa77e0296b9e3f9c9da1d8a8c2c9bedbe.1496148357.git.jtomko@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: jasowang@redhat.com Subject: [libvirt] [PATCH 06/18] conf: add device_iotlb attribute to iommu 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 30 May 2017 12:53:09 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add a new device_iotlb attribute to the iommu device to control the device IOTLB support for intel-iommu. https://bugzilla.redhat.com/show_bug.cgi?id=3D1283251 --- docs/formatdomain.html.in | 9 +++++++ docs/schemas/domaincommon.rng | 5 ++++ src/conf/domain_conf.c | 15 ++++++++++- src/conf/domain_conf.h | 1 + .../qemuxml2argv-intel-iommu-device-iotlb.xml | 31 ++++++++++++++++++= ++++ .../qemuxml2xmlout-intel-iommu-device-iotlb.xml | 1 + tests/qemuxml2xmltest.c | 1 + 7 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-device-= iotlb.xml create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-dev= ice-iotlb.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 07208ee..2f1e030 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -7449,6 +7449,15 @@ qemu-kvm -net nic,model=3D? /dev/null Since 3.4.0 (QEMU/KVM only)

+
device_iotlb
+
+

+ The device_iotlb attribute with possible values + on and off can be used to + turn on the device IOTLB descriptor. + Since 3.5.0 (QEMU/KVM only) +

+
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 4d9f8d1..6c3e885 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3964,6 +3964,11 @@ + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b47a376..c83af5d 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -14201,6 +14201,14 @@ virDomainIOMMUDefParseXML(xmlNodePtr node, } iommu->caching_mode =3D val; } + VIR_FREE(tmp); + if ((tmp =3D virXPathString("string(./driver/@device_iotlb)", ctxt))) { + if ((val =3D virTristateSwitchTypeFromString(tmp)) < 0) { + virReportError(VIR_ERR_XML_ERROR, _("unknown device_iotlb valu= e: %s"), tmp); + goto cleanup; + } + iommu->device_iotlb =3D val; + } =20 VIR_FREE(tmp); if ((tmp =3D virXPathString("string(./driver/@eim)", ctxt))) { @@ -24246,7 +24254,8 @@ virDomainIOMMUDefFormat(virBufferPtr buf, virBufferAdjustIndent(&childBuf, virBufferGetIndent(buf, false) + 2); =20 if (iommu->intremap !=3D VIR_TRISTATE_SWITCH_ABSENT || - iommu->caching_mode !=3D VIR_TRISTATE_SWITCH_ABSENT) { + iommu->caching_mode !=3D VIR_TRISTATE_SWITCH_ABSENT || + iommu->device_iotlb !=3D VIR_TRISTATE_SWITCH_ABSENT) { virBufferAddLit(&childBuf, "intremap !=3D VIR_TRISTATE_SWITCH_ABSENT) { virBufferAsprintf(&childBuf, " intremap=3D'%s'", @@ -24260,6 +24269,10 @@ virDomainIOMMUDefFormat(virBufferPtr buf, virBufferAsprintf(&childBuf, " eim=3D'%s'", virTristateSwitchTypeToString(iommu->eim)); } + if (iommu->device_iotlb !=3D VIR_TRISTATE_SWITCH_ABSENT) { + virBufferAsprintf(&childBuf, " device_iotlb=3D'%s'", + virTristateSwitchTypeToString(iommu->device_= iotlb)); + } virBufferAddLit(&childBuf, "/>\n"); } =20 diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 83e0672..cb570ef 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2212,6 +2212,7 @@ struct _virDomainIOMMUDef { virTristateSwitch intremap; virTristateSwitch caching_mode; virTristateSwitch eim; + virTristateSwitch device_iotlb; }; /* * Guest VM main configuration diff --git a/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-device-iotlb.x= ml b/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-device-iotlb.xml new file mode 100644 index 0000000..0cdf2aa --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-device-iotlb.xml @@ -0,0 +1,31 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + +
+ + + + + + + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-device-iot= lb.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-device-iotlb.x= ml new file mode 120000 index 0000000..3120d9f --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-device-iotlb.xml @@ -0,0 +1 @@ +../qemuxml2argvdata/qemuxml2argv-intel-iommu-device-iotlb.xml \ No newline at end of file diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index fff13e2..5e8cead 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1128,6 +1128,7 @@ mymain(void) DO_TEST("intel-iommu-ioapic", NONE); DO_TEST("intel-iommu-caching-mode", NONE); DO_TEST("intel-iommu-eim", NONE); + DO_TEST("intel-iommu-device-iotlb", NONE); =20 DO_TEST("cpu-check-none", NONE); DO_TEST("cpu-check-partial", NONE); --=20 2.10.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 17:54:40 2024 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 1496148797257135.8382195821963; Tue, 30 May 2017 05:53:17 -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 037D680461; Tue, 30 May 2017 12:53:14 +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 CE2F218C75; Tue, 30 May 2017 12:53:13 +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 857C5180BAFB; Tue, 30 May 2017 12:53:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v4UCr6u6013187 for ; Tue, 30 May 2017 08:53:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9049A19E97; Tue, 30 May 2017 12:53:06 +0000 (UTC) Received: from icr.brq.redhat.com (dhcp129-58.brq.redhat.com [10.34.129.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id AA7EF5C2F3; Tue, 30 May 2017 12:53:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 037D680461 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.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 037D680461 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 30 May 2017 14:50:30 +0200 Message-Id: <7c215e39ac6c11946b0eed3f5b178b7b69b44bdf.1496148357.git.jtomko@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: jasowang@redhat.com Subject: [libvirt] [PATCH 07/18] qemu: format device-iotlb on intel-iommu command line 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.28]); Tue, 30 May 2017 12:53:14 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Format the device-iotlb attribute. https://bugzilla.redhat.com/show_bug.cgi?id=3D1283251 --- src/qemu/qemu_capabilities.c | 3 +++ src/qemu/qemu_capabilities.h | 3 +++ src/qemu/qemu_command.c | 11 +++++++++++ tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml | 1 + .../qemuxml2argv-intel-iommu-device-iotlb.args | 19 +++++++++++++++= ++++ tests/qemuxml2argvtest.c | 7 +++++++ 6 files changed, 44 insertions(+) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-device-= iotlb.args diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 7ea8505..ae466d7 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -372,6 +372,8 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, "intel-iommu.intremap", "intel-iommu.caching-mode", "intel-iommu.eim", + + "intel-iommu.device-iotlb", /* 260 */ ); =20 =20 @@ -1730,6 +1732,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsObjec= tPropsIntelIOMMU[] =3D { { "intremap", QEMU_CAPS_INTEL_IOMMU_INTREMAP }, { "caching-mode", QEMU_CAPS_INTEL_IOMMU_CACHING_MODE }, { "eim", QEMU_CAPS_INTEL_IOMMU_EIM }, + { "device-iotlb", QEMU_CAPS_INTEL_IOMMU_DEVICE_IOTLB }, }; =20 /* see documentation for virQEMUCapsQMPSchemaGetByPath for the query forma= t */ diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index eba9814..275bbcf 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -411,6 +411,9 @@ typedef enum { QEMU_CAPS_INTEL_IOMMU_CACHING_MODE, /* intel-iommu.caching-mode */ QEMU_CAPS_INTEL_IOMMU_EIM, /* intel-iommu.eim */ =20 + /* 260 */ + QEMU_CAPS_INTEL_IOMMU_DEVICE_IOTLB, /* intel-iommu.device-iotlb */ + QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; =20 diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 015af10..1f54ba0 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6697,6 +6697,13 @@ qemuBuildIOMMUCommandLine(virCommandPtr cmd, "with this QEMU binary")); return -1; } + if (iommu->device_iotlb !=3D VIR_TRISTATE_SWITCH_ABSENT && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_INTEL_IOMMU_DEVICE_IOTLB))= { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("iommu: device IOTLB is not supported " + "with this QEMU binary")); + return -1; + } break; case VIR_DOMAIN_IOMMU_MODEL_LAST: break; @@ -6734,6 +6741,10 @@ qemuBuildIOMMUCommandLine(virCommandPtr cmd, virBufferAsprintf(&opts, ",eim=3D%s", virTristateSwitchTypeToString(iommu->eim)); } + if (iommu->device_iotlb !=3D VIR_TRISTATE_SWITCH_ABSENT) { + virBufferAsprintf(&opts, ",device-iotlb=3D%s", + virTristateSwitchTypeToString(iommu->device_= iotlb)); + } case VIR_DOMAIN_IOMMU_MODEL_LAST: break; } diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_2.9.0.x86_64.xml index 95b04dd..d51ee46 100644 --- a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml @@ -215,6 +215,7 @@ + 2009000 0 (v2.9.0) diff --git a/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-device-iotlb.a= rgs b/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-device-iotlb.args new file mode 100644 index 0000000..6d8f8e2 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-device-iotlb.args @@ -0,0 +1,19 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-machine q35,accel=3Dkvm,kernel_irqchip=3Dsplit \ +-m 214 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nographic \ +-nodefaults \ +-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \ +-no-acpi \ +-boot c \ +-device intel-iommu,intremap=3Don,device-iotlb=3Don diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index b360185..508d7d9 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2536,6 +2536,13 @@ mymain(void) QEMU_CAPS_INTEL_IOMMU_INTREMAP, QEMU_CAPS_INTEL_IOMMU_EIM, QEMU_CAPS_DEVICE_INTEL_IOMMU); + DO_TEST("intel-iommu-device-iotlb", + QEMU_CAPS_MACHINE_OPT, + QEMU_CAPS_MACHINE_KERNEL_IRQCHIP, + QEMU_CAPS_MACHINE_KERNEL_IRQCHIP_SPLIT, + QEMU_CAPS_INTEL_IOMMU_INTREMAP, + QEMU_CAPS_INTEL_IOMMU_DEVICE_IOTLB, + QEMU_CAPS_DEVICE_INTEL_IOMMU); =20 DO_TEST("cpu-hotplug-startup", QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS); =20 --=20 2.10.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 17:54:40 2024 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 1496148797209103.38381753109547; Tue, 30 May 2017 05:53:17 -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 D4D0813A5E; Tue, 30 May 2017 12:53:13 +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 A370418C67; Tue, 30 May 2017 12:53:13 +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 5EC77180BAFC; Tue, 30 May 2017 12:53:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v4UCrCqR013223 for ; Tue, 30 May 2017 08:53:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id 471D55B819; Tue, 30 May 2017 12:53:12 +0000 (UTC) Received: from icr.brq.redhat.com (dhcp129-58.brq.redhat.com [10.34.129.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id DA8BB19F00; Tue, 30 May 2017 12:53:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D4D0813A5E Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.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 D4D0813A5E From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 30 May 2017 14:50:31 +0200 Message-Id: <40161572d70fc6fbc6e1f5945716eae3b26440c4.1496148357.git.jtomko@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: jasowang@redhat.com Subject: [libvirt] [PATCH 08/18] qemuxml2xmltest: add virtio-options test 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.29]); Tue, 30 May 2017 12:53:14 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add a test case with all the virtio devices we know to demonstrate the addition of new options. https://bugzilla.redhat.com/show_bug.cgi?id=3D1283251 --- .../qemuxml2argv-virtio-options.xml | 92 ++++++++++++++++++= ++++ .../qemuxml2xmlout-virtio-options.xml | 92 ++++++++++++++++++= ++++ tests/qemuxml2xmltest.c | 1 + 3 files changed, 185 insertions(+) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-options.= xml diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml b/tests= /qemuxml2argvdata/qemuxml2argv-virtio-options.xml new file mode 100644 index 0000000..9ead938 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml @@ -0,0 +1,92 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + + +
+ + + + + +
+ + +
+ + +
+ + +
+ + + +
+ + + + +
+ + + + + +
+ + + + +
+ + + + +
+ + +
+ + +
+ + +
+ + + +
+ + + +