The command line for the pnv-phb3 device is similar to the
spapr-pci-host-bridge command line but adding the extra 'chip-id'
attribute.
Reviewed-by: Ján Tomko <jtomko(a)redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413(a)gmail.com>
---
src/qemu/qemu_command.c | 21 +++++++++++++++++--
.../powernv8-basic.ppc64-latest.args | 1 +
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index c836799888..5710fba0d9 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3135,6 +3135,22 @@ qemuBuildControllerPCIDevProps(virDomainControllerDef *def,
break;
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT:
+ if (!virDomainControllerIsPowerNVPHB(def)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Unsupported PCI Express root controller"));
+ return -1;
+ }
+
+ if (virJSONValueObjectAdd(&props,
+ "s:driver", modelName,
+ "i:index", pciopts->targetIndex,
+ "i:chip-id", pciopts->chipId,
+ "s:id", def->info.alias,
+ NULL) < 0)
+ return -1;
+
+ break;
+
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Unsupported PCI Express root controller"));
return -1;
@@ -3322,8 +3338,9 @@ static bool
qemuBuildSkipController(const virDomainControllerDef *controller,
const virDomainDef *def)
{
- /* skip pcie-root */
- if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI &&
+ /* skip pcie-root for non PowerVM domains */
+ if (!qemuDomainIsPowerNV(def) &&
+ controller->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI &&
controller->model == VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT)
return true;
diff --git a/tests/qemuxml2argvdata/powernv8-basic.ppc64-latest.args
b/tests/qemuxml2argvdata/powernv8-basic.ppc64-latest.args
index c9616ded13..224e2adba8 100644
--- a/tests/qemuxml2argvdata/powernv8-basic.ppc64-latest.args
+++ b/tests/qemuxml2argvdata/powernv8-basic.ppc64-latest.args
@@ -26,6 +26,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
-rtc base=utc \
-no-shutdown \
-boot strict=on \
+-device
'{"driver":"pnv-phb3","index":0,"chip-id":0,"id":"pcie.0"}'
\
-usb \
-chardev pty,id=charserial0 \
-device
'{"driver":"isa-serial","chardev":"charserial0","id":"serial0","index":0}'
\
--
2.35.1