qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] AMD Processor Topology Information


From: Stanislav Lanci
Subject: [Qemu-devel] [PATCH] AMD Processor Topology Information
Date: Sun, 29 Oct 2017 22:22:24 +0100

Add CPUID 0x8000001E for describing AMD Processor Topology Information
Disables warning about smt for 17h family of AMD CPUs

Signed-off-by: Stanislav Lanci <address@hidden>
---
 target/i386/cpu.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index ddc45abd70..5885b2dd9e 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -3072,6 +3072,22 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, 
uint32_t count,
             *edx = 0;
         }
         break;
+    case 0x8000001E:
+        /* AMD CPU Topology */
+        if (env->cpuid_vendor1 != CPUID_VENDOR_INTEL_1 ||
+            env->cpuid_vendor2 != CPUID_VENDOR_INTEL_2 ||
+            env->cpuid_vendor3 != CPUID_VENDOR_INTEL_3) {
+            *eax = cpu->apic_id;
+            *ebx = (cs->nr_threads - 1 ) << 8 | cpu->core_id;
+            *ecx = cpu->socket_id;
+            *edx = 0;
+        } else {
+            *eax = 0;
+            *ebx = 0;
+            *ecx = 0;
+            *edx = 0;
+        }
+        break;
     case 0xC0000000:
         *eax = env->cpuid_xlevel2;
         *ebx = 0;
@@ -3742,7 +3758,7 @@ static void x86_cpu_realizefn(DeviceState *dev, Error 
**errp)
      * NOTE: the following code has to follow qemu_init_vcpu(). Otherwise
      * cs->nr_threads hasn't be populated yet and the checking is incorrect.
      */
-    if (!IS_INTEL_CPU(env) && cs->nr_threads > 1 && !ht_warned) {
+    if (!IS_INTEL_CPU(env) && cs->nr_threads > 1 && !ht_warned && 
(env->cpuid_version & 0xFF00F00) != 0x800F00) {
         error_report("AMD CPU doesn't support hyperthreading. Please configure"
                      " -smp options properly.");
         ht_warned = true;
-- 
2.14.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]