[PATCH v3 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.

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 | 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 d85290a164..43f78473e1 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 c551134d37..089237007a 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 835b8111e0..1313534622 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 d75b175f82..9290083f39 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -2413,6 +2413,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,
@@ -2436,7 +2448,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 a172d395aa..37e7c5616c 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -3437,6 +3437,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:
@@ -3606,12 +3608,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.35.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