diff mbox

AMD Processor Topology Information

Message ID 20171029212224.2777-1-pixo@polepetko.eu (mailing list archive)
State New, archived
Headers show

Commit Message

Stanislav Lanci Oct. 29, 2017, 9:22 p.m. UTC
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(-)

Comments

no-reply@patchew.org Oct. 29, 2017, 10:14 p.m. UTC | #1
Hi,

This series seems to have some coding style problems. See output below for
more information:

Subject: [Qemu-devel] [PATCH] AMD Processor Topology Information
Type: series
Message-id: 20171029212224.2777-1-pixo@polepetko.eu

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]               patchew/20171029212224.2777-1-pixo@polepetko.eu -> patchew/20171029212224.2777-1-pixo@polepetko.eu
Switched to a new branch 'test'
b10ea7470d AMD Processor Topology Information

=== OUTPUT BEGIN ===
Checking PATCH 1/1: AMD Processor Topology Information...
ERROR: space prohibited before that close parenthesis ')'
#26: FILE: target/i386/cpu.c:3119:
+            *ebx = (cs->nr_threads - 1 ) << 8 | cpu->core_id;

ERROR: line over 90 characters
#44: FILE: target/i386/cpu.c:3796:
+    if (!IS_INTEL_CPU(env) && cs->nr_threads > 1 && !ht_warned && (env->cpuid_version & 0xFF00F00) != 0x800F00) {

total: 2 errors, 0 warnings, 30 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

=== OUTPUT END ===

Test command exited with code: 1


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@freelists.org
diff mbox

Patch

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;