From nobody Mon Feb 9 04:03:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) client-ip=209.132.183.37; envelope-from=libvir-list-bounces@redhat.com; helo=mx5-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com [209.132.183.37]) by mx.zohomail.com with SMTPS id 1488298723401140.8608191906086; Tue, 28 Feb 2017 08:18:43 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1SGFc7V037448; Tue, 28 Feb 2017 11:15:38 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1SGCr5J004484 for ; Tue, 28 Feb 2017 11:12:53 -0500 Received: from inaba.usersys.redhat.com (ovpn-204-32.brq.redhat.com [10.40.204.32]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1SGCk4u020819 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 28 Feb 2017 11:12:53 -0500 From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Feb 2017 17:12:39 +0100 Message-Id: <1488298364-16896-8-git-send-email-abologna@redhat.com> In-Reply-To: <1488298364-16896-1-git-send-email-abologna@redhat.com> References: <1488298364-16896-1-git-send-email-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-loop: libvir-list@redhat.com Subject: [libvirt] [RFC PATCH 07/12] 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-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 fb33e9c..93e706c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1774,6 +1774,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: @@ -8694,6 +8695,7 @@ virDomainControllerDefParseXML(xmlNodePtr node, goto error; } def->idx =3D idxVal; + VIR_FREE(idx); } =20 cur =3D node->children; @@ -8725,6 +8727,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; } } @@ -8940,6 +8943,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; @@ -20967,6 +20987,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; @@ -21007,6 +21028,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 1e53cc3..0cf9c58 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -768,6 +768,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.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list