If ommited from the controller definition, chip-id defaults to zero.
Signed-off-by: Daniel Henrique Barboza <danielhb413(a)gmail.com>
---
src/qemu/qemu_domain_address.c | 16 +++++++++++++++-
src/qemu/qemu_validate.c | 5 +++++
tests/qemuxml2xmloutdata/powernv8-basic.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 b7d5c14c3a..9c2ea5cf00 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 c21611a349..f7d73f7c2e 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -3649,6 +3649,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.xml
b/tests/qemuxml2xmloutdata/powernv8-basic.xml
index 721d2f9a37..0a093367f2 100644
--- a/tests/qemuxml2xmloutdata/powernv8-basic.xml
+++ b/tests/qemuxml2xmloutdata/powernv8-basic.xml
@@ -16,6 +16,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.34.1