]> git.karo-electronics.de Git - linux-beck.git/commitdiff
x86, AMD: Disable wrongly set X86_FEATURE_LAHF_LM CPUID bit
authorBorislav Petkov <borislav.petkov@amd.com>
Mon, 31 Aug 2009 07:50:11 +0000 (09:50 +0200)
committerH. Peter Anvin <hpa@zytor.com>
Mon, 31 Aug 2009 22:14:29 +0000 (15:14 -0700)
fbd8b1819e80ac5a176d085fdddc3a34d1499318 turns off the bit for
/proc/cpuinfo. However, a proper/full fix would be to additionally
turn off the bit in the CPUID output so that future callers get
correct CPU features info.

Do that by basically reversing what the BIOS wrongfully does at boot.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
LKML-Reference: <1251705011-18636-3-git-send-email-petkovbb@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
arch/x86/kernel/cpu/amd.c

index 63fddcd082cdf2a3b4cc261d54608ec2dac07b64..0a717fc6aeb66115f2767eebf2d659e6f81deb98 100644 (file)
@@ -404,9 +404,18 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
                /*
                 * Some BIOSes incorrectly force this feature, but only K8
                 * revision D (model = 0x14) and later actually support it.
+                * (AMD Erratum #110, docId: 25759).
                 */
-               if (c->x86_model < 0x14)
+               if (c->x86_model < 0x14 && cpu_has(c, X86_FEATURE_LAHF_LM)) {
+                       u64 val;
+
                        clear_cpu_cap(c, X86_FEATURE_LAHF_LM);
+                       if (!rdmsrl_amd_safe(0xc001100d, &val)) {
+                               val &= ~(1ULL << 32);
+                               wrmsrl_amd_safe(0xc001100d, val);
+                       }
+               }
+
        }
        if (c->x86 == 0x10 || c->x86 == 0x11)
                set_cpu_cap(c, X86_FEATURE_REP_GOOD);