Skip to contentSkip to conversation

target-i386: Correct family/model/stepping for Opteron_G3

PATCH Applied Denis V. Lunev 2 participants 2 messages Oct 3, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 target-i386: Correct family/model/stepping for Opteron_G3

From: Evgeny Yakovlev <[email protected]>

Current CPU definition for AMD Opteron third generation includes features like SSE4a and LAHF_LM support in emulated CPUID. These features are present in K8 rev.E or K10 CPUs and later. However, current G3 family and model describe 2nd generation K8 cores instead.

This is incorrect but was considered harmless until our tests found a problem with linux kernels >= 3.10 (and maybe earlier) which specifically check for Opteron K8 model when parsing CPUID leaf 0x80000001:
http://lxr.free-electrons.com/source/arch/x86/kernel/cpu/amd.c?v=3.16#L552
This code will disable LAHF_LM feature in /proc/cpuinfo if model number is inconsistent.

This change sets Opteron_G3 family/model/stepping to 16/2/3 which is a proper Opteron 3rd generation 2350 CPU.

CC Paolo Bonzini <[email protected]>
CC Richard Henderson <[email protected]>
CC Eduardo Habkost <[email protected]>

---
Changes from v1:
- 2.7 compat kludes

 include/hw/i386/pc.h | 15 +++++++++++++++
 target-i386/cpu.c    |  6 +++---
 2 files changed, 18 insertions(+), 3 deletions(-)
include/hw/i386/pc.h +15 -0
index 47bdf10..cb2df83 100644
@@ -379,6 +379,21 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
         .driver   = TYPE_X86_CPU,\
         .property = "full-cpuid-auto-level",\
         .value    = "off",\
+    },\
+    {\
+        .driver   = "Opteron_G3" "-" TYPE_X86_CPU,\
+        .property = "family",\
+        .value    = "15",\
+    },\
+    {\
+        .driver   = "Opteron_G3" "-" TYPE_X86_CPU,\
+        .property = "model",\
+        .value    = "6",\
+    },\
+    {\
+        .driver   = "Opteron_G3" "-" TYPE_X86_CPU,\
+        .property = "stepping",\
+        .value    = "1",\
     },
 
 #define PC_COMPAT_2_6 \
target-i386/cpu.c +3 -3
index 333309b..d1c3ad1 100644
@@ -1425,9 +1425,9 @@ static X86CPUDefinition builtin_x86_defs[] = {
         .name = "Opteron_G3",
         .level = 5,
         .vendor = CPUID_VENDOR_AMD,
-        .family = 15,
-        .model = 6,
-        .stepping = 1,
+        .family = 16,
+        .model = 2,
+        .stepping = 3,
         .features[FEAT_1_EDX] =
             CPUID_VME | CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX |
             CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_MCA |
Signature · 1 line
2.7.4
#1 lore raw
Quoted 14 lines · Denis V. Lunev

From: Evgeny Yakovlev <[email protected]>

Current CPU definition for AMD Opteron third generation includes features like SSE4a and LAHF_LM support in emulated CPUID. These features are present in K8 rev.E or K10 CPUs and later. However, current G3 family and model describe 2nd generation K8 cores instead.

This is incorrect but was considered harmless until our tests found a problem with linux kernels >= 3.10 (and maybe earlier) which specifically check for Opteron K8 model when parsing CPUID leaf 0x80000001:
http://lxr.free-electrons.com/source/arch/x86/kernel/cpu/amd.c?v=3.16#L552
This code will disable LAHF_LM feature in /proc/cpuinfo if model number is inconsistent.

Quoted 8 lines

This change sets Opteron_G3 family/model/stepping to 16/2/3 which is a proper Opteron 3rd generation 2350 CPU.

CC Paolo Bonzini <[email protected]>
CC Richard Henderson <[email protected]>
CC Eduardo Habkost <[email protected]>

Applied to x86-next. Thanks.

Signature · 1 line
Eduardo