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

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