All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/1] target-i386: Correct family/model/stepping for Opteron_G3 (2350)
@ 2016-09-30 10:28 Denis V. Lunev
  2016-09-30 11:14 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Denis V. Lunev @ 2016-09-30 10:28 UTC (permalink / raw)
  To: qemu-devel
  Cc: den, Evgeny Yakovlev, Paolo Bonzini, Richard Henderson, Eduardo Habkost

From: Evgeny Yakovlev <eyakovlev@virtuozzo.com>

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 out 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.

Signed-off-by: Evgeny Yakovlev <eyakovlev@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Paolo Bonzini <pbonzini@redhat.com>
CC: Richard Henderson <rth@twiddle.net>
CC: Eduardo Habkost <ehabkost@redhat.com>
---
 target-i386/cpu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 333309b..d1c3ad1 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -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 |
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH 1/1] target-i386: Correct family/model/stepping for Opteron_G3 (2350)
  2016-09-30 10:28 [Qemu-devel] [PATCH 1/1] target-i386: Correct family/model/stepping for Opteron_G3 (2350) Denis V. Lunev
@ 2016-09-30 11:14 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2016-09-30 11:14 UTC (permalink / raw)
  To: Denis V. Lunev, qemu-devel
  Cc: Evgeny Yakovlev, Richard Henderson, Eduardo Habkost



On 30/09/2016 12:28, Denis V. Lunev wrote:
> From: Evgeny Yakovlev <eyakovlev@virtuozzo.com>
> 
> 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 out 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.
> 
> Signed-off-by: Evgeny Yakovlev <eyakovlev@virtuozzo.com>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> CC: Paolo Bonzini <pbonzini@redhat.com>
> CC: Richard Henderson <rth@twiddle.net>
> CC: Eduardo Habkost <ehabkost@redhat.com>
> ---
>  target-i386/cpu.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> index 333309b..d1c3ad1 100644
> --- a/target-i386/cpu.c
> +++ b/target-i386/cpu.c
> @@ -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 |
> 


This needs the usual compatibility gunk for versions <= 2.7.

Thanks,

Paolo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-30 11:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-30 10:28 [Qemu-devel] [PATCH 1/1] target-i386: Correct family/model/stepping for Opteron_G3 (2350) Denis V. Lunev
2016-09-30 11:14 ` Paolo Bonzini

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.