Skip to content

Commit e6c8f18

Browse files
Aravind GopalakrishnanIngo Molnar
authored andcommitted
x86/mce/AMD: Set MCAX Enable bit
It is required for the OS to acknowledge that it is using the MCAX register set and its associated fields by setting the 'McaXEnable' bit in each bank's MCi_CONFIG register. If it is not set, then all UC errors will cause a system panic. Signed-off-by: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com> Signed-off-by: Borislav Petkov <bp@suse.de> Cc: Borislav Petkov <bp@alien8.de> 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/1453750913-4781-9-git-send-email-bp@alien8.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 429893b commit e6c8f18

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

arch/x86/include/asm/msr-index.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,10 @@
264264
#define MSR_IA32_MC0_CTL2 0x00000280
265265
#define MSR_IA32_MCx_CTL2(x) (MSR_IA32_MC0_CTL2 + (x))
266266

267+
/* 'SMCA': AMD64 Scalable MCA */
268+
#define MSR_AMD64_SMCA_MC0_CONFIG 0xc0002004
269+
#define MSR_AMD64_SMCA_MCx_CONFIG(x) (MSR_AMD64_SMCA_MC0_CONFIG + 0x10*(x))
270+
267271
#define MSR_P6_PERFCTR0 0x000000c1
268272
#define MSR_P6_PERFCTR1 0x000000c2
269273
#define MSR_P6_EVNTSEL0 0x00000186

arch/x86/kernel/cpu/mcheck/mce_amd.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@
5454
/* Threshold LVT offset is at MSR0xC0000410[15:12] */
5555
#define SMCA_THR_LVT_OFF 0xF000
5656

57+
/*
58+
* OS is required to set the MCAX bit to acknowledge that it is now using the
59+
* new MSR ranges and new registers under each bank. It also means that the OS
60+
* will configure deferred errors in the new MCx_CONFIG register. If the bit is
61+
* not set, uncorrectable errors will cause a system panic.
62+
*/
63+
#define SMCA_MCAX_EN_OFF 0x1
64+
5765
static const char * const th_names[] = {
5866
"load_store",
5967
"insn_fetch",
@@ -292,6 +300,12 @@ prepare_threshold_block(unsigned int bank, unsigned int block, u32 addr,
292300

293301
if (mce_flags.smca) {
294302
u32 smca_low, smca_high;
303+
u32 smca_addr = MSR_AMD64_SMCA_MCx_CONFIG(bank);
304+
305+
if (!rdmsr_safe(smca_addr, &smca_low, &smca_high)) {
306+
smca_high |= SMCA_MCAX_EN_OFF;
307+
wrmsr(smca_addr, smca_low, smca_high);
308+
}
295309

296310
/* Gather LVT offset for thresholding: */
297311
if (rdmsr_safe(MSR_CU_DEF_ERR, &smca_low, &smca_high))

0 commit comments

Comments
 (0)