mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
To: <tglx@linutronix.de>, <mingo@redhat.com>, <hpa@zytor.com>,
	<tony.luck@intel.com>, <bp@alien8.de>,
	<dougthompson@xmission.com>, <mchehab@osg.samsung.com>,
	<x86@kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-edac@vger.kernel.org>
Cc: <dave.hansen@linux.intel.com>, <mgorman@suse.de>, <bp@suse.de>,
	<riel@redhat.com>, <jacob.w.shin@gmail.com>,
	Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
Subject: [PATCH 3/3] edac, mce_amd_inj: Inject errors only on NBC for bank 4 errors
Date: Mon, 22 Dec 2014 14:10:12 -0600	[thread overview]
Message-ID: <1419279012-4754-4-git-send-email-Aravind.Gopalakrishnan@amd.com> (raw)
In-Reply-To: <1419279012-4754-1-git-send-email-Aravind.Gopalakrishnan@amd.com>

For Fam10h onwards, bank4 MCE are reported only to the node base
cores. This patch modifies the do_inject code path to take care
of this.

Refer D18F3x44[NbMcaToMstCpuEn] on BKDGs of Fam10h and later for
clarifications on the reporting of MC4 errors only to NBC MSRs.

Signed-off-by: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
---
 drivers/edac/mce_amd_inj.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/drivers/edac/mce_amd_inj.c b/drivers/edac/mce_amd_inj.c
index 0bd91a8..d4aa14f 100644
--- a/drivers/edac/mce_amd_inj.c
+++ b/drivers/edac/mce_amd_inj.c
@@ -126,6 +126,7 @@ static void do_inject(void)
 {
 	u64 mcg_status = 0;
 	unsigned int cpu = i_mce.extcpu;
+	int saved_cpu = -1;
 	u8 b = i_mce.bank;
 
 	if (!(i_mce.inject_flags & MCJ_EXCEPTION)) {
@@ -143,22 +144,34 @@ static void do_inject(void)
 	if (!(i_mce.status & MCI_STATUS_PCC))
 		mcg_status |= MCG_STATUS_RIPV;
 
-	toggle_hw_mce_inject(cpu, true);
-
 	wrmsr_on_cpu(cpu, MSR_IA32_MCG_STATUS,
 		     (u32)mcg_status, (u32)(mcg_status >> 32));
 
+	/*
+	 * for Fam10h+, if bank = 4, then we should write to NBC MSR
+	 * for multi-node processors else to core 0 for single node processors
+	 */
+	if (boot_cpu_data.x86 >= 0x10 && b == 4) {
+		saved_cpu = cpu;
+		cpu = amd_get_nbc_for_cpu(cpu);
+	}
+
+	toggle_hw_mce_inject(cpu, true);
+
 	wrmsr_on_cpu(cpu, MSR_IA32_MCx_STATUS(b),
 		     (u32)i_mce.status, (u32)(i_mce.status >> 32));
 
 	wrmsr_on_cpu(cpu, MSR_IA32_MCx_ADDR(b),
 		     (u32)i_mce.addr, (u32)(i_mce.addr >> 32));
 
+	toggle_hw_mce_inject(cpu, false);
+
+	if (saved_cpu != -1)
+		cpu = saved_cpu;
+
 	wrmsr_on_cpu(cpu, MSR_IA32_MCx_MISC(b),
 		     (u32)i_mce.misc, (u32)(i_mce.misc >> 32));
 
-	toggle_hw_mce_inject(cpu, false);
-
 	smp_call_function_single(cpu, trigger_mce, NULL, 0);
 
 err:
-- 
2.0.2


  parent reply	other threads:[~2014-12-22 19:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-22 20:10 [PATCH 0/3] Fix MCE handling for AMD multi-node processors Aravind Gopalakrishnan
2014-12-22 20:10 ` [PATCH 1/3] x86,amd: Refactor amd cpu topology functions for " Aravind Gopalakrishnan
2014-12-22 20:10 ` [PATCH 2/3] x86, mce: Handle AMD MCE on bank4 on NBC " Aravind Gopalakrishnan
2014-12-22 20:10 ` Aravind Gopalakrishnan [this message]
2014-12-22 20:15 ` [PATCH 0/3] Fix MCE handling for AMD " Borislav Petkov
2014-12-22 20:56   ` Aravind Gopalakrishnan
2014-12-22 23:19     ` Borislav Petkov
2014-12-23 19:41       ` Aravind Gopalakrishnan
2015-01-06 23:54         ` Aravind Gopalakrishnan
2015-01-07 17:06           ` Borislav Petkov
2015-01-08  0:18             ` Aravind Gopalakrishnan

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=1419279012-4754-4-git-send-email-Aravind.Gopalakrishnan@amd.com \
    --to=aravind.gopalakrishnan@amd.com \
    --cc=bp@alien8.de \
    --cc=bp@suse.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=dougthompson@xmission.com \
    --cc=hpa@zytor.com \
    --cc=jacob.w.shin@gmail.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@osg.samsung.com \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=riel@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®