diff options
author | Yazen Ghannam <Yazen.Ghannam@amd.com> | 2016-05-11 08:58:26 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-05-12 03:08:22 -0400 |
commit | 71faad43060d3d2040583635fbf7d1bdb3d04118 (patch) | |
tree | 414776ccd1620793fd03a55bde36f12e68cbc89c | |
parent | e128b4f4833cc1e0ce46dfb978763b260f166188 (diff) |
x86/cpu: Add detection of AMD RAS Capabilities
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 <Yazen.Ghannam@amd.com>
[ Shorten comment. ]
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: linux-edac <linux-edac@vger.kernel.org>
Link: http://lkml.kernel.org/r/1462971509-3856-5-git-send-email-bp@alien8.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | arch/x86/include/asm/cpufeature.h | 1 | ||||
-rw-r--r-- | arch/x86/include/asm/cpufeatures.h | 7 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/common.c | 10 |
3 files changed, 14 insertions, 4 deletions
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h index 3636ec06c887..53ac9bbf2064 100644 --- a/arch/x86/include/asm/cpufeature.h +++ b/arch/x86/include/asm/cpufeature.h | |||
@@ -27,6 +27,7 @@ enum cpuid_leafs | |||
27 | CPUID_6_EAX, | 27 | CPUID_6_EAX, |
28 | CPUID_8000_000A_EDX, | 28 | CPUID_8000_000A_EDX, |
29 | CPUID_7_ECX, | 29 | CPUID_7_ECX, |
30 | CPUID_8000_0007_EBX, | ||
30 | }; | 31 | }; |
31 | 32 | ||
32 | #ifdef CONFIG_X86_FEATURE_NAMES | 33 | #ifdef CONFIG_X86_FEATURE_NAMES |
diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h index 8f9afefd2dc5..d4e5018e9a44 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h | |||
@@ -12,7 +12,7 @@ | |||
12 | /* | 12 | /* |
13 | * Defines x86 CPU feature bits | 13 | * Defines x86 CPU feature bits |
14 | */ | 14 | */ |
15 | #define NCAPINTS 17 /* N 32-bit words worth of info */ | 15 | #define NCAPINTS 18 /* N 32-bit words worth of info */ |
16 | #define NBUGINTS 1 /* N 32-bit bug flags */ | 16 | #define NBUGINTS 1 /* N 32-bit bug flags */ |
17 | 17 | ||
18 | /* | 18 | /* |
@@ -280,6 +280,11 @@ | |||
280 | #define X86_FEATURE_PKU (16*32+ 3) /* Protection Keys for Userspace */ | 280 | #define X86_FEATURE_PKU (16*32+ 3) /* Protection Keys for Userspace */ |
281 | #define X86_FEATURE_OSPKE (16*32+ 4) /* OS Protection Keys Enable */ | 281 | #define X86_FEATURE_OSPKE (16*32+ 4) /* OS Protection Keys Enable */ |
282 | 282 | ||
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 | |||
283 | /* | 288 | /* |
284 | * BUG word(s) | 289 | * BUG word(s) |
285 | */ | 290 | */ |
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 8394b3d1f94f..dbc6f066e231 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -717,6 +717,13 @@ void get_cpu_cap(struct cpuinfo_x86 *c) | |||
717 | } | 717 | } |
718 | } | 718 | } |
719 | 719 | ||
720 | if (c->extended_cpuid_level >= 0x80000007) { | ||
721 | cpuid(0x80000007, &eax, &ebx, &ecx, &edx); | ||
722 | |||
723 | c->x86_capability[CPUID_8000_0007_EBX] = ebx; | ||
724 | c->x86_power = edx; | ||
725 | } | ||
726 | |||
720 | if (c->extended_cpuid_level >= 0x80000008) { | 727 | if (c->extended_cpuid_level >= 0x80000008) { |
721 | cpuid(0x80000008, &eax, &ebx, &ecx, &edx); | 728 | cpuid(0x80000008, &eax, &ebx, &ecx, &edx); |
722 | 729 | ||
@@ -729,9 +736,6 @@ void get_cpu_cap(struct cpuinfo_x86 *c) | |||
729 | c->x86_phys_bits = 36; | 736 | c->x86_phys_bits = 36; |
730 | #endif | 737 | #endif |
731 | 738 | ||
732 | if (c->extended_cpuid_level >= 0x80000007) | ||
733 | c->x86_power = cpuid_edx(0x80000007); | ||
734 | |||
735 | if (c->extended_cpuid_level >= 0x8000000a) | 739 | if (c->extended_cpuid_level >= 0x8000000a) |
736 | c->x86_capability[CPUID_8000_000A_EDX] = cpuid_edx(0x8000000a); | 740 | c->x86_capability[CPUID_8000_000A_EDX] = cpuid_edx(0x8000000a); |
737 | 741 | ||