The 'chip-id' attribute indicates which chip/socket that owns the
PowerNV pcie-root controller.
Reviewed-by: Peter Krempa <pkrempa(a)redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413(a)gmail.com>
---
docs/formatdomain.rst | 6 ++++++
docs/schemas/domaincommon.rng | 5 +++++
src/conf/domain_conf.c | 15 +++++++++++++++
src/conf/domain_conf.h | 1 +
4 files changed, 27 insertions(+)
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
index e2f99c60a6..1e44d9a987 100644
--- a/docs/formatdomain.rst
+++ b/docs/formatdomain.rst
@@ -3898,6 +3898,12 @@ generated by libvirt. :since:`Since 1.2.19 (QEMU only).`
``index``
pci-root controllers for pSeries guests use this attribute to record the
order they will show up in the guest. :since:`Since 3.6.0`
+``chip-id``
+ pcie-root controllers for ``powernv`` domains use this attribute to indicate
+ the chip that will own the controller. A chip is equivalent to a CPU socket.
+ E.g. a ``powernv`` domain with ``<topology> sockets=3`` will have 3 chips.
+ chip-id=0 refers to the first chip, chip-id=1 refers to the second chip and
+ so on. :since:`Since 8.1.0`
For machine types which provide an implicit PCI bus, the pci-root controller
with index=0 is auto-added and required to use PCI devices. pci-root has no
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 4c3a1c28a7..47a3107ea1 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2655,6 +2655,11 @@
<ref name="unsignedInt"/>
</element>
</optional>
+ <optional>
+ <attribute name="chip-id">
+ <ref name="uint8"/>
+ </attribute>
+ </optional>
</element>
</optional>
<!-- *-root controllers have an optional element
"pcihole64"-->
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 72ee46026a..803c51d63a 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2380,6 +2380,7 @@ virDomainControllerDefNew(virDomainControllerType type)
def->opts.pciopts.busNr = -1;
def->opts.pciopts.targetIndex = -1;
def->opts.pciopts.numaNode = -1;
+ def->opts.pciopts.chipId = -1;
break;
case VIR_DOMAIN_CONTROLLER_TYPE_XENBUS:
def->opts.xenbusopts.maxGrantFrames = -1;
@@ -9584,6 +9585,16 @@ virDomainControllerDefParseXML(virDomainXMLOption *xmlopt,
virReportError(VIR_ERR_XML_ERROR,
_("Invalid target index '%i' in PCI
controller"),
def->opts.pciopts.targetIndex);
+
+ if ((rc = virXMLPropInt(targetNodes[0], "chip-id", 0,
VIR_XML_PROP_NONE,
+ &def->opts.pciopts.chipId,
+ def->opts.pciopts.chipId)) < 0)
+ return NULL;
+
+ if ((rc == 1) && def->opts.pciopts.chipId == -1)
+ virReportError(VIR_ERR_XML_ERROR,
+ _("Invalid target chip-id '%i' in PCI
controller"),
+ def->opts.pciopts.chipId);
}
} else if (ntargetNodes > 1) {
virReportError(VIR_ERR_XML_ERROR, "%s",
@@ -23888,6 +23899,7 @@ virDomainControllerDefFormat(virBuffer *buf,
def->opts.pciopts.busNr != -1 ||
def->opts.pciopts.targetIndex != -1 ||
def->opts.pciopts.numaNode != -1 ||
+ def->opts.pciopts.chipId != -1 ||
def->opts.pciopts.hotplug != VIR_TRISTATE_SWITCH_ABSENT) {
virBufferAddLit(&childBuf, "<target");
if (def->opts.pciopts.chassisNr != -1)
@@ -23905,6 +23917,9 @@ virDomainControllerDefFormat(virBuffer *buf,
if (def->opts.pciopts.targetIndex != -1)
virBufferAsprintf(&childBuf, " index='%d'",
def->opts.pciopts.targetIndex);
+ if (def->opts.pciopts.chipId != -1)
+ virBufferAsprintf(&childBuf, " chip-id='%d'",
+ def->opts.pciopts.chipId);
if (def->opts.pciopts.hotplug != VIR_TRISTATE_SWITCH_ABSENT) {
virBufferAsprintf(&childBuf, " hotplug='%s'",
virTristateSwitchTypeToString(def->opts.pciopts.hotplug));
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 1d9c689e83..93c5092f35 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -751,6 +751,7 @@ struct _virDomainPCIControllerOpts {
int port;
int busNr; /* used by pci-expander-bus, -1 == unspecified */
int targetIndex; /* used by spapr-pci-host-bridge, -1 == unspecified */
+ int chipId; /* used by powernv pcie-root controllers, -1 == unspecified */
/* numaNode is a *subelement* of target (to match existing
* item in memory target config) -1 == unspecified
*/
--
2.34.1