mirror of https://gitee.com/openkylin/libvirt.git
virQEMUCapsHasPCIMultiBus: Remove logic for PPC multibus support check
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@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Neal Gompa <ngompa13@gmail.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
184de10c1d
commit
d4374a629f
|
@ -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".
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -345,7 +345,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;
|
||||
|
@ -382,7 +382,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";
|
||||
|
|
Loading…
Reference in New Issue