[PATCH v2 10/29] conf, qemu: add 'pnv-phb3-root-port' PCI controller model name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

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 64a797de46..a467fc1437 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 f5b15cff33..8db4d44d28 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 d7352b60e6..7aef7659e9 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 3e6eed6ec9..eeececa936 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -2420,6 +2420,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 aa686246f5..ea7861b232 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -3428,6 +3428,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:
@@ -3595,10 +3597,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.34.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux