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(a)redhat.com>
Reviewed-by: Ján Tomko <jtomko(a)redhat.com>
Reviewed-by: Pavel Hrdina <phrdina(a)redhat.com>
Reviewed-by: Neal Gompa <ngompa13(a)gmail.com>
---
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 7c86a6eeaa..695e150c43 100644
--- a/src/qemu/qemu_alias.c
+++ b/src/qemu/qemu_alias.c
@@ -122,7 +122,7 @@ qemuAssignDeviceChrAlias(virDomainDef *def,
int
qemuAssignDeviceControllerAlias(virDomainDef *domainDef,
- virQEMUCaps *qemuCaps,
+ virQEMUCaps *qemuCaps G_GNUC_UNUSED,
virDomainControllerDef *controller)
{
const char *prefix = virDomainControllerTypeToString(controller->type);
@@ -131,7 +131,7 @@ qemuAssignDeviceControllerAlias(virDomainDef *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 030779902d..e5d7f87221 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -2059,53 +2059,17 @@ virQEMUCapsGet(virQEMUCaps *qemuCaps,
}
-bool virQEMUCapsHasPCIMultiBus(virQEMUCaps *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 f54aad5dfd..b3844e5ba6 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -633,8 +633,7 @@ bool virQEMUCapsGet(virQEMUCaps *qemuCaps,
void virQEMUCapsInitProcessCapsInterlock(virQEMUCaps *qemuCaps);
-bool virQEMUCapsHasPCIMultiBus(virQEMUCaps *qemuCaps,
- const virDomainDef *def);
+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 77d8e3f38c..63b6533c68 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -344,7 +344,7 @@ static int
qemuBuildDeviceAddressStr(virBuffer *buf,
const virDomainDef *domainDef,
virDomainDeviceInfo *info,
- virQEMUCaps *qemuCaps)
+ virQEMUCaps *qemuCaps G_GNUC_UNUSED)
{
g_autofree char *devStr = NULL;
const char *contAlias = NULL;
@@ -381,7 +381,7 @@ qemuBuildDeviceAddressStr(virBuffer *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