QEMU 2.9 introduces the pcie-root-port device, which is
a generic version of the existing ioh3420 device.
Make the new device available to libvirt users.
Resolves:
https://bugzilla.redhat.com/show_bug.cgi?id=1408808
---
docs/schemas/domaincommon.rng | 1 +
src/conf/domain_conf.c | 4 +++-
src/conf/domain_conf.h | 1 +
src/qemu/qemu_capabilities.c | 2 ++
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 18 +++++++++++++++---
tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml | 1 +
7 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 5e59328..e4cf990 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1904,6 +1904,7 @@
<value>i82801b11-bridge</value>
<!-- implementations of 'pcie-root-port' -->
<value>ioh3420</value>
+ <value>pcie-root-port</value>
<!-- implementations of 'pcie-switch-upstream-port'
-->
<value>x3130-upstream</value>
<!-- implementations of 'pcie-switch-downstream-port'
-->
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 88d419e..f110c31 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -338,7 +338,9 @@ VIR_ENUM_IMPL(virDomainControllerPCIModelName,
"x3130-upstream",
"xio3130-downstream",
"pxb",
- "pxb-pcie")
+ "pxb-pcie",
+ "pcie-root-port",
+);
VIR_ENUM_IMPL(virDomainControllerModelSCSI, VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST,
"auto",
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index b788a82..72901ca 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -694,6 +694,7 @@ typedef enum {
VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_XIO3130_DOWNSTREAM,
VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PXB,
VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PXB_PCIE,
+ VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PCIE_ROOT_PORT,
VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_LAST
} virDomainControllerPCIModelName;
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 70f9ed7..453bc8a 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -359,6 +359,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
"query-cpu-model-expansion", /* 245 */
"virtio-net.host_mtu",
"spice-rendernode",
+ "pcie-root-port",
);
@@ -1619,6 +1620,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
{ "ivshmem-plain", QEMU_CAPS_DEVICE_IVSHMEM_PLAIN },
{ "ivshmem-doorbell", QEMU_CAPS_DEVICE_IVSHMEM_DOORBELL },
{ "vhost-scsi", QEMU_CAPS_DEVICE_VHOST_SCSI },
+ { "pcie-root-port", QEMU_CAPS_DEVICE_PCIE_ROOT_PORT },
};
static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBalloon[] = {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index cc9f46e..79de977 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -394,6 +394,7 @@ typedef enum {
QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION, /* qmp query-cpu-model-expansion */
QEMU_CAPS_VIRTIO_NET_HOST_MTU, /* virtio-net-*.host_mtu */
QEMU_CAPS_SPICE_RENDERNODE, /* -spice rendernode */
+ QEMU_CAPS_DEVICE_PCIE_ROOT_PORT, /* -device pcie-root-port */
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index b484b7b..7e5f727 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2874,20 +2874,32 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
def->opts.pciopts.modelName);
goto error;
}
- if (def->opts.pciopts.modelName
- != VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_IOH3420) {
+ if ((def->opts.pciopts.modelName !=
+ VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_IOH3420) &&
+ (def->opts.pciopts.modelName !=
+ VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PCIE_ROOT_PORT)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("PCI controller model name '%s' "
"is not valid for a pcie-root-port"),
modelName);
goto error;
}
- if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_IOH3420)) {
+ if ((def->opts.pciopts.modelName ==
+ VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_IOH3420) &&
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_IOH3420)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("the pcie-root-port (ioh3420) "
"controller is not supported in this QEMU
binary"));
goto error;
}
+ if ((def->opts.pciopts.modelName ==
+ VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PCIE_ROOT_PORT) &&
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PCIE_ROOT_PORT)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("the pcie-root-port (pcie-root-port) "
+ "controller is not supported in this QEMU
binary"));
+ goto error;
+ }
virBufferAsprintf(&buf, "%s,port=0x%x,chassis=%d,id=%s",
modelName, def->opts.pciopts.port,
diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
index 334f8e7..a397615 100644
--- a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
@@ -202,6 +202,7 @@
<flag name='drive-iotune-group'/>
<flag name='query-cpu-model-expansion'/>
<flag name='virtio-net.host_mtu'/>
+ <flag name='pcie-root-port'/>
<version>2008050</version>
<kvmVersion>0</kvmVersion>
<package> (v2.8.0-1961-g5b10b94bd5)</package>
--
2.7.4