6ae9ed
From 90a2a917a15c5fc06f6b390690c134dc5f06e20c Mon Sep 17 00:00:00 2001
6ae9ed
Message-Id: <90a2a917a15c5fc06f6b390690c134dc5f06e20c@dist-git>
6ae9ed
From: Andrea Bolognani <abologna@redhat.com>
6ae9ed
Date: Thu, 7 Jul 2016 13:59:34 +0200
6ae9ed
Subject: [PATCH] qemu: Memory locking is only required for KVM guests on ppc64
6ae9ed
6ae9ed
Due to the way the hardware works, KVM on ppc64 always requires
6ae9ed
memory locking; however, that is not the case for non-KVM ppc64
6ae9ed
guests, eg. ppc64 guests that are running on x86_64 with TCG.
6ae9ed
6ae9ed
Only require memory locking for ppc64 guests if they are using
6ae9ed
KVM or, as it's the case for all architectures, they have host
6ae9ed
devices assigned using VFIO.
6ae9ed
6ae9ed
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1350772
6ae9ed
6ae9ed
(cherry picked from commit cd89d3451b8efcfed05ff1f4a91d9b252dbe26bc)
6ae9ed
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
6ae9ed
---
6ae9ed
 src/qemu/qemu_domain.c | 8 ++++----
6ae9ed
 1 file changed, 4 insertions(+), 4 deletions(-)
6ae9ed
6ae9ed
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
6ae9ed
index 4aef7ab..2a42b1b 100644
6ae9ed
--- a/src/qemu/qemu_domain.c
6ae9ed
+++ b/src/qemu/qemu_domain.c
6ae9ed
@@ -5349,10 +5349,6 @@ qemuDomainRequiresMemLock(virDomainDefPtr def)
6ae9ed
     if (def->mem.locked)
6ae9ed
         return true;
6ae9ed
 
6ae9ed
-    /* ppc64 domains need to lock some memory even when VFIO is not used */
6ae9ed
-    if (ARCH_IS_PPC64(def->os.arch))
6ae9ed
-        return true;
6ae9ed
-
6ae9ed
     for (i = 0; i < def->nhostdevs; i++) {
6ae9ed
         virDomainHostdevDefPtr dev = def->hostdevs[i];
6ae9ed
 
6ae9ed
@@ -5362,6 +5358,10 @@ qemuDomainRequiresMemLock(virDomainDefPtr def)
6ae9ed
             return true;
6ae9ed
     }
6ae9ed
 
6ae9ed
+    /* ppc64 KVM domains need to lock some memory even when VFIO is not used */
6ae9ed
+    if (ARCH_IS_PPC64(def->os.arch) && def->virtType == VIR_DOMAIN_VIRT_KVM)
6ae9ed
+        return true;
6ae9ed
+
6ae9ed
     return false;
6ae9ed
 }
6ae9ed
 
6ae9ed
-- 
6ae9ed
2.9.0
6ae9ed