From: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
To: <tony.luck@intel.com>, <bp@alien8.de>, <tglx@linutronix.de>,
<mingo@redhat.com>, <hpa@zytor.com>
Cc: <x86@kernel.org>, <linux-edac@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH V2 5/5] x86/mcheck/AMD: Set MCAX Enable bit
Date: Fri, 15 Jan 2016 17:50:36 -0600 [thread overview]
Message-ID: <1452901836-27632-6-git-send-email-Aravind.Gopalakrishnan@amd.com> (raw)
In-Reply-To: <1452901836-27632-1-git-send-email-Aravind.Gopalakrishnan@amd.com>
It is required for 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.
So setting the bit here and also defining the new MSR range for
SMCA enabled proccessors in msr-index
Signed-off-by: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
---
arch/x86/include/asm/msr-index.h | 5 +++++
arch/x86/kernel/cpu/mcheck/mce_amd.c | 19 +++++++++++++++++++
2 files changed, 24 insertions(+)
diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h
index b05402e..088b5a7 100644
--- a/arch/x86/include/asm/msr-index.h
+++ b/arch/x86/include/asm/msr-index.h
@@ -264,6 +264,11 @@
#define MSR_IA32_MC0_CTL2 0x00000280
#define MSR_IA32_MCx_CTL2(x) (MSR_IA32_MC0_CTL2 + (x))
+/* SMCA defined MSR register set for AMD64 */
+#define MSR_AMD64_SMCA_MC0_CONFIG 0xc0002004
+
+#define MSR_AMD64_SMCA_MCx_CONFIG(x) (MSR_AMD64_SMCA_MC0_CONFIG + 0x10*(x))
+
#define MSR_P6_PERFCTR0 0x000000c1
#define MSR_P6_PERFCTR1 0x000000c2
#define MSR_P6_EVNTSEL0 0x00000186
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index 29a7688..158ea86 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -57,6 +57,14 @@
/* 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 OS will configure
+ * Deferred errors in the new MCx_CONFIG register.
+ * If the bit is not set, UC errors will cause a system panic
+ */
+#define SMCA_MCAX_EN_OFF 0x1
static const char * const th_names[] = {
"load_store",
@@ -322,6 +330,17 @@ void mce_amd_feature_init(struct cpuinfo_x86 *c)
if (mce_flags.smca) {
u32 smca_low = 0, smca_high = 0;
+ u32 smca_addr = 0;
+
+ /* Set MCAXEnable bit for each bank */
+ smca_addr = MSR_AMD64_SMCA_MCx_CONFIG(bank);
+ if (rdmsr_safe(smca_addr,
+ &smca_low,
+ &smca_high))
+ continue;
+
+ smca_high |= SMCA_MCAX_EN_OFF;
+ wrmsr(smca_addr, smca_low, smca_high);
/* Gather LVT offset for thresholding */
if (rdmsr_safe(MSR_CU_DEF_ERR,
--
2.7.0
next prev parent reply other threads:[~2016-01-15 23:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-15 23:50 [PATCH V2 0/5] Updates to AMD MCE driver per Scalable MCA spec Aravind Gopalakrishnan
2016-01-15 23:50 ` [PATCH V2 1/5] x86, mce: Fix order of AMD MCE init function call Aravind Gopalakrishnan
2016-01-15 23:50 ` [PATCH V2 2/5] x86/mcheck/AMD: Do not perform shared bank check for future processors Aravind Gopalakrishnan
2016-01-16 1:01 ` kbuild test robot
2016-01-16 1:01 ` [PATCH] x86/mcheck/AMD: fix boolreturn.cocci warnings kbuild test robot
2016-01-15 23:50 ` [PATCH V2 3/5] x86/mcheck/AMD: Reduce number of blocks scanned per bank Aravind Gopalakrishnan
2016-01-15 23:50 ` [PATCH V2 4/5] x86/mcheck/AMD: Fix LVT offset configuration for thresholding Aravind Gopalakrishnan
2016-01-16 10:37 ` Borislav Petkov
2016-01-16 10:45 ` Borislav Petkov
2016-01-15 23:50 ` Aravind Gopalakrishnan [this message]
2016-01-16 16:05 ` [PATCH V2 0/5] Updates to AMD MCE driver per Scalable MCA spec Borislav Petkov
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=1452901836-27632-6-git-send-email-Aravind.Gopalakrishnan@amd.com \
--to=aravind.gopalakrishnan@amd.com \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
--cc=x86@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
all inboxes | Powered by JetHome®