All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stanislav Lanci <pixo@polepetko.eu>
To: qemu-devel@nongnu.org
Cc: Stanislav Lanci <pixo@polepetko.eu>
Subject: [Qemu-devel] [PATCH] AMD Processor Topology Information
Date: Sun, 29 Oct 2017 22:22:24 +0100	[thread overview]
Message-ID: <20171029212224.2777-1-pixo@polepetko.eu> (raw)

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

Signed-off-by: Stanislav Lanci <pixo@polepetko.eu>
---
 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	other threads:[~2017-10-29 22:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-29 21:22 Stanislav Lanci [this message]
2017-10-29 22:14 ` [Qemu-devel] [PATCH] AMD Processor Topology Information no-reply
2017-11-03 17:30 Stanislav Lanci
2017-11-08 12:44 ` Philippe Mathieu-Daudé
2017-11-09 16:04   ` pixo
2018-01-25 21:56 ` Babu Moger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171029212224.2777-1-pixo@polepetko.eu \
    --to=pixo@polepetko.eu \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.