<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 23, 2017 at 8:33 PM, Andrea Bolognani <span dir="ltr"><<a href="mailto:abologna@redhat.com" target="_blank">abologna@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Signed-off-by: Andrea Bolognani <<a href="mailto:abologna@redhat.com">abologna@redhat.com</a>><br>
---<br>
docs/<a href="http://formatdomain.html.in" rel="noreferrer" target="_blank">formatdomain.html.in</a> | 5 +++++<br>
docs/schemas/domaincommon.rng | 5 +++++<br>
src/conf/domain_conf.c | 24 ++++++++++++++++++++++++<br>
src/conf/domain_conf.h | 1 +<br>
4 files changed, 35 insertions(+)<br>
<br>
diff --git a/docs/<a href="http://formatdomain.html.in" rel="noreferrer" target="_blank">formatdomain.html.in</a> b/docs/<a href="http://formatdomain.html.in" rel="noreferrer" target="_blank">formatdomain.html.in</a><br>
index a55a9e1..159c243 100644<br>
--- a/docs/<a href="http://formatdomain.html.in" rel="noreferrer" target="_blank">formatdomain.html.in</a><br>
+++ b/docs/<a href="http://formatdomain.html.in" rel="noreferrer" target="_blank">formatdomain.html.in</a><br>
@@ -3768,6 +3768,11 @@<br>
libvirt API to attach host devices to the correct<br>
pci-expander-bus when assigning them to the domain).<br>
</dd><br>
+ <dt><code>index</code></dt><br>
+ <dd><br>
+ pci-root controllers for pSeries guests will use this attribute to<br>
+ record the order they will show up in the guest.<br>
+ </dd><br>
</dl><br>
<p><br>
For machine types which provide an implicit PCI bus, the pci-root<br>
diff --git a/docs/schemas/domaincommon.<wbr>rng b/docs/schemas/domaincommon.<wbr>rng<br>
index e259e3e..39eff46 100644<br>
--- a/docs/schemas/domaincommon.<wbr>rng<br>
+++ b/docs/schemas/domaincommon.<wbr>rng<br>
@@ -1997,6 +1997,11 @@<br>
</attribute><br>
</optional><br>
<optional><br>
+ <attribute name='index'><br>
+ <ref name='uint8'/><br>
+ </attribute><br>
+ </optional><br>
+ <optional><br>
<element name='node'><br>
<ref name='unsignedInt'/><br>
</element><br>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c<br>
index 29268a9..1538747 100644<br>
--- a/src/conf/domain_conf.c<br>
+++ b/src/conf/domain_conf.c<br>
@@ -1866,6 +1866,7 @@ virDomainControllerDefNew(<wbr>virDomainControllerType type)<br>
def->opts.pciopts.chassis = -1;<br>
def->opts.pciopts.port = -1;<br>
def->opts.pciopts.busNr = -1;<br>
+ def->opts.pciopts.idx = -1;<br>
def->opts.pciopts.numaNode = -1;<br>
break;<br>
case VIR_DOMAIN_CONTROLLER_TYPE_<wbr>IDE:<br>
@@ -9099,6 +9100,7 @@ virDomainControllerDefParseXML<wbr>(xmlNodePtr node,<br>
goto error;<br>
}<br>
def->idx = idxVal;<br>
+ VIR_FREE(idx);<br>
}<br>
<br>
cur = node->children;<br>
@@ -9130,6 +9132,7 @@ virDomainControllerDefParseXML<wbr>(xmlNodePtr node,<br>
chassis = virXMLPropString(cur, "chassis");<br>
port = virXMLPropString(cur, "port");<br>
busNr = virXMLPropString(cur, "busNr");<br>
+ idx = virXMLPropString(cur, "index");<br>
processedTarget = true;<br>
}<br>
}<br>
@@ -9348,6 +9351,23 @@ virDomainControllerDefParseXML<wbr>(xmlNodePtr node,<br>
goto error;<br>
}<br>
}<br>
+ if (idx) {<br>
+ if (virStrToLong_i(idx, NULL, 0,<br>
+ &def->opts.pciopts.idx) < 0) {<br>
+ virReportError(VIR_ERR_XML_<wbr>ERROR,<br>
+ _("Invalid target index '%s' in PCI controller"),<br>
+ idx);<br>
+ goto error;<br>
+ }<br>
+ if (def->opts.pciopts.idx < 0 ||<br>
+ def->opts.pciopts.idx > 31) {<br>
+ virReportError(VIR_ERR_XML_<wbr>ERROR,<br>
+ _("PCI controller target index '%s' out of "<br>
+ "range - must be 0-31"),<br>
+ idx);<br>
+ goto error;<br>
+ }<br>
+ }<br></blockquote><div><br></div><div>Better to enforce def->idx == 0 to have def->opts.pciopts.idx as 0 ? That would always assure def->idx == 0 as the implicit PHB.</div><div><br></div><div>Qemu today allows "-device spapr-pci-host-bridge,index=X,id=pci.0" when X != 0, and we will generate it for implcit phb(which we normally dont)</div><div>when def->opts.pciopts.idx != 0 in Patch 18. Not sure what all problems/confusions could come because of this inconsistency.</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
if (numaNode >= 0)<br>
def->opts.pciopts.numaNode = numaNode;<br>
break;<br>
@@ -21748,6 +21768,7 @@ virDomainControllerDefFormat(<wbr>virBufferPtr buf,<br>
def->opts.pciopts.chassis != -1 ||<br>
def->opts.pciopts.port != -1 ||<br>
def->opts.pciopts.busNr != -1 ||<br>
+ def->opts.pciopts.idx != -1 ||<br>
def->opts.pciopts.numaNode != -1) {<br>
virBufferAddLit(&childBuf, "<target");<br>
if (def->opts.pciopts.chassisNr != -1)<br>
@@ -21762,6 +21783,9 @@ virDomainControllerDefFormat(<wbr>virBufferPtr buf,<br>
if (def->opts.pciopts.busNr != -1)<br>
virBufferAsprintf(&childBuf, " busNr='%d'",<br>
def->opts.pciopts.busNr);<br>
+ if (def->opts.pciopts.idx != -1)<br>
+ virBufferAsprintf(&childBuf, " index='%d'",<br>
+ def->opts.pciopts.idx);<br>
if (def->opts.pciopts.numaNode == -1) {<br>
virBufferAddLit(&childBuf, "/>\n");<br>
} else {<br>
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h<br>
index 6d9ee97..53a10db 100644<br>
--- a/src/conf/domain_conf.h<br>
+++ b/src/conf/domain_conf.h<br>
@@ -785,6 +785,7 @@ struct _virDomainPCIControllerOpts {<br>
int chassis;<br>
int port;<br>
int busNr; /* used by pci-expander-bus, -1 == unspecified */<br>
+ int idx; /* used by spapr-pci-host-bridge, -1 == unspecified */<br>
/* numaNode is a *subelement* of target (to match existing<br>
* item in memory target config) -1 == unspecified<br>
*/<br>
<span class="gmail-HOEnZb"><font color="#888888">--<br>
2.7.5<br>
<br>
--<br>
libvir-list mailing list<br>
<a href="mailto:libvir-list@redhat.com">libvir-list@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/libvir-list" rel="noreferrer" target="_blank">https://www.redhat.com/<wbr>mailman/listinfo/libvir-list</a><br>
</font></span></blockquote></div><br></div></div>