a41c76
From 882e0241f82b5bcbe239cf00134950e141de642a Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <882e0241f82b5bcbe239cf00134950e141de642a@dist-git>
a41c76
From: Jiri Denemark <jdenemar@redhat.com>
a41c76
Date: Tue, 26 May 2020 10:58:59 +0200
a41c76
Subject: [PATCH] cpu_x86: Drop noTSX hint for incompatible CPUs
a41c76
MIME-Version: 1.0
a41c76
Content-Type: text/plain; charset=UTF-8
a41c76
Content-Transfer-Encoding: 8bit
a41c76
a41c76
The hint was introduced a long time ago when broken TSX implementation
a41c76
was found in Haswell and Broadwell CPUs. Since then many more CPUs with
a41c76
TSX were introduced and and disabled due to TAA vulnerability.
a41c76
a41c76
Thus the hint is not very useful and I think removing it is a better
a41c76
choice then updating it to cover all current noTSX models.
a41c76
a41c76
This partially reverts:
a41c76
commit 7f127ded657b24e0e55cd5f3539ef5b2dc935908
a41c76
    cpu: Rework cpuCompare* APIs
a41c76
a41c76
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
(cherry picked from commit 8452779049ef785b1d2e373b4d42633d4a929a60)
a41c76
a41c76
https://bugzilla.redhat.com/show_bug.cgi?id=1840010
a41c76
a41c76
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
a41c76
Message-Id: <1126fcc8a0e18f0eed38c182013429fd7266c274.1590483392.git.jdenemar@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
---
a41c76
 src/cpu/cpu_x86.c | 44 ++++++--------------------------------------
a41c76
 1 file changed, 6 insertions(+), 38 deletions(-)
a41c76
a41c76
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
a41c76
index b4d5c795f7..1b388ec1b2 100644
a41c76
--- a/src/cpu/cpu_x86.c
a41c76
+++ b/src/cpu/cpu_x86.c
a41c76
@@ -1937,8 +1937,6 @@ virCPUx86Compare(virCPUDefPtr host,
a41c76
                  bool failIncompatible)
a41c76
 {
a41c76
     virCPUCompareResult ret = VIR_CPU_COMPARE_ERROR;
a41c76
-    virCPUx86MapPtr map;
a41c76
-    virCPUx86ModelPtr model = NULL;
a41c76
     char *message = NULL;
a41c76
 
a41c76
     if (!host || !host->model) {
a41c76
@@ -1954,46 +1952,16 @@ virCPUx86Compare(virCPUDefPtr host,
a41c76
 
a41c76
     ret = x86Compute(host, cpu, NULL, &message);
a41c76
 
a41c76
-    if (ret == VIR_CPU_COMPARE_INCOMPATIBLE) {
a41c76
-        bool noTSX = false;
a41c76
-
a41c76
-        if (STREQ_NULLABLE(cpu->model, "Haswell") ||
a41c76
-            STREQ_NULLABLE(cpu->model, "Broadwell")) {
a41c76
-            if (!(map = virCPUx86GetMap()))
a41c76
-                goto cleanup;
a41c76
-
a41c76
-            if (!(model = x86ModelFromCPU(cpu, map, -1)))
a41c76
-                goto cleanup;
a41c76
-
a41c76
-            noTSX = !x86FeatureInData("hle", &model->data, map) ||
a41c76
-                    !x86FeatureInData("rtm", &model->data, map);
a41c76
-        }
a41c76
-
a41c76
-        if (failIncompatible) {
a41c76
-            ret = VIR_CPU_COMPARE_ERROR;
a41c76
-            if (message) {
a41c76
-                if (noTSX) {
a41c76
-                    virReportError(VIR_ERR_CPU_INCOMPATIBLE,
a41c76
-                                   _("%s; try using '%s-noTSX' CPU model"),
a41c76
-                                   message, cpu->model);
a41c76
-                } else {
a41c76
-                    virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", message);
a41c76
-                }
a41c76
-            } else {
a41c76
-                if (noTSX) {
a41c76
-                    virReportError(VIR_ERR_CPU_INCOMPATIBLE,
a41c76
-                                   _("try using '%s-noTSX' CPU model"),
a41c76
-                                   cpu->model);
a41c76
-                } else {
a41c76
-                    virReportError(VIR_ERR_CPU_INCOMPATIBLE, NULL);
a41c76
-                }
a41c76
-            }
a41c76
-        }
a41c76
+    if (ret == VIR_CPU_COMPARE_INCOMPATIBLE && failIncompatible) {
a41c76
+        ret = VIR_CPU_COMPARE_ERROR;
a41c76
+        if (message)
a41c76
+            virReportError(VIR_ERR_CPU_INCOMPATIBLE, "%s", message);
a41c76
+        else
a41c76
+            virReportError(VIR_ERR_CPU_INCOMPATIBLE, NULL);
a41c76
     }
a41c76
 
a41c76
  cleanup:
a41c76
     VIR_FREE(message);
a41c76
-    x86ModelFree(model);
a41c76
     return ret;
a41c76
 }
a41c76
 
a41c76
-- 
a41c76
2.26.2
a41c76