]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Add conditions for qemu-kvm use on ppc64
authorAndrea Bolognani <abologna@redhat.com>
Wed, 30 Sep 2015 15:58:58 +0000 (11:58 -0400)
committerCole Robinson <crobinso@redhat.com>
Wed, 23 Dec 2015 23:17:06 +0000 (18:17 -0500)
qemu-kvm can be used to run ppc64 guests on ppc64le hosts and vice
versa, since the hardware is actually the same and the endianness
is chosen by the guest kernel.

Up until now, however, libvirt didn't allow the use of qemu-kvm
to run guests if their endianness didn't match the host's.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1267882
(cherry picked from commit 938368f8382ca94c5156c44ad85a06cf9e4f8f8f)

src/qemu/qemu_capabilities.c

index d8cb32d777617904b025467209a01ba9c1d5d9d4..f26d333aa0bb7ad6594b5c6c5aded85bf24642da 100644 (file)
@@ -741,7 +741,7 @@ virQEMUCapsInitGuest(virCapsPtr caps,
     char *binary = NULL;
     virQEMUCapsPtr qemubinCaps = NULL;
     virQEMUCapsPtr kvmbinCaps = NULL;
-    bool native_kvm, x86_32on64_kvm, arm_32on64_kvm;
+    bool native_kvm, x86_32on64_kvm, arm_32on64_kvm, ppc64_kvm;
     int ret = -1;
 
     /* Check for existence of base emulator, or alternate base
@@ -761,14 +761,16 @@ virQEMUCapsInitGuest(virCapsPtr caps,
      *  - host & guest arches match
      *  - hostarch is x86_64 and guest arch is i686 (needs -cpu qemu32)
      *  - hostarch is aarch64 and guest arch is armv7l (needs -cpu aarch64=off)
+     *  - hostarch and guestarch are both ppc64*
      */
     native_kvm = (hostarch == guestarch);
     x86_32on64_kvm = (hostarch == VIR_ARCH_X86_64 &&
         guestarch == VIR_ARCH_I686);
     arm_32on64_kvm = (hostarch == VIR_ARCH_AARCH64 &&
         guestarch == VIR_ARCH_ARMV7L);
+    ppc64_kvm = (ARCH_IS_PPC64(hostarch) && ARCH_IS_PPC64(guestarch));
 
-    if (native_kvm || x86_32on64_kvm || arm_32on64_kvm) {
+    if (native_kvm || x86_32on64_kvm || arm_32on64_kvm || ppc64_kvm) {
         const char *kvmbins[] = {
             "/usr/libexec/qemu-kvm", /* RHEL */
             "qemu-kvm", /* Fedora */