public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] MCE, AMD: Make MC2 decoding part of amd_decoder_ops as well
@ 2012-12-17 19:39 Jacob Shin
  2012-12-17 19:39 ` [PATCH 2/2] MCE, AMD: MCE decoding support for AMD Family 16h Jacob Shin
  2012-12-17 19:57 ` [PATCH 1/2] MCE, AMD: Make MC2 decoding part of amd_decoder_ops as well Joe Perches
  0 siblings, 2 replies; 25+ messages in thread
From: Jacob Shin @ 2012-12-17 19:39 UTC (permalink / raw)
  To: Borislav Petkov, Doug Thompson; +Cc: linux-edac, linux-kernel, Jacob Shin

Currently only AMD Family 15h processors have special handling for MC2
errors, since upcoming Family 16h will also need unique handling,
let's make MC2 handling part of amd_decoder_ops.

Signed-off-by: Jacob Shin <jacob.shin@amd.com>
---
 drivers/edac/mce_amd.c |   58 ++++++++++++++++++++++++++----------------------
 drivers/edac/mce_amd.h |    1 +
 2 files changed, 32 insertions(+), 27 deletions(-)

diff --git a/drivers/edac/mce_amd.c b/drivers/edac/mce_amd.c
index ad63757..84320f9 100644
--- a/drivers/edac/mce_amd.c
+++ b/drivers/edac/mce_amd.c
@@ -399,12 +399,9 @@ static void decode_mc1_mce(struct mce *m)
 		pr_emerg(HW_ERR "Corrupted MC1 MCE info?\n");
 }
 
-static void decode_mc2_mce(struct mce *m)
+static bool k8_mc2_mce(u16 ec, u8 xec)
 {
-	u16 ec = EC(m->status);
-	u8 xec = XEC(m->status, xec_mask);
-
-	pr_emerg(HW_ERR "MC2 Error");
+	bool ret = true;
 
 	if (xec == 0x1)
 		pr_cont(" in the write data buffers.\n");
@@ -429,24 +426,18 @@ static void decode_mc2_mce(struct mce *m)
 				pr_cont(": %s parity/ECC error during data "
 					"access from L2.\n", R4_MSG(ec));
 			else
-				goto wrong_mc2_mce;
+				ret = false;
 		} else
-			goto wrong_mc2_mce;
+			ret = false;
 	} else
-		goto wrong_mc2_mce;
-
-	return;
+		ret = false;
 
- wrong_mc2_mce:
-	pr_emerg(HW_ERR "Corrupted MC2 MCE info?\n");
+	return ret;
 }
 
-static void decode_f15_mc2_mce(struct mce *m)
+static bool f15h_mc2_mce(u16 ec, u8 xec)
 {
-	u16 ec = EC(m->status);
-	u8 xec = XEC(m->status, xec_mask);
-
-	pr_emerg(HW_ERR "MC2 Error: ");
+	bool ret = true;
 
 	if (TLB_ERROR(ec)) {
 		if (xec == 0x0)
@@ -454,10 +445,10 @@ static void decode_f15_mc2_mce(struct mce *m)
 		else if (xec == 0x1)
 			pr_cont("Poison data provided for TLB fill.\n");
 		else
-			goto wrong_f15_mc2_mce;
+			ret = false;
 	} else if (BUS_ERROR(ec)) {
 		if (xec > 2)
-			goto wrong_f15_mc2_mce;
+			ret = false;
 
 		pr_cont("Error during attempted NB data read.\n");
 	} else if (MEM_ERROR(ec)) {
@@ -471,14 +462,24 @@ static void decode_f15_mc2_mce(struct mce *m)
 			break;
 
 		default:
-			goto wrong_f15_mc2_mce;
+			ret = false;
 		}
 	}
 
-	return;
+	return ret;
+}
 
- wrong_f15_mc2_mce:
-	pr_emerg(HW_ERR "Corrupted MC2 MCE info?\n");
+static void decode_mc2_mce(struct mce *m)
+{
+	u16 ec = EC(m->status);
+	u8 xec = XEC(m->status, xec_mask);
+
+	pr_emerg(HW_ERR "MC2 Error: ");
+
+	if (fam_ops->mc2_mce(ec, xec))
+		;
+	else
+		pr_emerg(HW_ERR "Corrupted MC2 MCE info?\n");
 }
 
 static void decode_mc3_mce(struct mce *m)
@@ -702,10 +703,7 @@ int amd_decode_mce(struct notifier_block *nb, unsigned long val, void *data)
 		break;
 
 	case 2:
-		if (c->x86 == 0x15)
-			decode_f15_mc2_mce(m);
-		else
-			decode_mc2_mce(m);
+		decode_mc2_mce(m);
 		break;
 
 	case 3:
@@ -783,33 +781,39 @@ static int __init mce_amd_init(void)
 	case 0xf:
 		fam_ops->mc0_mce = k8_mc0_mce;
 		fam_ops->mc1_mce = k8_mc1_mce;
+		fam_ops->mc2_mce = k8_mc2_mce;
 		break;
 
 	case 0x10:
 		fam_ops->mc0_mce = f10h_mc0_mce;
 		fam_ops->mc1_mce = k8_mc1_mce;
+		fam_ops->mc2_mce = k8_mc2_mce;
 		break;
 
 	case 0x11:
 		fam_ops->mc0_mce = k8_mc0_mce;
 		fam_ops->mc1_mce = k8_mc1_mce;
+		fam_ops->mc2_mce = k8_mc2_mce;
 		break;
 
 	case 0x12:
 		fam_ops->mc0_mce = f12h_mc0_mce;
 		fam_ops->mc1_mce = k8_mc1_mce;
+		fam_ops->mc2_mce = k8_mc2_mce;
 		break;
 
 	case 0x14:
 		nb_err_cpumask  = 0x3;
 		fam_ops->mc0_mce = f14h_mc0_mce;
 		fam_ops->mc1_mce = f14h_mc1_mce;
+		fam_ops->mc2_mce = k8_mc2_mce;
 		break;
 
 	case 0x15:
 		xec_mask = 0x1f;
 		fam_ops->mc0_mce = f15h_mc0_mce;
 		fam_ops->mc1_mce = f15h_mc1_mce;
+		fam_ops->mc2_mce = f15h_mc2_mce;
 		break;
 
 	default:
diff --git a/drivers/edac/mce_amd.h b/drivers/edac/mce_amd.h
index 6796799..000f6e2 100644
--- a/drivers/edac/mce_amd.h
+++ b/drivers/edac/mce_amd.h
@@ -78,6 +78,7 @@ extern const char * const ii_msgs[];
 struct amd_decoder_ops {
 	bool (*mc0_mce)(u16, u8);
 	bool (*mc1_mce)(u16, u8);
+	bool (*mc2_mce)(u16, u8);
 };
 
 void amd_report_gart_errors(bool);
-- 
1.7.9.5



^ permalink raw reply related	[flat|nested] 25+ messages in thread
* [PATCH V2 0/2] MCE, AMD: MCE decoding support for AMD Family 16h
@ 2012-12-18 21:06 Jacob Shin
  2012-12-18 21:06 ` [PATCH 2/2] " Jacob Shin
  0 siblings, 1 reply; 25+ messages in thread
From: Jacob Shin @ 2012-12-18 21:06 UTC (permalink / raw)
  To: Borislav Petkov, Doug Thompson; +Cc: linux-edac, linux-kernel, Jacob Shin

The following patchset enables MCE decoding support for AMD Family 16h
processors.

Changes in V2:
* Changed if/else style and pr_cont usage per feedback from:
  https://lkml.org/lkml/2012/12/17/365

* Merged f14h and f16h mc0 and mc2 decoding into common function per
  feedback from: https://lkml.org/lkml/2012/12/18/269

* Fixed typo in INT_ERROR decoding.

Jacob Shin (2):
  MCE, AMD: Make MC2 decoding part of amd_decoder_ops as well
  MCE, AMD: MCE decoding support for AMD Family 16h

 drivers/edac/mce_amd.c |  139 +++++++++++++++++++++++++++++++++++-------------
 drivers/edac/mce_amd.h |    4 ++
 2 files changed, 105 insertions(+), 38 deletions(-)

-- 
1.7.9.5



^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2012-12-20 19:20 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-17 19:39 [PATCH 1/2] MCE, AMD: Make MC2 decoding part of amd_decoder_ops as well Jacob Shin
2012-12-17 19:39 ` [PATCH 2/2] MCE, AMD: MCE decoding support for AMD Family 16h Jacob Shin
2012-12-18 17:19   ` Borislav Petkov
2012-12-18 17:30     ` Jacob Shin
2012-12-18 18:09       ` Jacob Shin
2012-12-18 18:32         ` Borislav Petkov
2012-12-18 18:24     ` Joe Perches
2012-12-18 18:33       ` Borislav Petkov
2012-12-18 18:37         ` Joe Perches
2012-12-18 19:00           ` Mauro Carvalho Chehab
2012-12-17 19:57 ` [PATCH 1/2] MCE, AMD: Make MC2 decoding part of amd_decoder_ops as well Joe Perches
2012-12-17 20:05   ` Borislav Petkov
2012-12-17 20:16     ` Joe Perches
2012-12-17 20:22       ` Borislav Petkov
2012-12-17 20:34         ` Joe Perches
2012-12-17 20:40           ` Borislav Petkov
2012-12-17 20:43             ` Jacob Shin
2012-12-17 20:59               ` Joe Perches
2012-12-17 21:08                 ` Borislav Petkov
2012-12-17 21:11                   ` Jacob Shin
2012-12-17 21:09                 ` Jacob Shin
  -- strict thread matches above, loose matches on Subject: below --
2012-12-18 21:06 [PATCH V2 0/2] MCE, AMD: MCE decoding support for AMD Family 16h Jacob Shin
2012-12-18 21:06 ` [PATCH 2/2] " Jacob Shin
2012-12-18 22:10   ` Joe Perches
2012-12-18 22:56     ` Borislav Petkov
2012-12-20 19:20       ` Borislav Petkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox