From: Andrea Bolognani Date: Tue, 18 Sep 2018 14:27:42 +0000 (+0200) Subject: qemu: Move armv7l-on-aarch64 special case X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=0d131d3893e912e6071b8862e9fd3ac489452076;p=libvirt.git qemu: Move armv7l-on-aarch64 special case When running an armv7l guest on an aarch64 hosts, the qemu-system-aarch64 binary should be our first choice instead of qemu-system-arm since the former can take advantage of KVM acceleration. Move the special case to virQEMUCapsFindBinaryForArch() so that it's handled along with all other cases rather than on its own later on. Doing so will also make further refactoring easier. Signed-off-by: Andrea Bolognani --- diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index ed92e99b90..e51b07099a 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -708,6 +708,15 @@ virQEMUCapsFindBinaryForArch(virArch hostarch, const char *archstr; virArch target; + /* armv7l guests can only take advantage of KVM on aarch64 hosts by + * using the qemu-system-aarch64 binary, so look for that one first + * to avoid using qemu-system-arm (and thus TCG) instead */ + if (hostarch == VIR_ARCH_AARCH64 && guestarch == VIR_ARCH_ARMV7L) { + archstr = virQEMUCapsArchToString(hostarch); + if ((ret = virQEMUCapsFindBinary("qemu-system-%s", archstr)) != NULL) + goto out; + } + /* First attempt: try the guest architecture as it is */ archstr = virQEMUCapsArchToString(guestarch); if ((ret = virQEMUCapsFindBinary("qemu-system-%s", archstr)) != NULL) @@ -762,24 +771,9 @@ virQEMUCapsInitGuest(virCapsPtr caps, "/usr/libexec/qemu-kvm", /* RHEL */ "qemu-kvm", /* Fedora */ "kvm", /* Debian/Ubuntu */ - NULL, }; - /* x86 32-on-64 can be used with qemu-system-i386 and - * qemu-system-x86_64, so if we don't find a specific kvm binary, - * we can just fall back to the host arch native binary and - * everything works fine. - * - * arm is different in that 32-on-64 _only_ works with - * qemu-system-aarch64. So we have to add it to the kvmbins list - */ - if (hostarch == VIR_ARCH_AARCH64 && guestarch == VIR_ARCH_ARMV7L) - kvmbins[3] = "qemu-system-aarch64"; - for (i = 0; i < ARRAY_CARDINALITY(kvmbins); ++i) { - if (!kvmbins[i]) - continue; - kvmbin = virFindFileInPath(kvmbins[i]); if (!kvmbin)