diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c index e58c488f8a..686b5a4d80 100644 --- a/src/qemu/qemu_alias.c +++ b/src/qemu/qemu_alias.c @@ -142,7 +142,7 @@ qemuAssignDeviceControllerAlias(virDomainDef *domainDef, return; if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI) { - if (!virQEMUCapsHasPCIMultiBus(domainDef)) { + if (!qemuDomainSupportsPCIMultibus(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 dc192b3729..98faf3f1d3 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2059,34 +2059,6 @@ virQEMUCapsGet(virQEMUCaps *qemuCaps, } -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)) { - return true; - } - - /* S390 supports PCI-multibus. */ - if (ARCH_IS_S390(def->os.arch)) - return true; - - /* If the virt machine, both on ARM and RISC-V, supports PCI, - * then it also supports multibus */ - if (qemuDomainIsARMVirt(def) || - qemuDomainIsRISCVVirt(def)) { - return true; - } - - return false; -} - - const char *virQEMUCapsGetBinary(virQEMUCaps *qemuCaps) { return qemuCaps->binary; diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 038ab0a4df..4693e2f4de 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -701,8 +701,6 @@ bool virQEMUCapsGet(virQEMUCaps *qemuCaps, void virQEMUCapsInitProcessCapsInterlock(virQEMUCaps *qemuCaps); -bool virQEMUCapsHasPCIMultiBus(const virDomainDef *def); - bool virQEMUCapsSupportsVmport(virQEMUCaps *qemuCaps, const virDomainDef *def); diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 5c067b8554..b8f071ff2a 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -386,7 +386,7 @@ qemuBuildDeviceAddressPCIGetBus(const virDomainDef *domainDef, * */ if (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT && contTargetIndex <= 0) { - if (virQEMUCapsHasPCIMultiBus(domainDef)) + if (qemuDomainSupportsPCIMultibus(domainDef)) contAlias = "pci.0"; else contAlias = "pci"; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 80281d9b48..ef7506258a 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -9085,6 +9085,35 @@ qemuDomainSupportsPCI(const virDomainDef *def) } +bool +qemuDomainSupportsPCIMultibus(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)) { + return true; + } + + /* S390 supports PCI-multibus. */ + if (ARCH_IS_S390(def->os.arch)) + return true; + + /* If the virt machine, both on ARM and RISC-V, supports PCI, + * then it also supports multibus */ + if (qemuDomainIsARMVirt(def) || + qemuDomainIsRISCVVirt(def)) { + return true; + } + + return false; +} + + static int qemuDomainDefValidateMemoryHotplugDevice(const virDomainMemoryDef *mem, const virDomainDef *def) diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 49e0fcf498..b4512cc80e 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -835,6 +835,7 @@ bool qemuDomainHasBuiltinIDE(const virDomainDef *def); bool qemuDomainHasBuiltinESP(const virDomainDef *def); bool qemuDomainNeedsFDC(const virDomainDef *def); bool qemuDomainSupportsPCI(const virDomainDef *def); +bool qemuDomainSupportsPCIMultibus(const virDomainDef *def); void qemuDomainUpdateCurrentMemorySize(virDomainObj *vm);