From: "Andi Kleen" Port missing cpuid bits from x86-64 to i386 Signed-off-by: Andi Kleen Signed-off-by: Andrew Morton --- 25-akpm/arch/i386/kernel/cpu/common.c | 4 +++- 25-akpm/arch/i386/kernel/cpu/proc.c | 10 ++++++++-- 25-akpm/include/asm-i386/cpufeature.h | 6 +++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff -puN arch/i386/kernel/cpu/common.c~i386-port-missing-cpuid-bits-from-x86-64-to-i386 arch/i386/kernel/cpu/common.c --- 25/arch/i386/kernel/cpu/common.c~i386-port-missing-cpuid-bits-from-x86-64-to-i386 2005-01-09 23:01:21.253152136 -0800 +++ 25-akpm/arch/i386/kernel/cpu/common.c 2005-01-09 23:01:21.260151072 -0800 @@ -274,8 +274,10 @@ void __init generic_identify(struct cpui /* AMD-defined flags: level 0x80000001 */ xlvl = cpuid_eax(0x80000000); if ( (xlvl & 0xffff0000) == 0x80000000 ) { - if ( xlvl >= 0x80000001 ) + if ( xlvl >= 0x80000001 ) { c->x86_capability[1] = cpuid_edx(0x80000001); + c->x86_capability[6] = cpuid_ecx(0x80000001); + } if ( xlvl >= 0x80000004 ) get_model_name(c); /* Default name */ } diff -puN arch/i386/kernel/cpu/proc.c~i386-port-missing-cpuid-bits-from-x86-64-to-i386 arch/i386/kernel/cpu/proc.c --- 25/arch/i386/kernel/cpu/proc.c~i386-port-missing-cpuid-bits-from-x86-64-to-i386 2005-01-09 23:01:21.254151984 -0800 +++ 25-akpm/arch/i386/kernel/cpu/proc.c 2005-01-09 23:01:21.261150920 -0800 @@ -28,7 +28,7 @@ static int show_cpuinfo(struct seq_file "pni", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL, NULL, NULL, NULL, "mp", "nx", NULL, "mmxext", NULL, - NULL, NULL, NULL, NULL, NULL, "lm", "3dnowext", "3dnow", + NULL, "fxsr_opt", NULL, NULL, NULL, "lm", "3dnowext", "3dnow", /* Transmeta-defined */ "recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL, @@ -45,7 +45,7 @@ static int show_cpuinfo(struct seq_file /* Intel-defined (#2) */ "pni", NULL, NULL, "monitor", "ds_cpl", NULL, NULL, "est", - "tm2", NULL, "cid", NULL, NULL, NULL, "xtpr", NULL, + "tm2", NULL, "cid", NULL, NULL, "cx16", "xtpr", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, @@ -54,6 +54,12 @@ static int show_cpuinfo(struct seq_file NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + + /* AMD-defined (#2) */ + "lahf_lm", "cmp_legacy", NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, }; struct cpuinfo_x86 *c = v; int i, n = c - cpu_data; diff -puN include/asm-i386/cpufeature.h~i386-port-missing-cpuid-bits-from-x86-64-to-i386 include/asm-i386/cpufeature.h --- 25/include/asm-i386/cpufeature.h~i386-port-missing-cpuid-bits-from-x86-64-to-i386 2005-01-09 23:01:21.256151680 -0800 +++ 25-akpm/include/asm-i386/cpufeature.h 2005-01-09 23:01:21.262150768 -0800 @@ -9,7 +9,7 @@ #include -#define NCAPINTS 6 /* Currently we have 6 32-bit words worth of info */ +#define NCAPINTS 7 /* N 32-bit words worth of info */ /* Intel-defined CPU features, CPUID level 0x00000001 (edx), word 0 */ #define X86_FEATURE_FPU (0*32+ 0) /* Onboard FPU */ @@ -77,6 +77,7 @@ #define X86_FEATURE_EST (4*32+ 7) /* Enhanced SpeedStep */ #define X86_FEATURE_TM2 (4*32+ 8) /* Thermal Monitor 2 */ #define X86_FEATURE_CID (4*32+10) /* Context ID */ +#define X86_FEATURE_CX16 (4*32+13) /* CMPXCHG16B */ #define X86_FEATURE_XTPR (4*32+14) /* Send Task Priority Messages */ /* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001, word 5 */ @@ -85,6 +86,9 @@ #define X86_FEATURE_XCRYPT (5*32+ 6) /* on-CPU crypto (xcrypt insn) */ #define X86_FEATURE_XCRYPT_EN (5*32+ 7) /* on-CPU crypto enabled */ +/* More extended AMD flags: CPUID level 0x80000001, ecx, word 6 */ +#define X86_FEATURE_LAHF_LM (5*32+ 0) /* LAHF/SAHF in long mode */ +#define X86_FEATURE_CMP_LEGACY (5*32+ 1) /* If yes HyperThreading not valid */ #define cpu_has(c, bit) test_bit(bit, (c)->x86_capability) #define boot_cpu_has(bit) test_bit(bit, boot_cpu_data.x86_capability) _