ae23c9
From e6f541bd5eea74185e34e41e628d52cfc5ab7b6a Mon Sep 17 00:00:00 2001
ae23c9
From: Eduardo Habkost <ehabkost@redhat.com>
ae23c9
Date: Thu, 26 Jul 2018 17:19:03 +0100
ae23c9
Subject: [PATCH 13/14] i386: Remove generic SMT thread check
ae23c9
ae23c9
RH-Author: Eduardo Habkost <ehabkost@redhat.com>
ae23c9
Message-id: <20180726171904.27418-11-ehabkost@redhat.com>
ae23c9
Patchwork-id: 81532
ae23c9
O-Subject: [qemu-kvm RHEL8/virt212 PATCH v2 10/11] i386: Remove generic SMT thread check
ae23c9
Bugzilla: 1597739
ae23c9
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
ae23c9
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
ae23c9
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
ae23c9
ae23c9
From: Babu Moger <babu.moger@amd.com>
ae23c9
ae23c9
Remove generic non-intel check while validating hyperthreading support.
ae23c9
Certain AMD CPUs can support hyperthreading now.
ae23c9
ae23c9
CPU family with TOPOEXT feature can support hyperthreading now.
ae23c9
ae23c9
Signed-off-by: Babu Moger <babu.moger@amd.com>
ae23c9
Tested-by: Geoffrey McRae <geoff@hostfission.com>
ae23c9
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
ae23c9
Message-Id: <1529443919-67509-4-git-send-email-babu.moger@amd.com>
ae23c9
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
ae23c9
(cherry picked from commit 6b2942f966d5e54c37d305c80f5f98d504c2bc55)
ae23c9
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
ae23c9
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ae23c9
---
ae23c9
 target/i386/cpu.c | 17 +++++++++++------
ae23c9
 1 file changed, 11 insertions(+), 6 deletions(-)
ae23c9
ae23c9
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
ae23c9
index fe2b2e8..8647109 100644
ae23c9
--- a/target/i386/cpu.c
ae23c9
+++ b/target/i386/cpu.c
ae23c9
@@ -4952,17 +4952,22 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
ae23c9
 
ae23c9
     qemu_init_vcpu(cs);
ae23c9
 
ae23c9
-    /* Only Intel CPUs support hyperthreading. Even though QEMU fixes this
ae23c9
-     * issue by adjusting CPUID_0000_0001_EBX and CPUID_8000_0008_ECX
ae23c9
-     * based on inputs (sockets,cores,threads), it is still better to gives
ae23c9
+    /*
ae23c9
+     * Most Intel and certain AMD CPUs support hyperthreading. Even though QEMU
ae23c9
+     * fixes this issue by adjusting CPUID_0000_0001_EBX and CPUID_8000_0008_ECX
ae23c9
+     * based on inputs (sockets,cores,threads), it is still better to give
ae23c9
      * users a warning.
ae23c9
      *
ae23c9
      * NOTE: the following code has to follow qemu_init_vcpu(). Otherwise
ae23c9
      * cs->nr_threads hasn't be populated yet and the checking is incorrect.
ae23c9
      */
ae23c9
-    if (!IS_INTEL_CPU(env) && cs->nr_threads > 1 && !ht_warned) {
ae23c9
-        error_report("AMD CPU doesn't support hyperthreading. Please configure"
ae23c9
-                     " -smp options properly.");
ae23c9
+     if (IS_AMD_CPU(env) &&
ae23c9
+         !(env->features[FEAT_8000_0001_ECX] & CPUID_EXT3_TOPOEXT) &&
ae23c9
+         cs->nr_threads > 1 && !ht_warned) {
ae23c9
+            error_report("This family of AMD CPU doesn't support "
ae23c9
+                         "hyperthreading(%d). Please configure -smp "
ae23c9
+                         "options properly or try enabling topoext feature.",
ae23c9
+                         cs->nr_threads);
ae23c9
         ht_warned = true;
ae23c9
     }
ae23c9
 
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9