The 'chip-id' attribute indicates which chip/socket that owns the
PowerNV pcie-root controller.
Signed-off-by: Daniel Henrique Barboza <danielhb413(a)gmail.com>
---
docs/formatdomain.rst | 4 ++++
docs/schemas/domaincommon.rng | 5 +++++
src/conf/domain_conf.c | 15 +++++++++++++++
src/conf/domain_conf.h | 1 +
4 files changed, 25 insertions(+)
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
index acd9020830..d38c566650 100644
--- a/docs/formatdomain.rst
+++ b/docs/formatdomain.rst
@@ -3896,6 +3896,10 @@ 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 single chip can hold multiple pcie-root
+ controllers. :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 7cfc22bc72..fed82c79e1 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2654,6 +2654,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 be8dc82ccf..d1cda8c3f5 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2379,6 +2379,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;
@@ -9624,6 +9625,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",
@@ -24081,6 +24092,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)
@@ -24098,6 +24110,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 07fbf9780a..db9021146d 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -750,6 +750,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