This introduces a new nested capability element of type 'mdev' with the
resulting XML of the following format:
<device>
...
<capability type='pci'>
...
<capability type='mdev'>
<type id='vendor-supplied-id'>
<description>optional, raw, unstructured resource allocation data
</description>
<device_api>vfio-pci</device_api>
<available_instances>NUM</available_instances>
</type>
...
<type>
...
</type>
</capability>
</capability>
...
</device>
Signed-off-by: Erik Skultety <eskultet(a)redhat.com>
---
src/conf/node_device_conf.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index 1f13484d9b..99211de6f3 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -264,6 +264,30 @@ virNodeDeviceCapPCIDefFormat(virBufferPtr buf,
virBufferAsprintf(buf, "<capability type='%s'/>\n",
virPCIHeaderTypeToString(data->pci_dev.hdrType));
}
+ if (data->pci_dev.mdevs) {
+ virBufferAddLit(buf, "<capability type='mdev'>\n");
+ virBufferAdjustIndent(buf, 2);
+ for (i = 0; i < data->pci_dev.nmdevs; i++) {
+ virNodeDevCapMdevPtr mdev = data->pci_dev.mdevs[i];
+ virBufferEscapeString(buf, "<type id='%s'>\n",
mdev->type);
+ virBufferAdjustIndent(buf, 2);
+ if (mdev->name)
+ virBufferAsprintf(buf, "<name>%s</name>\n",
+ mdev->name);
+ if (mdev->description)
+ virBufferAsprintf(buf,
"<description>%s</description>\n",
+ mdev->description);
+ virBufferAsprintf(buf,
"<device_api>%s</device_api>\n",
+ mdev->device_api);
+ virBufferAsprintf(buf,
+
"<available_instances>%u</available_instances>\n",
+ mdev->available_instances);
+ virBufferAdjustIndent(buf, -2);
+ virBufferAddLit(buf, "</type>\n");
+ }
+ virBufferAdjustIndent(buf, -2);
+ virBufferAddLit(buf, "</capability>\n");
+ }
if (data->pci_dev.nIommuGroupDevices) {
virBufferAsprintf(buf, "<iommuGroup number='%d'>\n",
data->pci_dev.iommuGroupNumber);
--
2.12.2