render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
7a3408
From 4058cc05cce5ed00aa9b2da4976a1a5565b9d3aa Mon Sep 17 00:00:00 2001
7a3408
Message-Id: <4058cc05cce5ed00aa9b2da4976a1a5565b9d3aa@dist-git>
7a3408
From: Andrea Bolognani <abologna@redhat.com>
7a3408
Date: Mon, 5 Oct 2015 10:49:44 +0200
7a3408
Subject: [PATCH] qemu: Add conditions for qemu-kvm use on ppc64
7a3408
7a3408
qemu-kvm can be used to run ppc64 guests on ppc64le hosts and vice
7a3408
versa, since the hardware is actually the same and the endianness
7a3408
is chosen by the guest kernel.
7a3408
7a3408
Up until now, however, libvirt didn't allow the use of qemu-kvm
7a3408
to run guests if their endianness didn't match the host's.
7a3408
7a3408
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1267882
7a3408
(cherry picked from commit 938368f8382ca94c5156c44ad85a06cf9e4f8f8f)
7a3408
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
---
7a3408
 src/qemu/qemu_capabilities.c | 6 ++++--
7a3408
 1 file changed, 4 insertions(+), 2 deletions(-)
7a3408
7a3408
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
7a3408
index 5b21307..12af0dc 100644
7a3408
--- a/src/qemu/qemu_capabilities.c
7a3408
+++ b/src/qemu/qemu_capabilities.c
7a3408
@@ -770,7 +770,7 @@ virQEMUCapsInitGuest(virCapsPtr caps,
7a3408
     char *binary = NULL;
7a3408
     virQEMUCapsPtr qemubinCaps = NULL;
7a3408
     virQEMUCapsPtr kvmbinCaps = NULL;
7a3408
-    bool native_kvm, x86_32on64_kvm, arm_32on64_kvm;
7a3408
+    bool native_kvm, x86_32on64_kvm, arm_32on64_kvm, ppc64_kvm;
7a3408
     int ret = -1;
7a3408
 
7a3408
     /* Check for existence of base emulator, or alternate base
7a3408
@@ -790,14 +790,16 @@ virQEMUCapsInitGuest(virCapsPtr caps,
7a3408
      *  - host & guest arches match
7a3408
      *  - hostarch is x86_64 and guest arch is i686 (needs -cpu qemu32)
7a3408
      *  - hostarch is aarch64 and guest arch is armv7l (needs -cpu aarch64=off)
7a3408
+     *  - hostarch and guestarch are both ppc64*
7a3408
      */
7a3408
     native_kvm = (hostarch == guestarch);
7a3408
     x86_32on64_kvm = (hostarch == VIR_ARCH_X86_64 &&
7a3408
         guestarch == VIR_ARCH_I686);
7a3408
     arm_32on64_kvm = (hostarch == VIR_ARCH_AARCH64 &&
7a3408
         guestarch == VIR_ARCH_ARMV7L);
7a3408
+    ppc64_kvm = (ARCH_IS_PPC64(hostarch) && ARCH_IS_PPC64(guestarch));
7a3408
 
7a3408
-    if (native_kvm || x86_32on64_kvm || arm_32on64_kvm) {
7a3408
+    if (native_kvm || x86_32on64_kvm || arm_32on64_kvm || ppc64_kvm) {
7a3408
         const char *kvmbins[] = {
7a3408
             "/usr/libexec/qemu-kvm", /* RHEL */
7a3408
             "qemu-kvm", /* Fedora */
7a3408
-- 
7a3408
2.6.1
7a3408