krishnanadh / rpms / rasdaemon

Forked from rpms/rasdaemon a year ago
Clone

Blame SOURCES/0062-Add-Broadwell-EP-EX-MSCOD-values.patch

d9e469
From 0dd44fca9d756990acf01cd2cdaa585f369168bc Mon Sep 17 00:00:00 2001
d9e469
From: Aristeu Rozanski <arozansk@redhat.com>
d9e469
Date: Fri, 8 Apr 2016 15:07:19 -0400
d9e469
Subject: [PATCH 2/2] Add Broadwell EP/EX MSCOD values
d9e469
d9e469
Based on mcelog commit id 32252e9c37e97ea5083d90d2cf194bb85a4a0cda.
d9e469
d9e469
Signed-off-by: Aristeu Rozanski <arozansk@redhat.com>
d9e469
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
d9e469
---
d9e469
 Makefile.am                |   3 +-
d9e469
 mce-intel-broadwell-epex.c | 191 +++++++++++++++++++++++++++++++++++++++++++++
d9e469
 mce-intel.c                |   3 +
d9e469
 ras-mce-handler.c          |   5 +-
d9e469
 ras-mce-handler.h          |   2 +
d9e469
 5 files changed, 202 insertions(+), 2 deletions(-)
d9e469
 create mode 100644 mce-intel-broadwell-epex.c
d9e469
d9e469
diff --git a/Makefile.am b/Makefile.am
d9e469
index a8477d3..c9e4481 100644
d9e469
--- a/Makefile.am
d9e469
+++ b/Makefile.am
d9e469
@@ -29,7 +29,8 @@ if WITH_MCE
d9e469
 			mce-intel-p4-p6.c mce-intel-nehalem.c \
d9e469
 			mce-intel-dunnington.c mce-intel-tulsa.c \
d9e469
 			mce-intel-sb.c mce-intel-ivb.c mce-intel-haswell.c \
d9e469
-			mce-intel-knl.c mce-intel-broadwell-de.c
d9e469
+			mce-intel-knl.c mce-intel-broadwell-de.c \
d9e469
+			mce-intel-broadwell-epex.c
d9e469
 endif
d9e469
 if WITH_EXTLOG
d9e469
    rasdaemon_SOURCES += ras-extlog-handler.c
d9e469
diff --git a/mce-intel-broadwell-epex.c b/mce-intel-broadwell-epex.c
d9e469
new file mode 100644
d9e469
index 0000000..f7cd3b6
d9e469
--- /dev/null
d9e469
+++ b/mce-intel-broadwell-epex.c
d9e469
@@ -0,0 +1,191 @@
d9e469
+/*
d9e469
+ * The code below came from Tony Luck's mcelog code,
d9e469
+ * released under GNU Public General License, v.2
d9e469
+ *
d9e469
+ * This program is free software; you can redistribute it and/or modify
d9e469
+ * it under the terms of the GNU General Public License as published by
d9e469
+ * the Free Software Foundation; either version 2 of the License, or
d9e469
+ * (at your option) any later version.
d9e469
+ *
d9e469
+ * This program is distributed in the hope that it will be useful,
d9e469
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
d9e469
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
d9e469
+ * GNU General Public License for more details.
d9e469
+ *
d9e469
+ * You should have received a copy of the GNU General Public License
d9e469
+ * along with this program; if not, write to the Free Software
d9e469
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
d9e469
+*/
d9e469
+
d9e469
+#include <string.h>
d9e469
+#include <stdio.h>
d9e469
+
d9e469
+#include "ras-mce-handler.h"
d9e469
+#include "bitfield.h"
d9e469
+
d9e469
+/* See IA32 SDM Vol3B Table 16-20 */
d9e469
+
d9e469
+static char *pcu_1[] = {
d9e469
+	[0x00] = "No Error",
d9e469
+	[0x09] = "MC_MESSAGE_CHANNEL_TIMEOUT",
d9e469
+	[0x0D] = "MC_IMC_FORCE_SR_S3_TIMEOUT",
d9e469
+	[0x0E] = "MC_CPD_UNCPD_SD_TIMEOUT",
d9e469
+	[0x13] = "MC_DMI_TRAINING_TIMEOUT",
d9e469
+	[0x15] = "MC_DMI_CPU_RESET_ACK_TIMEOUT",
d9e469
+	[0x1E] = "MC_VR_ICC_MAX_LT_FUSED_ICC_MAX",
d9e469
+	[0x25] = "MC_SVID_COMMAN_TIMEOUT",
d9e469
+	[0x29] = "MC_VR_VOUT_MAC_LT_FUSED_SVID",
d9e469
+	[0x2B] = "MC_PKGC_WATCHDOG_HANG_CBZ_DOWN",
d9e469
+	[0x2C] = "MC_PKGC_WATCHDOG_HANG_CBZ_UP",
d9e469
+	[0x39] = "MC_PKGC_WATCHDOG_HANG_C3_UP_SF",
d9e469
+	[0x44] = "MC_CRITICAL_VR_FAILED",
d9e469
+	[0x45] = "MC_ICC_MAX_NOTSUPPORTED",
d9e469
+	[0x46] = "MC_VID_RAMP_DOWN_FAILED",
d9e469
+	[0x47] = "MC_EXCL_MODE_NO_PMREQ_CMP",
d9e469
+	[0x48] = "MC_SVID_READ_REG_ICC_MAX_FAILED",
d9e469
+	[0x49] = "MC_SVID_WRITE_REG_VOUT_MAX_FAILED",
d9e469
+	[0x4B] = "MC_BOOT_VID_TIMEOUT_DRAM_0",
d9e469
+	[0x4C] = "MC_BOOT_VID_TIMEOUT_DRAM_1",
d9e469
+	[0x4D] = "MC_BOOT_VID_TIMEOUT_DRAM_2",
d9e469
+	[0x4E] = "MC_BOOT_VID_TIMEOUT_DRAM_3",
d9e469
+	[0x4F] = "MC_SVID_COMMAND_ERROR",
d9e469
+	[0x52] = "MC_FIVR_CATAS_OVERVOL_FAULT",
d9e469
+	[0x53] = "MC_FIVR_CATAS_OVERCUR_FAULT",
d9e469
+	[0x57] = "MC_SVID_PKGC_REQUEST_FAILED",
d9e469
+	[0x58] = "MC_SVID_IMON_REQUEST_FAILED",
d9e469
+	[0x59] = "MC_SVID_ALERT_REQUEST_FAILED",
d9e469
+	[0x60] = "MC_INVALID_PKGS_REQ_PCH",
d9e469
+	[0x61] = "MC_INVALID_PKGS_REQ_QPI",
d9e469
+	[0x62] = "MC_INVALID_PKGS_RSP_QPI",
d9e469
+	[0x63] = "MC_INVALID_PKGS_RSP_PCH",
d9e469
+	[0x64] = "MC_INVALID_PKG_STATE_CONFIG",
d9e469
+	[0x67] = "MC_HA_IMC_RW_BLOCK_ACK_TIMEOUT",
d9e469
+	[0x68] = "MC_IMC_RW_SMBUS_TIMEOUT",
d9e469
+	[0x69] = "MC_HA_FAILSTS_CHANGE_DETECTED",
d9e469
+	[0x6A] = "MC_MSGCH_PMREQ_CMP_TIMEOUT",
d9e469
+	[0x70] = "MC_WATCHDOG_TIMEOUT_PKGC_SLAVE",
d9e469
+	[0x71] = "MC_WATCHDOG_TIMEOUT_PKGC_MASTER",
d9e469
+	[0x72] = "MC_WATCHDOG_TIMEOUT_PKGS_MASTER",
d9e469
+	[0x7C] = "MC_BIOS_RST_CPL_INVALID_SEQ",
d9e469
+	[0x7D] = "MC_MORE_THAN_ONE_TXT_AGENT",
d9e469
+	[0x81] = "MC_RECOVERABLE_DIE_THERMAL_TOO_HOT"
d9e469
+};
d9e469
+
d9e469
+static struct field pcu_mc4[] = {
d9e469
+	FIELD(24, pcu_1),
d9e469
+	{}
d9e469
+};
d9e469
+
d9e469
+/* See IA32 SDM Vol3B Table 16-21 */
d9e469
+
d9e469
+static char *qpi[] = {
d9e469
+	[0x02] = "Intel QPI physical layer detected drift buffer alarm",
d9e469
+	[0x03] = "Intel QPI physical layer detected latency buffer rollover",
d9e469
+	[0x10] = "Intel QPI link layer detected control error from R3QPI",
d9e469
+	[0x11] = "Rx entered LLR abort state on CRC error",
d9e469
+	[0x12] = "Unsupported or undefined packet",
d9e469
+	[0x13] = "Intel QPI link layer control error",
d9e469
+	[0x15] = "RBT used un-initialized value",
d9e469
+	[0x20] = "Intel QPI physical layer detected a QPI in-band reset but aborted initialization",
d9e469
+	[0x21] = "Link failover data self healing",
d9e469
+	[0x22] = "Phy detected in-band reset (no width change)",
d9e469
+	[0x23] = "Link failover clock failover",
d9e469
+	[0x30] = "Rx detected CRC error - successful LLR after Phy re-init",
d9e469
+	[0x31] = "Rx detected CRC error - successful LLR wihout Phy re-init",
d9e469
+};
d9e469
+
d9e469
+static struct field qpi_mc[] = {
d9e469
+	FIELD(16, qpi),
d9e469
+	{}
d9e469
+};
d9e469
+
d9e469
+/* See IA32 SDM Vol3B Table 16-26 */
d9e469
+
d9e469
+static struct field memctrl_mc9[] = {
d9e469
+	SBITFIELD(16, "DDR3 address parity error"),
d9e469
+	SBITFIELD(17, "Uncorrected HA write data error"),
d9e469
+	SBITFIELD(18, "Uncorrected HA data byte enable error"),
d9e469
+	SBITFIELD(19, "Corrected patrol scrub error"),
d9e469
+	SBITFIELD(20, "Uncorrected patrol scrub error"),
d9e469
+	SBITFIELD(21, "Corrected spare error"),
d9e469
+	SBITFIELD(22, "Uncorrected spare error"),
d9e469
+	SBITFIELD(24, "iMC write data buffer parity error"),
d9e469
+	SBITFIELD(25, "DDR4 command address parity error"),
d9e469
+	{}
d9e469
+};
d9e469
+
d9e469
+void broadwell_epex_decode_model(struct ras_events *ras, struct mce_event *e)
d9e469
+{
d9e469
+	uint64_t status = e->status;
d9e469
+	uint32_t mca = status & 0xffff;
d9e469
+	unsigned rank0 = -1, rank1 = -1, chan;
d9e469
+
d9e469
+	switch (e->bank) {
d9e469
+	case 4:
d9e469
+		switch (EXTRACT(status, 0, 15) & ~(1ull << 12)) {
d9e469
+		case 0x402: case 0x403:
d9e469
+			mce_snprintf(e->mcastatus_msg, "Internal errors ");
d9e469
+			break;
d9e469
+		case 0x406:
d9e469
+			mce_snprintf(e->mcastatus_msg, "Intel TXT errors ");
d9e469
+			break;
d9e469
+		case 0x407:
d9e469
+			mce_snprintf(e->mcastatus_msg, "Other UBOX Internal errors ");
d9e469
+			break;
d9e469
+		}
d9e469
+		if (EXTRACT(status, 16, 19))
d9e469
+			mce_snprintf(e->mcastatus_msg, "PCU internal error ");
d9e469
+		decode_bitfield(e, status, pcu_mc4);
d9e469
+		break;
d9e469
+	case 5:
d9e469
+	case 20:
d9e469
+	case 21:
d9e469
+		mce_snprintf(e->mcastatus_msg, "QPI: ");
d9e469
+		decode_bitfield(e, status, qpi_mc);
d9e469
+		break;
d9e469
+	case 9: case 10: case 11: case 12:
d9e469
+	case 13: case 14: case 15: case 16:
d9e469
+		mce_snprintf(e->mcastatus_msg, "MemCtrl: ");
d9e469
+		decode_bitfield(e, status, memctrl_mc9);
d9e469
+		break;
d9e469
+	}
d9e469
+
d9e469
+	/*
d9e469
+	 * Memory error specific code. Returns if the error is not a MC one
d9e469
+	 */
d9e469
+
d9e469
+	/* Check if the error is at the memory controller */
d9e469
+	if ((mca >> 7) != 1)
d9e469
+		return;
d9e469
+
d9e469
+	/* Ignore unless this is an corrected extended error from an iMC bank */
d9e469
+	if (e->bank < 9 || e->bank > 16 || (status & MCI_STATUS_UC) ||
d9e469
+		!test_prefix(7, status & 0xefff))
d9e469
+		return;
d9e469
+
d9e469
+	/*
d9e469
+	 * Parse the reported channel and ranks
d9e469
+	 */
d9e469
+
d9e469
+	chan = EXTRACT(status, 0, 3);
d9e469
+	if (chan == 0xf)
d9e469
+		return;
d9e469
+
d9e469
+	mce_snprintf(e->mc_location, "memory_channel=%d", chan);
d9e469
+
d9e469
+	if (EXTRACT(e->misc, 62, 62)) {
d9e469
+		rank0 = EXTRACT(e->misc, 46, 50);
d9e469
+		if (EXTRACT(e->misc, 63, 63))
d9e469
+			rank1 = EXTRACT(e->misc, 51, 55);
d9e469
+	}
d9e469
+
d9e469
+	/*
d9e469
+	 * FIXME: The conversion from rank to dimm requires to parse the
d9e469
+	 * DMI tables and call failrank2dimm().
d9e469
+	 */
d9e469
+	if (rank0 != -1 && rank1 != -1)
d9e469
+		mce_snprintf(e->mc_location, "ranks=%d and %d",
d9e469
+				     rank0, rank1);
d9e469
+	else if (rank0 != -1)
d9e469
+		mce_snprintf(e->mc_location, "rank=%d", rank0);
d9e469
+}
d9e469
diff --git a/mce-intel.c b/mce-intel.c
d9e469
index b132903..bf68d9b 100644
d9e469
--- a/mce-intel.c
d9e469
+++ b/mce-intel.c
d9e469
@@ -404,6 +404,9 @@ int parse_intel_event(struct ras_events *ras, struct mce_event *e)
d9e469
 	case CPU_BROADWELL_DE:
d9e469
 		broadwell_de_decode_model(ras, e);
d9e469
 		break;
d9e469
+	case CPU_BROADWELL_EPEX:
d9e469
+		broadwell_epex_decode_model(ras, e);
d9e469
+		break;
d9e469
 	default:
d9e469
 		break;
d9e469
 	}
d9e469
diff --git a/ras-mce-handler.c b/ras-mce-handler.c
d9e469
index b58d6e0..b875512 100644
d9e469
--- a/ras-mce-handler.c
d9e469
+++ b/ras-mce-handler.c
d9e469
@@ -51,6 +51,7 @@ static char *cputype_name[] = {
d9e469
 	[CPU_HASWELL_EPEX] = "Intel Xeon v3 (Haswell) EP/EX",
d9e469
 	[CPU_BROADWELL] = "Broadwell",
d9e469
 	[CPU_BROADWELL_DE] = "Broadwell DE",
d9e469
+	[CPU_BROADWELL_EPEX] = "Broadwell EP/EX",
d9e469
 	[CPU_KNIGHTS_LANDING] = "Knights Landing",
d9e469
 };
d9e469
 
d9e469
@@ -93,7 +94,9 @@ static enum cputype select_intel_cputype(struct ras_events *ras)
d9e469
 			return CPU_HASWELL_EPEX;
d9e469
 		else if (mce->model == 0x56)
d9e469
 			return CPU_BROADWELL_DE;
d9e469
-		else if (mce->model == 0x3d || mce->model == 0x4f)
d9e469
+		else if (mce->model == 0x4f)
d9e469
+			return CPU_BROADWELL_EPEX;
d9e469
+		else if (mce->model == 0x3d)
d9e469
 			return CPU_BROADWELL;
d9e469
 		else if (mce->model == 0x57)
d9e469
 			return CPU_KNIGHTS_LANDING;
d9e469
diff --git a/ras-mce-handler.h b/ras-mce-handler.h
d9e469
index 2648048..c5a3717 100644
d9e469
--- a/ras-mce-handler.h
d9e469
+++ b/ras-mce-handler.h
d9e469
@@ -46,6 +46,7 @@ enum cputype {
d9e469
 	CPU_HASWELL_EPEX,
d9e469
 	CPU_BROADWELL,
d9e469
 	CPU_BROADWELL_DE,
d9e469
+	CPU_BROADWELL_EPEX,
d9e469
 	CPU_KNIGHTS_LANDING,
d9e469
 };
d9e469
 
d9e469
@@ -123,6 +124,7 @@ void hsw_decode_model(struct ras_events *ras, struct mce_event *e);
d9e469
 void knl_decode_model(struct ras_events *ras, struct mce_event *e);
d9e469
 void tulsa_decode_model(struct mce_event *e);
d9e469
 void broadwell_de_decode_model(struct ras_events *ras, struct mce_event *e);
d9e469
+void broadwell_epex_decode_model(struct ras_events *ras, struct mce_event *e);
d9e469
 
d9e469
 /* Software defined banks */
d9e469
 #define MCE_EXTENDED_BANK	128
d9e469
-- 
d9e469
1.8.3.1
d9e469