All machine types which have PCI support multibus since qemu 2.0 according to the logic we had, thus we can remove all the machine type and version checks which are now dead code. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/qemu/qemu_alias.c | 4 ++-- src/qemu/qemu_capabilities.c | 42 +++--------------------------------- src/qemu/qemu_capabilities.h | 3 +-- src/qemu/qemu_command.c | 4 ++-- 4 files changed, 8 insertions(+), 45 deletions(-) diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c index 1c6f04c0ba..a36b245811 100644 --- a/src/qemu/qemu_alias.c +++ b/src/qemu/qemu_alias.c @@ -122,7 +122,7 @@ qemuAssignDeviceChrAlias(virDomainDefPtr def, int qemuAssignDeviceControllerAlias(virDomainDefPtr domainDef, - virQEMUCapsPtr qemuCaps, + virQEMUCapsPtr qemuCaps G_GNUC_UNUSED, virDomainControllerDefPtr controller) { const char *prefix = virDomainControllerTypeToString(controller->type); @@ -131,7 +131,7 @@ qemuAssignDeviceControllerAlias(virDomainDefPtr domainDef, return 0; if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI) { - if (!virQEMUCapsHasPCIMultiBus(qemuCaps, domainDef)) { + if (!virQEMUCapsHasPCIMultiBus(domainDef)) { /* qemus that don't support multiple PCI buses have * hardcoded the name of their single PCI controller as * "pci". diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 37ed750f8b..e7ae174bcc 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2062,53 +2062,17 @@ virQEMUCapsGet(virQEMUCapsPtr qemuCaps, } -bool virQEMUCapsHasPCIMultiBus(virQEMUCapsPtr qemuCaps, - const virDomainDef *def) +bool virQEMUCapsHasPCIMultiBus(const virDomainDef *def) { /* x86_64 and i686 support PCI-multibus on all machine types * since forever */ if (ARCH_IS_X86(def->os.arch)) return true; + /* PPC supports multibus on all machine types which have pci since qemu-2.0.0 */ if (def->os.arch == VIR_ARCH_PPC || ARCH_IS_PPC64(def->os.arch)) { - /* - * Usage of pci.0 naming: - * - * ref405ep: no pci - * taihu: no pci - * bamboo: 1.1.0 (<= 1.5.0, so basically forever) - * mac99: 2.0.0 - * g3beige: 2.0.0 - * prep: 1.4.0 (<= 1.5.0, so basically forever) - * pseries: 2.0.0 - * mpc8544ds: forever - * virtex-m507: no pci - * ppce500: 1.6.0 - */ - - /* We do not store the qemu version in domain status XML. - * Hope the user is using a QEMU new enough to use 'pci.0', - * otherwise the results of this function will be wrong - * for domains already running at the time of daemon - * restart */ - if (qemuCaps->version == 0) - return true; - - if (qemuCaps->version >= 2000000) - return true; - - if (qemuCaps->version >= 1006000 && - STREQ(def->os.machine, "ppce500")) - return true; - - if (STREQ(def->os.machine, "bamboo") || - STREQ(def->os.machine, "mpc8544ds") || - STREQ(def->os.machine, "prep")) { - return true; - } - - return false; + return true; } /* S390 supports PCI-multibus. */ diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 1ca9c1ea7b..b521383f7b 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -634,8 +634,7 @@ bool virQEMUCapsGet(virQEMUCapsPtr qemuCaps, void virQEMUCapsInitProcessCapsInterlock(virQEMUCapsPtr qemuCaps); -bool virQEMUCapsHasPCIMultiBus(virQEMUCapsPtr qemuCaps, - const virDomainDef *def); +bool virQEMUCapsHasPCIMultiBus(const virDomainDef *def); bool virQEMUCapsSupportsVmport(virQEMUCapsPtr qemuCaps, const virDomainDef *def); diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 45eb0dc976..0ac899ba80 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -344,7 +344,7 @@ static int qemuBuildDeviceAddressStr(virBufferPtr buf, const virDomainDef *domainDef, virDomainDeviceInfoPtr info, - virQEMUCapsPtr qemuCaps) + virQEMUCapsPtr qemuCaps G_GNUC_UNUSED) { g_autofree char *devStr = NULL; const char *contAlias = NULL; @@ -381,7 +381,7 @@ qemuBuildDeviceAddressStr(virBufferPtr buf, * case, use the default one. */ if (!qemuDomainIsPSeries(domainDef) && cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT) { - if (virQEMUCapsHasPCIMultiBus(qemuCaps, domainDef)) + if (virQEMUCapsHasPCIMultiBus(domainDef)) contAlias = "pci.0"; else contAlias = "pci"; -- 2.30.2