From nobody Fri May 16 10:19:52 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.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 1496419708802903.4442784853815; Fri, 2 Jun 2017 09:08:28 -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 7549E61E51; Fri, 2 Jun 2017 16:08:25 +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 E9E6682480; Fri, 2 Jun 2017 16:08:24 +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 8F0EA4A496; Fri, 2 Jun 2017 16:08:24 +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 v52G8AYL011518 for ; Fri, 2 Jun 2017 12:08:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id C88697F468; Fri, 2 Jun 2017 16:08:10 +0000 (UTC) Received: from inaba.usersys.redhat.com (dhcp129-60.brq.redhat.com [10.34.129.60]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4EDBE84426 for ; Fri, 2 Jun 2017 16:08:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7549E61E51 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 7549E61E51 From: Andrea Bolognani To: libvir-list@redhat.com Date: Fri, 2 Jun 2017 18:07:37 +0200 Message-Id: <1496419671-7600-13-git-send-email-abologna@redhat.com> In-Reply-To: <1496419671-7600-1-git-send-email-abologna@redhat.com> References: <1496419671-7600-1-git-send-email-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 12/26] conf: Parse and format 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.39]); Fri, 02 Jun 2017 16:08:26 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" --- src/conf/domain_conf.c | 24 ++++++++++++++++++++++++ src/conf/domain_conf.h | 1 + 2 files changed, 25 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d5dff8e..deb0dce 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1803,6 +1803,7 @@ virDomainControllerDefNew(virDomainControllerType typ= e) def->opts.pciopts.chassis =3D -1; def->opts.pciopts.port =3D -1; def->opts.pciopts.busNr =3D -1; + def->opts.pciopts.idx =3D -1; def->opts.pciopts.numaNode =3D -1; break; case VIR_DOMAIN_CONTROLLER_TYPE_IDE: @@ -8909,6 +8910,7 @@ virDomainControllerDefParseXML(xmlNodePtr node, goto error; } def->idx =3D idxVal; + VIR_FREE(idx); } =20 cur =3D node->children; @@ -8940,6 +8942,7 @@ virDomainControllerDefParseXML(xmlNodePtr node, chassis =3D virXMLPropString(cur, "chassis"); port =3D virXMLPropString(cur, "port"); busNr =3D virXMLPropString(cur, "busNr"); + idx =3D virXMLPropString(cur, "index"); processedTarget =3D true; } } @@ -9155,6 +9158,23 @@ virDomainControllerDefParseXML(xmlNodePtr node, goto error; } } + if (idx) { + if (virStrToLong_i(idx, NULL, 0, + &def->opts.pciopts.idx) < 0) { + virReportError(VIR_ERR_XML_ERROR, + _("Invalid index '%s' in PCI controller"), + idx); + goto error; + } + if (def->opts.pciopts.idx < 0 || + def->opts.pciopts.idx > 31) { + virReportError(VIR_ERR_XML_ERROR, + _("PCI controller index '%s' out of range " + "- must be 0-31"), + idx); + goto error; + } + } if (numaNode >=3D 0) def->opts.pciopts.numaNode =3D numaNode; break; @@ -21413,6 +21433,7 @@ virDomainControllerDefFormat(virBufferPtr buf, def->opts.pciopts.chassis !=3D -1 || def->opts.pciopts.port !=3D -1 || def->opts.pciopts.busNr !=3D -1 || + def->opts.pciopts.idx !=3D -1 || def->opts.pciopts.numaNode !=3D -1) pciTarget =3D true; break; @@ -21453,6 +21474,9 @@ virDomainControllerDefFormat(virBufferPtr buf, if (def->opts.pciopts.busNr !=3D -1) virBufferAsprintf(buf, " busNr=3D'%d'", def->opts.pciopts.busNr); + if (def->opts.pciopts.idx !=3D -1) + virBufferAsprintf(buf, " index=3D'%d'", + def->opts.pciopts.idx); if (def->opts.pciopts.numaNode =3D=3D -1) { virBufferAddLit(buf, "/>\n"); } else { diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 83e0672..5a21289 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -780,6 +780,7 @@ struct _virDomainPCIControllerOpts { int chassis; int port; int busNr; /* used by pci-expander-bus, -1 =3D=3D unspecified */ + int idx; /* used by spapr-pci-host-bridge, -1 =3D=3D unspecified */ /* numaNode is a *subelement* of target (to match existing * item in memory target config) -1 =3D=3D unspecified */ --=20 2.7.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list