thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-target-ppc-Don-t-require-private-l1d-cache-on-POWER8.patch

ae23c9
From ad1adce48f771ecc03b75575edbe09bca569167a Mon Sep 17 00:00:00 2001
ae23c9
From: Suraj Jitindar Singh <sursingh@redhat.com>
ae23c9
Date: Thu, 21 Jun 2018 06:56:48 +0200
ae23c9
Subject: [PATCH 061/268] target/ppc: Don't require private l1d cache on POWER8
ae23c9
 for cap_ppc_safe_cache
ae23c9
ae23c9
RH-Author: Suraj Jitindar Singh <sursingh@redhat.com>
ae23c9
Message-id: <1529564209-30369-3-git-send-email-sursingh@redhat.com>
ae23c9
Patchwork-id: 80930
ae23c9
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 2/3] target/ppc: Don't require private l1d cache on POWER8 for cap_ppc_safe_cache
ae23c9
Bugzilla: 1560847
ae23c9
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
ae23c9
RH-Acked-by: David Gibson <dgibson@redhat.com>
ae23c9
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
ae23c9
ae23c9
From: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
ae23c9
ae23c9
For cap_ppc_safe_cache to be set to workaround, we require both a l1d
ae23c9
cache flush instruction and private l1d cache.
ae23c9
ae23c9
On POWER8 don't require private l1d cache. This means a guest on a
ae23c9
POWER8 machine can make use of the cache flush workarounds.
ae23c9
ae23c9
Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
ae23c9
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
ae23c9
(cherry picked from commit 072f416a53ead5211c987cb2068ee9dbd7ba06cc)
ae23c9
ae23c9
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1560847
ae23c9
ae23c9
Signed-off-by: Suraj Jitindar Singh <sursingh@redhat.com>
ae23c9
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
ae23c9
---
ae23c9
 target/ppc/kvm.c | 19 ++++++++++++++++++-
ae23c9
 1 file changed, 18 insertions(+), 1 deletion(-)
ae23c9
ae23c9
diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
ae23c9
index d787032..192c40d 100644
ae23c9
--- a/target/ppc/kvm.c
ae23c9
+++ b/target/ppc/kvm.c
ae23c9
@@ -2461,11 +2461,28 @@ bool kvmppc_has_cap_mmu_hash_v3(void)
ae23c9
     return cap_mmu_hash_v3;
ae23c9
 }
ae23c9
 
ae23c9
+static bool kvmppc_power8_host(void)
ae23c9
+{
ae23c9
+    bool ret = false;
ae23c9
+#ifdef TARGET_PPC64
ae23c9
+    {
ae23c9
+        uint32_t base_pvr = CPU_POWERPC_POWER_SERVER_MASK & mfpvr();
ae23c9
+        ret = (base_pvr == CPU_POWERPC_POWER8E_BASE) ||
ae23c9
+              (base_pvr == CPU_POWERPC_POWER8NVL_BASE) ||
ae23c9
+              (base_pvr == CPU_POWERPC_POWER8_BASE);
ae23c9
+    }
ae23c9
+#endif /* TARGET_PPC64 */
ae23c9
+    return ret;
ae23c9
+}
ae23c9
+
ae23c9
 static int parse_cap_ppc_safe_cache(struct kvm_ppc_cpu_char c)
ae23c9
 {
ae23c9
+    bool l1d_thread_priv_req = !kvmppc_power8_host();
ae23c9
+
ae23c9
     if (~c.behaviour & c.behaviour_mask & H_CPU_BEHAV_L1D_FLUSH_PR) {
ae23c9
         return 2;
ae23c9
-    } else if ((c.character & c.character_mask & H_CPU_CHAR_L1D_THREAD_PRIV) &&
ae23c9
+    } else if ((!l1d_thread_priv_req ||
ae23c9
+                c.character & c.character_mask & H_CPU_CHAR_L1D_THREAD_PRIV) &&
ae23c9
                (c.character & c.character_mask
ae23c9
                 & (H_CPU_CHAR_L1D_FLUSH_ORI30 | H_CPU_CHAR_L1D_FLUSH_TRIG2))) {
ae23c9
         return 1;
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9