From 35e9c02cbe2cedf0f4ff0b9132e35c45550c0f3c Mon Sep 17 00:00:00 2001 From: Andrea Bolognani Date: Mon, 12 Feb 2018 18:52:40 +0100 Subject: [PATCH] qemu: Move skip for implicit PHB of pSeries guests Performing the skip earlier will help us making the function nicer later on. We also make the condition for the skip a bit more precise, though that'a more for self-documenting purposes and doesn't change anything in practice. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_command.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index d916dd179b..e406d53af4 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2732,6 +2732,13 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef, def->model != VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST) modelName = virDomainControllerPCIModelNameTypeToString(pciopts->modelName); + /* Skip the implicit PHB for pSeries guests */ + if (def->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT && + pciopts->modelName == VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_SPAPR_PCI_HOST_BRIDGE && + pciopts->targetIndex == 0) { + goto done; + } + switch ((virDomainControllerModelPCI) def->model) { case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE: virBufferAsprintf(&buf, "%s,chassis_nr=%d,id=%s", @@ -2759,10 +2766,6 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef, pciopts->chassis, def->info.alias); break; case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT: - /* Skip the implicit one */ - if (pciopts->targetIndex == 0) - goto done; - virBufferAsprintf(&buf, "%s,index=%d,id=%s", modelName, pciopts->targetIndex, def->info.alias); -- GitLab