Apart from being usable only with pnv-phb3 PCIE host bridges (to be added soon), this device acts as a regular pcie-root-port but with a specific model name. No doc changes in formatdomain.rst were made because the PCI model name isn't something that users are supposed to be setting or changing. Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx> Signed-off-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx> --- docs/schemas/domaincommon.rng | 1 + src/conf/domain_conf.c | 1 + src/conf/domain_conf.h | 1 + src/qemu/qemu_domain_address.c | 5 +++++ src/qemu/qemu_validate.c | 12 +++++++++++- 5 files changed, 19 insertions(+), 1 deletion(-) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 964b0c9e2f..ad9432ea3d 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2602,6 +2602,7 @@ <!-- implementations of "pcie-root-port" --> <value>ioh3420</value> <value>pcie-root-port</value> + <value>pnv-phb3-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 34fec887a3..b4f13c4b98 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -438,6 +438,7 @@ VIR_ENUM_IMPL(virDomainControllerPCIModelName, "pcie-root-port", "spapr-pci-host-bridge", "pcie-pci-bridge", + "pnv-phb3-root-port", ); VIR_ENUM_IMPL(virDomainControllerModelSCSI, diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 9fcf842ee7..60be338541 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -646,6 +646,7 @@ typedef enum { VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PCIE_ROOT_PORT, 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_LAST } virDomainControllerPCIModelName; diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index dd0680f57f..56491e04fe 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -2421,6 +2421,11 @@ qemuDomainPCIControllerSetDefaultModelName(virDomainControllerDef *cont, *modelName = VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PCIE_PCI_BRIDGE; break; case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT: + if (qemuDomainIsPowerNV(def)) { + *modelName = VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PNV_PHB3_ROOT_PORT; + break; + } + /* Use generic PCIe Root Ports if available, falling back to * ioh3420 otherwise */ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PCIE_ROOT_PORT)) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index ad8f0f94ff..37dcebaca3 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -3433,6 +3433,8 @@ virValidateControllerPCIModelNameToQEMUCaps(int modelName) return QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE; case VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PCIE_PCI_BRIDGE: 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_NONE: return 0; case VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_LAST: @@ -3600,10 +3602,18 @@ qemuValidateDomainDeviceDefControllerPCI(const virDomainControllerDef *cont, case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT: if (pciopts->modelName != VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_IOH3420 && - pciopts->modelName != VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PCIE_ROOT_PORT) { + pciopts->modelName != VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PCIE_ROOT_PORT && + pciopts->modelName != VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PNV_PHB3_ROOT_PORT) { virReportControllerInvalidValue(cont, model, modelName, "modelName"); return -1; } + + if (pciopts->modelName == VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PNV_PHB3_ROOT_PORT && + !qemuDomainIsPowerNV(def)) { + virReportControllerInvalidValue(cont, model, modelName, "modelName"); + return -1; + } + break; case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT: -- 2.35.1