thebeanogamer / rpms / qemu-kvm

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