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. Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx> Signed-off-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx> --- 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 ad9432ea3d..f472055700 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 b4f13c4b98..06d1294797 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 60be338541..6848b3a81f 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 56491e04fe..fb0b74fa57 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -2450,6 +2450,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 37dcebaca3..f15ac545b0 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -3435,6 +3435,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: @@ -3563,7 +3565,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; } @@ -3645,7 +3648,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.35.1