Blame SOURCES/0061-Add-Broadwell-DE-MSCOD-values.patch

0b5545
From e7b88730f8a753a50fa0b8d1f7027f79baa05ca4 Mon Sep 17 00:00:00 2001
0b5545
From: Aristeu Rozanski <arozansk@redhat.com>
0b5545
Date: Fri, 8 Apr 2016 15:07:18 -0400
0b5545
Subject: [PATCH 1/2] Add Broadwell DE MSCOD values
0b5545
0b5545
Based on mcelog commit id 32252e9c37e97ea5083d90d2cf194bb85a4a0cda.
0b5545
0b5545
Signed-off-by: Aristeu Rozanski <arozansk@redhat.com>
0b5545
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
0b5545
---
0b5545
 Makefile.am              |   2 +-
0b5545
 mce-intel-broadwell-de.c | 146 +++++++++++++++++++++++++++++++++++++++++++++++
0b5545
 mce-intel.c              |   3 +
0b5545
 ras-mce-handler.c        |   6 +-
0b5545
 ras-mce-handler.h        |   2 +
0b5545
 5 files changed, 156 insertions(+), 3 deletions(-)
0b5545
 create mode 100644 mce-intel-broadwell-de.c
0b5545
0b5545
diff --git a/Makefile.am b/Makefile.am
0b5545
index a1cb02a..a8477d3 100644
0b5545
--- a/Makefile.am
0b5545
+++ b/Makefile.am
0b5545
@@ -29,7 +29,7 @@ if WITH_MCE
0b5545
 			mce-intel-p4-p6.c mce-intel-nehalem.c \
0b5545
 			mce-intel-dunnington.c mce-intel-tulsa.c \
0b5545
 			mce-intel-sb.c mce-intel-ivb.c mce-intel-haswell.c \
0b5545
-			mce-intel-knl.c
0b5545
+			mce-intel-knl.c mce-intel-broadwell-de.c
0b5545
 endif
0b5545
 if WITH_EXTLOG
0b5545
    rasdaemon_SOURCES += ras-extlog-handler.c
0b5545
diff --git a/mce-intel-broadwell-de.c b/mce-intel-broadwell-de.c
0b5545
new file mode 100644
0b5545
index 0000000..d52c82e
0b5545
--- /dev/null
0b5545
+++ b/mce-intel-broadwell-de.c
0b5545
@@ -0,0 +1,146 @@
0b5545
+/*
0b5545
+ * The code below came from Tony Luck's mcelog code,
0b5545
+ * released under GNU Public General License, v.2
0b5545
+ *
0b5545
+ * This program is free software; you can redistribute it and/or modify
0b5545
+ * it under the terms of the GNU General Public License as published by
0b5545
+ * the Free Software Foundation; either version 2 of the License, or
0b5545
+ * (at your option) any later version.
0b5545
+ *
0b5545
+ * This program is distributed in the hope that it will be useful,
0b5545
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
0b5545
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0b5545
+ * GNU General Public License for more details.
0b5545
+ *
0b5545
+ * You should have received a copy of the GNU General Public License
0b5545
+ * along with this program; if not, write to the Free Software
0b5545
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
0b5545
+*/
0b5545
+
0b5545
+#include <string.h>
0b5545
+#include <stdio.h>
0b5545
+
0b5545
+#include "ras-mce-handler.h"
0b5545
+#include "bitfield.h"
0b5545
+
0b5545
+/* See IA32 SDM Vol3B Table 16-24 */
0b5545
+
0b5545
+static char *pcu_1[] = {
0b5545
+	[0x00] = "No Error",
0b5545
+	[0x09] = "MC_MESSAGE_CHANNEL_TIMEOUT",
0b5545
+	[0x13] = "MC_DMI_TRAINING_TIMEOUT",
0b5545
+	[0x15] = "MC_DMI_CPU_RESET_ACK_TIMEOUT",
0b5545
+	[0x1E] = "MC_VR_ICC_MAX_LT_FUSED_ICC_MAX",
0b5545
+	[0x25] = "MC_SVID_COMMAN_TIMEOUT",
0b5545
+	[0x26] = "MCA_PKGC_DIRECT_WAKE_RING_TIMEOUT",
0b5545
+	[0x29] = "MC_VR_VOUT_MAC_LT_FUSED_SVID",
0b5545
+	[0x2B] = "MC_PKGC_WATCHDOG_HANG_CBZ_DOWN",
0b5545
+	[0x2C] = "MC_PKGC_WATCHDOG_HANG_CBZ_UP",
0b5545
+	[0x44] = "MC_CRITICAL_VR_FAILED",
0b5545
+	[0x46] = "MC_VID_RAMP_DOWN_FAILED",
0b5545
+	[0x49] = "MC_SVID_WRITE_REG_VOUT_MAX_FAILED",
0b5545
+	[0x4B] = "MC_BOOT_VID_TIMEOUT_DRAM_0",
0b5545
+	[0x4F] = "MC_SVID_COMMAND_ERROR",
0b5545
+	[0x52] = "MC_FIVR_CATAS_OVERVOL_FAULT",
0b5545
+	[0x53] = "MC_FIVR_CATAS_OVERCUR_FAULT",
0b5545
+	[0x57] = "MC_SVID_PKGC_REQUEST_FAILED",
0b5545
+	[0x58] = "MC_SVID_IMON_REQUEST_FAILED",
0b5545
+	[0x59] = "MC_SVID_ALERT_REQUEST_FAILED",
0b5545
+	[0x62] = "MC_INVALID_PKGS_RSP_QPI",
0b5545
+	[0x64] = "MC_INVALID_PKG_STATE_CONFIG",
0b5545
+	[0x67] = "MC_HA_IMC_RW_BLOCK_ACK_TIMEOUT",
0b5545
+	[0x6A] = "MC_MSGCH_PMREQ_CMP_TIMEOUT",
0b5545
+	[0x72] = "MC_WATCHDOG_TIMEOUT_PKGS_MASTER",
0b5545
+	[0x81] = "MC_RECOVERABLE_DIE_THERMAL_TOO_HOT"
0b5545
+};
0b5545
+
0b5545
+static struct field pcu_mc4[] = {
0b5545
+	FIELD(24, pcu_1),
0b5545
+	{}
0b5545
+};
0b5545
+
0b5545
+/* See IA32 SDM Vol3B Table 16-18 */
0b5545
+
0b5545
+static struct field memctrl_mc9[] = {
0b5545
+	SBITFIELD(16, "Address parity error"),
0b5545
+	SBITFIELD(17, "HA Wrt buffer Data parity error"),
0b5545
+	SBITFIELD(18, "HA Wrt byte enable parity error"),
0b5545
+	SBITFIELD(19, "Corrected patrol scrub error"),
0b5545
+	SBITFIELD(20, "Uncorrected patrol scrub error"),
0b5545
+	SBITFIELD(21, "Corrected spare error"),
0b5545
+	SBITFIELD(22, "Uncorrected spare error"),
0b5545
+	SBITFIELD(23, "Corrected memory read error"),
0b5545
+	SBITFIELD(24, "iMC, WDB, parity errors"),
0b5545
+	{}
0b5545
+};
0b5545
+
0b5545
+void broadwell_de_decode_model(struct ras_events *ras, struct mce_event *e)
0b5545
+{
0b5545
+	uint64_t status = e->status;
0b5545
+	uint32_t mca = status & 0xffff;
0b5545
+	unsigned rank0 = -1, rank1 = -1, chan;
0b5545
+
0b5545
+	switch (e->bank) {
0b5545
+	case 4:
0b5545
+		switch (EXTRACT(status, 0, 15) & ~(1ull << 12)) {
0b5545
+		case 0x402: case 0x403:
0b5545
+			mce_snprintf(e->mcastatus_msg, "Internal errors ");
0b5545
+			break;
0b5545
+		case 0x406:
0b5545
+			mce_snprintf(e->mcastatus_msg, "Intel TXT errors ");
0b5545
+			break;
0b5545
+		case 0x407:
0b5545
+			mce_snprintf(e->mcastatus_msg, "Other UBOX Internal errors ");
0b5545
+			break;
0b5545
+		}
0b5545
+		if (EXTRACT(status, 16, 19) & 3)
0b5545
+			mce_snprintf(e->mcastatus_msg, "PCU internal error ");
0b5545
+		if (EXTRACT(status, 20, 23) & 4)
0b5545
+			mce_snprintf(e->mcastatus_msg, "Ubox error ");
0b5545
+		decode_bitfield(e, status, pcu_mc4);
0b5545
+		break;
0b5545
+	case 9: case 10:
0b5545
+		mce_snprintf(e->mcastatus_msg, "MemCtrl: ");
0b5545
+		decode_bitfield(e, status, memctrl_mc9);
0b5545
+		break;
0b5545
+	}
0b5545
+
0b5545
+	/*
0b5545
+	 * Memory error specific code. Returns if the error is not a MC one
0b5545
+	 */
0b5545
+
0b5545
+	/* Check if the error is at the memory controller */
0b5545
+	if ((mca >> 7) != 1)
0b5545
+		return;
0b5545
+
0b5545
+	/* Ignore unless this is an corrected extended error from an iMC bank */
0b5545
+	if (e->bank < 9 || e->bank > 16 || (status & MCI_STATUS_UC) ||
0b5545
+		!test_prefix(7, status & 0xefff))
0b5545
+		return;
0b5545
+
0b5545
+	/*
0b5545
+	 * Parse the reported channel and ranks
0b5545
+	 */
0b5545
+
0b5545
+	chan = EXTRACT(status, 0, 3);
0b5545
+	if (chan == 0xf)
0b5545
+		return;
0b5545
+
0b5545
+	mce_snprintf(e->mc_location, "memory_channel=%d", chan);
0b5545
+
0b5545
+	if (EXTRACT(e->misc, 62, 62)) {
0b5545
+		rank0 = EXTRACT(e->misc, 46, 50);
0b5545
+		if (EXTRACT(e->misc, 63, 63))
0b5545
+			rank1 = EXTRACT(e->misc, 51, 55);
0b5545
+	}
0b5545
+
0b5545
+	/*
0b5545
+	 * FIXME: The conversion from rank to dimm requires to parse the
0b5545
+	 * DMI tables and call failrank2dimm().
0b5545
+	 */
0b5545
+	if (rank0 != -1 && rank1 != -1)
0b5545
+		mce_snprintf(e->mc_location, "ranks=%d and %d",
0b5545
+				     rank0, rank1);
0b5545
+	else if (rank0 != -1)
0b5545
+		mce_snprintf(e->mc_location, "rank=%d", rank0);
0b5545
+}
0b5545
diff --git a/mce-intel.c b/mce-intel.c
0b5545
index 032f4e0..b132903 100644
0b5545
--- a/mce-intel.c
0b5545
+++ b/mce-intel.c
0b5545
@@ -401,6 +401,9 @@ int parse_intel_event(struct ras_events *ras, struct mce_event *e)
0b5545
 	case CPU_KNIGHTS_LANDING:
0b5545
 		knl_decode_model(ras, e);
0b5545
 		break;
0b5545
+	case CPU_BROADWELL_DE:
0b5545
+		broadwell_de_decode_model(ras, e);
0b5545
+		break;
0b5545
 	default:
0b5545
 		break;
0b5545
 	}
0b5545
diff --git a/ras-mce-handler.c b/ras-mce-handler.c
0b5545
index 3b0b05b..b58d6e0 100644
0b5545
--- a/ras-mce-handler.c
0b5545
+++ b/ras-mce-handler.c
0b5545
@@ -50,6 +50,7 @@ static char *cputype_name[] = {
0b5545
 	[CPU_HASWELL] = "Haswell",
0b5545
 	[CPU_HASWELL_EPEX] = "Intel Xeon v3 (Haswell) EP/EX",
0b5545
 	[CPU_BROADWELL] = "Broadwell",
0b5545
+	[CPU_BROADWELL_DE] = "Broadwell DE",
0b5545
 	[CPU_KNIGHTS_LANDING] = "Knights Landing",
0b5545
 };
0b5545
 
0b5545
@@ -90,8 +91,9 @@ static enum cputype select_intel_cputype(struct ras_events *ras)
0b5545
 			return CPU_HASWELL;
0b5545
 		else if (mce->model == 0x3f)
0b5545
 			return CPU_HASWELL_EPEX;
0b5545
-		else if (mce->model == 0x3d || mce->model == 0x4f ||
0b5545
-			 mce->model == 0x56)
0b5545
+		else if (mce->model == 0x56)
0b5545
+			return CPU_BROADWELL_DE;
0b5545
+		else if (mce->model == 0x3d || mce->model == 0x4f)
0b5545
 			return CPU_BROADWELL;
0b5545
 		else if (mce->model == 0x57)
0b5545
 			return CPU_KNIGHTS_LANDING;
0b5545
diff --git a/ras-mce-handler.h b/ras-mce-handler.h
0b5545
index 5466743..2648048 100644
0b5545
--- a/ras-mce-handler.h
0b5545
+++ b/ras-mce-handler.h
0b5545
@@ -45,6 +45,7 @@ enum cputype {
0b5545
 	CPU_HASWELL,
0b5545
 	CPU_HASWELL_EPEX,
0b5545
 	CPU_BROADWELL,
0b5545
+	CPU_BROADWELL_DE,
0b5545
 	CPU_KNIGHTS_LANDING,
0b5545
 };
0b5545
 
0b5545
@@ -121,6 +122,7 @@ void ivb_decode_model(struct ras_events *ras, struct mce_event *e);
0b5545
 void hsw_decode_model(struct ras_events *ras, struct mce_event *e);
0b5545
 void knl_decode_model(struct ras_events *ras, struct mce_event *e);
0b5545
 void tulsa_decode_model(struct mce_event *e);
0b5545
+void broadwell_de_decode_model(struct ras_events *ras, struct mce_event *e);
0b5545
 
0b5545
 /* Software defined banks */
0b5545
 #define MCE_EXTENDED_BANK	128
0b5545
-- 
0b5545
1.8.3.1
0b5545