qemu: Move qemuDomainSupportsPCIMultibus()

It belongs next to qemuDomainSupportsPCI().

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Andrea Bolognani 2024-01-17 09:39:48 +01:00
parent 11a861e9e9
commit 176c3b105e
6 changed files with 32 additions and 32 deletions

View File

@ -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".

View File

@ -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;

View File

@ -701,8 +701,6 @@ bool virQEMUCapsGet(virQEMUCaps *qemuCaps,
void virQEMUCapsInitProcessCapsInterlock(virQEMUCaps *qemuCaps);
bool virQEMUCapsHasPCIMultiBus(const virDomainDef *def);
bool virQEMUCapsSupportsVmport(virQEMUCaps *qemuCaps,
const virDomainDef *def);

View File

@ -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";

View File

@ -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)

View File

@ -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);