linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Ingo Molnar <mingo@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/7] x86/mce/AMD: Disable LogDeferredInMcaStat for SMCA systems
Date: Wed, 11 May 2016 14:58:24 +0200	[thread overview]
Message-ID: <1462971509-3856-3-git-send-email-bp@alien8.de> (raw)
In-Reply-To: <1462971509-3856-1-git-send-email-bp@alien8.de>

From: Yazen Ghannam <Yazen.Ghannam@amd.com>

Disable Deferred Error logging in MCA_{STATUS,ADDR} additionally for
SMCA systems as this information will retrieved from MCA_DE{STAT,ADDR}
on those systems.

Signed-off-by: Yazen Ghannam <Yazen.Ghannam@amd.com>
Cc: Aravind Gopalakrishnan <aravindksg.lkml@gmail.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: linux-edac <linux-edac@vger.kernel.org>
Cc: x86-ml <x86@kernel.org>
Link: http://lkml.kernel.org/r/1462377407-1446-3-git-send-email-Yazen.Ghannam@amd.com
[ Simplify, drop SMCA_MCAX_EN_OFF define too. ]
Signed-off-by: Borislav Petkov <bp@suse.de>
---
 arch/x86/kernel/cpu/mcheck/mce_amd.c | 38 +++++++++++++++++++++++++++---------
 1 file changed, 29 insertions(+), 9 deletions(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index d1b1e62f7cb9..527ddae3017b 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -54,14 +54,6 @@
 /* Threshold LVT offset is at MSR0xC0000410[15:12] */
 #define SMCA_THR_LVT_OFF	0xF000
 
-/*
- * OS is required to set the MCAX bit to acknowledge that it is now using the
- * new MSR ranges and new registers under each bank. It also means that the OS
- * will configure deferred errors in the new MCx_CONFIG register. If the bit is
- * not set, uncorrectable errors will cause a system panic.
- */
-#define SMCA_MCAX_EN_OFF	0x1
-
 static const char * const th_names[] = {
 	"load_store",
 	"insn_fetch",
@@ -374,7 +366,35 @@ prepare_threshold_block(unsigned int bank, unsigned int block, u32 addr,
 		u32 smca_addr = MSR_AMD64_SMCA_MCx_CONFIG(bank);
 
 		if (!rdmsr_safe(smca_addr, &smca_low, &smca_high)) {
-			smca_high |= SMCA_MCAX_EN_OFF;
+			/*
+			 * OS is required to set the MCAX bit to acknowledge
+			 * that it is now using the new MSR ranges and new
+			 * registers under each bank. It also means that the OS
+			 * will configure deferred errors in the new MCx_CONFIG
+			 * register. If the bit is not set, uncorrectable errors
+			 * will cause a system panic.
+			 *
+			 * MCA_CONFIG[MCAX] is bit 32 (0 in the high portion of
+			 * the MSR.)
+			 */
+			smca_high |= BIT(0);
+
+			/*
+			 * SMCA logs Deferred Error information in
+			 * MCA_DE{STAT,ADDR} registers with the option of
+			 * additionally logging to MCA_{STATUS,ADDR} if
+			 * MCA_CONFIG[LogDeferredInMcaStat] is set.
+			 *
+			 * This bit is usually set by BIOS to retain the old
+			 * behavior for OSes that don't use the new registers.
+			 * Linux supports the new registers so let's disable
+			 * that additional logging here.
+			 *
+			 * MCA_CONFIG[LogDeferredInMcaStat] is bit 34 (bit 2 in
+			 * the high portion of the MSR).
+			 */
+			smca_high &= ~BIT(2);
+
 			wrmsr(smca_addr, smca_low, smca_high);
 		}
 
-- 
2.7.3

  parent reply	other threads:[~2016-05-11 12:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-11 12:58 [PATCH 0/7] x86/ras: RAS queue Borislav Petkov
2016-05-11 12:58 ` [PATCH 1/7] x86/mce/AMD: Log Deferred Errors using SMCA MCA_DE{STAT,ADDR} registers Borislav Petkov
2016-05-12 10:26   ` [tip:ras/core] " tip-bot for Yazen Ghannam
2016-05-11 12:58 ` Borislav Petkov [this message]
2016-05-12 10:27   ` [tip:ras/core] x86/mce/AMD: Disable LogDeferredInMcaStat for SMCA systems tip-bot for Yazen Ghannam
2016-05-11 12:58 ` [PATCH 3/7] x86/mce/AMD: Save an indentation level in prepare_threshold_block() Borislav Petkov
2016-05-12 10:27   ` [tip:ras/core] " tip-bot for Borislav Petkov
2016-05-11 12:58 ` [PATCH 4/7] x86/cpu: Add detection of AMD RAS Capabilities Borislav Petkov
2016-05-12 10:27   ` [tip:ras/core] " tip-bot for Yazen Ghannam
2016-05-11 12:58 ` [PATCH 5/7] x86/mce: Update AMD mcheck init to use cpu_has() facilities Borislav Petkov
2016-05-12 10:28   ` [tip:ras/core] " tip-bot for Yazen Ghannam
2016-05-11 12:58 ` [PATCH 6/7] EDAC, mce_amd: Detect SMCA using X86_FEATURE_SMCA Borislav Petkov
2016-05-12 10:28   ` [tip:ras/core] " tip-bot for Yazen Ghannam
2016-05-11 12:58 ` [PATCH 7/7] x86/RAS: Add SMCA support to AMD Error Injector Borislav Petkov
2016-05-12 10:29   ` [tip:ras/core] " tip-bot for Yazen Ghannam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1462971509-3856-3-git-send-email-bp@alien8.de \
    --to=bp@alien8.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).