krishnanadh / rpms / rasdaemon

Forked from rpms/rasdaemon a year ago
Clone

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

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