[PATCH v3 16/29] conf, qemu: add default 'chip-id' value for pnv-phb3 controllers

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

 



If ommited from the controller definition, chip-id defaults to zero.

Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx>
Signed-off-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx>
---
 src/qemu/qemu_domain_address.c                   | 16 +++++++++++++++-
 src/qemu/qemu_validate.c                         |  5 +++++
 .../powernv8-basic.ppc64-latest.xml              |  1 +
 3 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index fb0b74fa57..b72a9b7bf4 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -2844,10 +2844,24 @@ qemuDomainAssignPCIAddresses(virDomainDef *def,
                     goto cleanup;
                 }
                 break;
+            case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT:
+                if (!qemuDomainIsPowerNV(def))
+                    break;
+
+                /*
+                 * Default to chip-id = 0 since it's guaranteed that one socket
+                 * will always be present.
+                 *
+                 * chipId validation requires CPU topology information that isn't
+                 * available at this point and will be done later on.
+                 */
+                if (options->chipId == -1)
+                    options->chipId = 0;
+
+                break;
             case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE:
             case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_TO_PCI_BRIDGE:
             case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT:
-            case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT:
             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 f15ac545b0..84a599d577 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -3653,6 +3653,11 @@ qemuValidateDomainDeviceDefControllerPCI(const virDomainControllerDef *cont,
             virReportControllerInvalidValue(cont, model, modelName, "modelName");
             return -1;
         }
+
+        if (pciopts->chipId != -1 && !virDomainControllerIsPowerNVPHB(cont)) {
+            virReportControllerInvalidOption(cont, model, modelName, "chip-id");
+            return -1;
+        }
         break;
 
     case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_TO_PCI_BRIDGE:
diff --git a/tests/qemuxml2xmloutdata/powernv8-basic.ppc64-latest.xml b/tests/qemuxml2xmloutdata/powernv8-basic.ppc64-latest.xml
index ebbc0653ca..28d86d7d9e 100644
--- a/tests/qemuxml2xmloutdata/powernv8-basic.ppc64-latest.xml
+++ b/tests/qemuxml2xmloutdata/powernv8-basic.ppc64-latest.xml
@@ -19,6 +19,7 @@
     <emulator>/usr/bin/qemu-system-ppc64</emulator>
     <controller type='pci' index='0' model='pcie-root'>
       <model name='pnv-phb3'/>
+      <target chip-id='0'/>
     </controller>
     <serial type='pty'>
       <target type='isa-serial' port='0'>
-- 
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