Skip to content

Commit 6ff5598

Browse files
yghannamZhengShunQian
authored andcommitted
x86/cpu: Add detection of AMD RAS Capabilities
commit 71faad4 upstream Add a new CPUID leaf to hold the contents of CPUID 0x80000007_EBX (RasCap). Define bits that are currently in use: Bit 0: McaOverflowRecov Bit 1: SUCCOR Bit 3: ScalableMca Signed-off-by: Yazen Ghannam <[email protected]> [ Shorten comment. ] Signed-off-by: Borislav Petkov <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Brian Gerst <[email protected]> Cc: Denys Vlasenko <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Tony Luck <[email protected]> Cc: linux-edac <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]> Signed-off-by: Srivatsa S. Bhat <[email protected]> Reviewed-by: Matt Helsley (VMware) <[email protected]> Reviewed-by: Alexey Makhalov <[email protected]> Reviewed-by: Bo Gan <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 17a7243 commit 6ff5598

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

arch/x86/include/asm/cpufeature.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ enum cpuid_leafs
2727
CPUID_6_EAX,
2828
CPUID_8000_000A_EDX,
2929
CPUID_7_ECX,
30+
CPUID_8000_0007_EBX,
3031
};
3132

3233
#ifdef CONFIG_X86_FEATURE_NAMES

arch/x86/include/asm/cpufeatures.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
/*
1313
* Defines x86 CPU feature bits
1414
*/
15-
#define NCAPINTS 17 /* N 32-bit words worth of info */
15+
#define NCAPINTS 18 /* N 32-bit words worth of info */
1616
#define NBUGINTS 1 /* N 32-bit bug flags */
1717

1818
/*
@@ -280,6 +280,11 @@
280280
#define X86_FEATURE_PKU (16*32+ 3) /* Protection Keys for Userspace */
281281
#define X86_FEATURE_OSPKE (16*32+ 4) /* OS Protection Keys Enable */
282282

283+
/* AMD-defined CPU features, CPUID level 0x80000007 (ebx), word 17 */
284+
#define X86_FEATURE_OVERFLOW_RECOV (17*32+0) /* MCA overflow recovery support */
285+
#define X86_FEATURE_SUCCOR (17*32+1) /* Uncorrectable error containment and recovery */
286+
#define X86_FEATURE_SMCA (17*32+3) /* Scalable MCA */
287+
283288
/*
284289
* BUG word(s)
285290
*/

arch/x86/kernel/cpu/common.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,13 @@ void get_cpu_cap(struct cpuinfo_x86 *c)
741741
}
742742
}
743743

744+
if (c->extended_cpuid_level >= 0x80000007) {
745+
cpuid(0x80000007, &eax, &ebx, &ecx, &edx);
746+
747+
c->x86_capability[CPUID_8000_0007_EBX] = ebx;
748+
c->x86_power = edx;
749+
}
750+
744751
if (c->extended_cpuid_level >= 0x80000008) {
745752
cpuid(0x80000008, &eax, &ebx, &ecx, &edx);
746753

@@ -753,9 +760,6 @@ void get_cpu_cap(struct cpuinfo_x86 *c)
753760
c->x86_phys_bits = 36;
754761
#endif
755762

756-
if (c->extended_cpuid_level >= 0x80000007)
757-
c->x86_power = cpuid_edx(0x80000007);
758-
759763
if (c->extended_cpuid_level >= 0x8000000a)
760764
c->x86_capability[CPUID_8000_000A_EDX] = cpuid_edx(0x8000000a);
761765

0 commit comments

Comments
 (0)