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

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

 



This device is an implementation of pcie-root-port, similar to its
sibling pnv-phb3-root-port. Since it's a new model name that Libvirt
automatically sets, we refrain from documenting it to users.

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 | 14 +++++++++++++-
 src/qemu/qemu_validate.c       |  8 ++++++--
 5 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 47a3107ea1..116fedc19e 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2605,6 +2605,7 @@
                     <value>ioh3420</value>
                     <value>pcie-root-port</value>
                     <value>pnv-phb3-root-port</value>
+                    <value>pnv-phb4-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 d27aafd771..2b862ffb86 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -440,6 +440,7 @@ VIR_ENUM_IMPL(virDomainControllerPCIModelName,
               "pcie-pci-bridge",
               "pnv-phb3-root-port",
               "pnv-phb3",
+              "pnv-phb4-root-port",
 );
 
 VIR_ENUM_IMPL(virDomainControllerModelSCSI,
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index dd3d942a35..6532b78322 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -648,6 +648,7 @@ typedef enum {
     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_PNV_PHB4_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 7d60d277e8..e18cc81f04 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -2412,6 +2412,18 @@ qemuDomainAssignDevicePCISlots(virDomainDef *def,
 }
 
 
+static virDomainControllerPCIModelName
+virDomainControllerGetPowerNVRootPortName(virDomainDef *def)
+{
+    if (STREQ(def->os.machine, "powernv8"))
+        return VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PNV_PHB3_ROOT_PORT;
+    else if (STREQ(def->os.machine, "powernv9"))
+        return VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PNV_PHB4_ROOT_PORT;
+
+    return VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE;
+}
+
+
 static void
 qemuDomainPCIControllerSetDefaultModelName(virDomainControllerDef *cont,
                                            virDomainDef *def,
@@ -2435,7 +2447,7 @@ qemuDomainPCIControllerSetDefaultModelName(virDomainControllerDef *cont,
         break;
     case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT:
         if (qemuDomainIsPowerNV(def)) {
-            *modelName = VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PNV_PHB3_ROOT_PORT;
+            *modelName = virDomainControllerGetPowerNVRootPortName(def);
             break;
         }
 
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index bb6ff2e70e..6f49a5f17b 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -3432,6 +3432,8 @@ virValidateControllerPCIModelNameToQEMUCaps(int modelName)
         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_PNV_PHB4_ROOT_PORT:
+        return QEMU_CAPS_DEVICE_PNV_PHB4;
     case VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE:
         return 0;
     case VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_LAST:
@@ -3601,12 +3603,14 @@ 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_PNV_PHB3_ROOT_PORT) {
+            pciopts->modelName != VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PNV_PHB3_ROOT_PORT &&
+            pciopts->modelName != VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PNV_PHB4_ROOT_PORT) {
             virReportControllerInvalidValue(cont, model, modelName, "modelName");
             return -1;
         }
 
-        if (pciopts->modelName == VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PNV_PHB3_ROOT_PORT &&
+        if ((pciopts->modelName == VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PNV_PHB3_ROOT_PORT ||
+             pciopts->modelName == VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PNV_PHB4_ROOT_PORT) &&
             !qemuDomainIsPowerNV(def)) {
             virReportControllerInvalidValue(cont, model, modelName, "modelName");
             return -1;
-- 
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