]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Move armv7l-on-aarch64 special case
authorAndrea Bolognani <abologna@redhat.com>
Tue, 18 Sep 2018 14:27:42 +0000 (16:27 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Fri, 21 Sep 2018 13:53:45 +0000 (15:53 +0200)
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 <abologna@redhat.com>
src/qemu/qemu_capabilities.c

index ed92e99b90e7f0ddfcad061051a32d816ad8dd4f..e51b07099adeec5296df39ef40af14587356e16a 100644 (file)
@@ -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)