1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-25 10:03:49 +03:00

qemu: Add architecture checks to qemuDomainMachineIsVirt()

Remove all external architecture checks that have been
made redundant by this change.
This commit is contained in:
Andrea Bolognani 2016-06-22 18:55:37 +02:00
parent 0969b5051b
commit 210acdb1a5
3 changed files with 15 additions and 13 deletions

View File

@ -2174,13 +2174,11 @@ bool virQEMUCapsHasPCIMultiBus(virQEMUCapsPtr qemuCaps,
return false; return false;
} }
if (ARCH_IS_ARM(def->os.arch)) {
/* If 'virt' supports PCI, it supports multibus. /* If 'virt' supports PCI, it supports multibus.
* No extra conditions here for simplicity. * No extra conditions here for simplicity.
*/ */
if (qemuDomainMachineIsVirt(def)) if (qemuDomainMachineIsVirt(def))
return true; return true;
}
return false; return false;
} }

View File

@ -6839,9 +6839,7 @@ qemuBuildMachineCommandLine(virCommandPtr cmd,
if (def->features[VIR_DOMAIN_FEATURE_GIC] == VIR_TRISTATE_SWITCH_ON) { if (def->features[VIR_DOMAIN_FEATURE_GIC] == VIR_TRISTATE_SWITCH_ON) {
if (def->gic_version != VIR_GIC_VERSION_NONE) { if (def->gic_version != VIR_GIC_VERSION_NONE) {
if ((def->os.arch != VIR_ARCH_ARMV7L && if (!qemuDomainMachineIsVirt(def)) {
def->os.arch != VIR_ARCH_AARCH64) ||
!qemuDomainMachineIsVirt(def)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("gic-version option is available " _("gic-version option is available "
"only for ARM virt machine")); "only for ARM virt machine"));

View File

@ -2041,7 +2041,6 @@ qemuDomainDefEnableDefaultFeatures(virDomainDefPtr def,
* was not included in the domain XML, we need to choose a suitable * was not included in the domain XML, we need to choose a suitable
* GIC version ourselves */ * GIC version ourselves */
if (def->features[VIR_DOMAIN_FEATURE_GIC] == VIR_TRISTATE_SWITCH_ABSENT && if (def->features[VIR_DOMAIN_FEATURE_GIC] == VIR_TRISTATE_SWITCH_ABSENT &&
(def->os.arch == VIR_ARCH_ARMV7L || def->os.arch == VIR_ARCH_AARCH64) &&
qemuDomainMachineIsVirt(def)) { qemuDomainMachineIsVirt(def)) {
VIR_DEBUG("Looking for usable GIC version in domain capabilities"); VIR_DEBUG("Looking for usable GIC version in domain capabilities");
@ -4920,8 +4919,15 @@ qemuDomainMachineIsS390CCW(const virDomainDef *def)
bool bool
qemuDomainMachineIsVirt(const virDomainDef *def) qemuDomainMachineIsVirt(const virDomainDef *def)
{ {
return STREQ(def->os.machine, "virt") || if (def->os.arch != VIR_ARCH_ARMV7L &&
STRPREFIX(def->os.machine, "virt-"); def->os.arch != VIR_ARCH_AARCH64)
return false;
if (STRNEQ(def->os.machine, "virt") &&
!STRPREFIX(def->os.machine, "virt-"))
return false;
return true;
} }