Add support for the pcie-root implementation that PowerNV8 domains uses,
pnv-phb3.
It consists of a PCI model name that isn't supposed to be changed by
users, so no doc changes in formatdomain.rst were made.
Signed-off-by: Daniel Henrique Barboza <danielhb413(a)gmail.com>
---
docs/schemas/domaincommon.rng | 2 ++
src/conf/domain_conf.c | 1 +
src/conf/domain_conf.h | 1 +
src/qemu/qemu_domain_address.c | 3 +++
src/qemu/qemu_validate.c | 8 ++++++--
tests/qemuxml2xmloutdata/powernv8-basic.ppc64-latest.xml | 4 +++-
6 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index a467fc1437..4c3a1c28a7 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2597,6 +2597,8 @@
<value>pci-bridge</value>
<!-- implementations of "dmi-to-pci-bridge" -->
<value>i82801b11-bridge</value>
+ <!-- implementations of "pcie-root" -->
+ <value>pnv-phb3</value>
<!-- implementations of "pcie-to-pci-bridge" -->
<value>pcie-pci-bridge</value>
<!-- implementations of "pcie-root-port" -->
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 8db4d44d28..57ab5b19dd 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -439,6 +439,7 @@ VIR_ENUM_IMPL(virDomainControllerPCIModelName,
"spapr-pci-host-bridge",
"pcie-pci-bridge",
"pnv-phb3-root-port",
+ "pnv-phb3",
);
VIR_ENUM_IMPL(virDomainControllerModelSCSI,
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 7aef7659e9..1d9c689e83 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -647,6 +647,7 @@ typedef enum {
VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_SPAPR_PCI_HOST_BRIDGE,
VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PCIE_PCI_BRIDGE,
VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PNV_PHB3_ROOT_PORT,
+ VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PNV_PHB3,
VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_LAST
} virDomainControllerPCIModelName;
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index eeececa936..f08fea32f5 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -2449,6 +2449,9 @@ qemuDomainPCIControllerSetDefaultModelName(virDomainControllerDef
*cont,
*modelName = VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_SPAPR_PCI_HOST_BRIDGE;
break;
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT:
+ if (qemuDomainIsPowerNV(def))
+ *modelName = VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PNV_PHB3;
+ break;
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_DEFAULT:
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST:
break;
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index ea7861b232..e8d86a2280 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -3430,6 +3430,8 @@ virValidateControllerPCIModelNameToQEMUCaps(int modelName)
return QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE;
case VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PNV_PHB3_ROOT_PORT:
return QEMU_CAPS_DEVICE_PNV_PHB3;
+ case VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PNV_PHB3:
+ return QEMU_CAPS_DEVICE_PNV_PHB3;
case VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE:
return 0;
case VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_LAST:
@@ -3558,7 +3560,8 @@ qemuValidateDomainDeviceDefControllerPCI(const
virDomainControllerDef *cont,
break;
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT:
- if (pciopts->modelName != VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE) {
+ if (pciopts->modelName != VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE
&&
+ !qemuDomainIsPowerNV(def)) {
virReportControllerInvalidOption(cont, model, modelName,
"modelName");
return -1;
}
@@ -3640,7 +3643,8 @@ qemuValidateDomainDeviceDefControllerPCI(const
virDomainControllerDef *cont,
break;
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT:
- if (pciopts->modelName != VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE) {
+ if (pciopts->modelName != VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE
&&
+ !qemuDomainIsPowerNV(def)) {
virReportControllerInvalidValue(cont, model, modelName,
"modelName");
return -1;
}
diff --git a/tests/qemuxml2xmloutdata/powernv8-basic.ppc64-latest.xml
b/tests/qemuxml2xmloutdata/powernv8-basic.ppc64-latest.xml
index cb9b3cf86f..ebbc0653ca 100644
--- a/tests/qemuxml2xmloutdata/powernv8-basic.ppc64-latest.xml
+++ b/tests/qemuxml2xmloutdata/powernv8-basic.ppc64-latest.xml
@@ -17,7 +17,9 @@
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-ppc64</emulator>
- <controller type='pci' index='0' model='pcie-root'/>
+ <controller type='pci' index='0' model='pcie-root'>
+ <model name='pnv-phb3'/>
+ </controller>
<serial type='pty'>
<target type='isa-serial' port='0'>
<model name='isa-serial'/>
--
2.34.1