Blame SOURCES/0064-add_support_for_skylake.patch

2e11a1
commit f9a5724021d8bc9f38cee3a0a71eb4032da1ec66
2e11a1
Author: Aristeu Rozanski <arozansk@redhat.com>
2e11a1
Date:   Mon Sep 19 15:28:33 2016 -0400
2e11a1
2e11a1
    rasdaemon: add support for Skylake client and server
2e11a1
    
2e11a1
    Base on upstream mcelog commits
2e11a1
    	6c07f906dadfe2c4bb7a21e5fc60dc2f34056bf0
2e11a1
    	e4aca6312aee03066ab45632a7bee23dc892a425
2e11a1
    
2e11a1
    Signed-off-by: Aristeu Rozanski <arozansk@redhat.com>
2e11a1
2e11a1
---
2e11a1
 Makefile.am       |    2 
2e11a1
 mce-intel-skx.c   |  257 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
2e11a1
 mce-intel.c       |    3 
2e11a1
 ras-mce-handler.c |    6 +
2e11a1
 ras-mce-handler.h |    3 
2e11a1
 5 files changed, 270 insertions(+), 1 deletion(-)
2e11a1
2e11a1
--- rasdaemon-0.4.1.orig/Makefile.am	2017-05-30 12:43:11.975591485 -0400
2e11a1
+++ rasdaemon-0.4.1/Makefile.am	2017-05-30 12:43:16.948531592 -0400
2e11a1
@@ -30,7 +30,7 @@ if WITH_MCE
2e11a1
 			mce-intel-dunnington.c mce-intel-tulsa.c \
2e11a1
 			mce-intel-sb.c mce-intel-ivb.c mce-intel-haswell.c \
2e11a1
 			mce-intel-knl.c mce-intel-broadwell-de.c \
2e11a1
-			mce-intel-broadwell-epex.c
2e11a1
+			mce-intel-broadwell-epex.c mce-intel-skx.c
2e11a1
 endif
2e11a1
 if WITH_EXTLOG
2e11a1
    rasdaemon_SOURCES += ras-extlog-handler.c
2e11a1
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
2e11a1
+++ rasdaemon-0.4.1/mce-intel-skx.c	2017-05-30 12:43:16.948531592 -0400
2e11a1
@@ -0,0 +1,257 @@
2e11a1
+/*
2e11a1
+ * The code below came from Tony Luck mcelog code,
2e11a1
+ * released under GNU Public General License, v.2
2e11a1
+ *
2e11a1
+ * This program is free software; you can redistribute it and/or modify
2e11a1
+ * it under the terms of the GNU General Public License as published by
2e11a1
+ * the Free Software Foundation; either version 2 of the License, or
2e11a1
+ * (at your option) any later version.
2e11a1
+ *
2e11a1
+ * This program is distributed in the hope that it will be useful,
2e11a1
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2e11a1
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2e11a1
+ * GNU General Public License for more details.
2e11a1
+ *
2e11a1
+ * You should have received a copy of the GNU General Public License
2e11a1
+ * along with this program; if not, write to the Free Software
2e11a1
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2e11a1
+*/
2e11a1
+
2e11a1
+#include <string.h>
2e11a1
+#include <stdio.h>
2e11a1
+
2e11a1
+#include "ras-mce-handler.h"
2e11a1
+#include "bitfield.h"
2e11a1
+
2e11a1
+
2e11a1
+/* See IA32 SDM Vol3B Table 16-27 */
2e11a1
+
2e11a1
+static char *pcu_1[] = {
2e11a1
+	[0x00] = "No Error",
2e11a1
+	[0x0d] = "MCA_DMI_TRAINING_TIMEOUT",
2e11a1
+	[0x0f] = "MCA_DMI_CPU_RESET_ACK_TIMEOUT",
2e11a1
+	[0x10] = "MCA_MORE_THAN_ONE_LT_AGENT",
2e11a1
+	[0x1e] = "MCA_BIOS_RST_CPL_INVALID_SEQ",
2e11a1
+	[0x1f] = "MCA_BIOS_INVALID_PKG_STATE_CONFIG",
2e11a1
+	[0x25] = "MCA_MESSAGE_CHANNEL_TIMEOUT",
2e11a1
+	[0x27] = "MCA_MSGCH_PMREQ_CMP_TIMEOUT",
2e11a1
+	[0x30] = "MCA_PKGC_DIRECT_WAKE_RING_TIMEOUT",
2e11a1
+	[0x31] = "MCA_PKGC_INVALID_RSP_PCH",
2e11a1
+	[0x33] = "MCA_PKGC_WATCHDOG_HANG_CBZ_DOWN",
2e11a1
+	[0x34] = "MCA_PKGC_WATCHDOG_HANG_CBZ_UP",
2e11a1
+	[0x38] = "MCA_PKGC_WATCHDOG_HANG_C3_UP_SF",
2e11a1
+	[0x40] = "MCA_SVID_VCCIN_VR_ICC_MAX_FAILURE",
2e11a1
+	[0x41] = "MCA_SVID_COMMAND_TIMEOUT",
2e11a1
+	[0x42] = "MCA_SVID_VCCIN_VR_VOUT_FAILURE",
2e11a1
+	[0x43] = "MCA_SVID_CPU_VR_CAPABILITY_ERROR",
2e11a1
+	[0x44] = "MCA_SVID_CRITICAL_VR_FAILED",
2e11a1
+	[0x45] = "MCA_SVID_SA_ITD_ERROR",
2e11a1
+	[0x46] = "MCA_SVID_READ_REG_FAILED",
2e11a1
+	[0x47] = "MCA_SVID_WRITE_REG_FAILED",
2e11a1
+	[0x48] = "MCA_SVID_PKGC_INIT_FAILED",
2e11a1
+	[0x49] = "MCA_SVID_PKGC_CONFIG_FAILED",
2e11a1
+	[0x4a] = "MCA_SVID_PKGC_REQUEST_FAILED",
2e11a1
+	[0x4b] = "MCA_SVID_IMON_REQUEST_FAILED",
2e11a1
+	[0x4c] = "MCA_SVID_ALERT_REQUEST_FAILED",
2e11a1
+	[0x4d] = "MCA_SVID_MCP_VR_ABSENT_OR_RAMP_ERROR",
2e11a1
+	[0x4e] = "MCA_SVID_UNEXPECTED_MCP_VR_DETECTED",
2e11a1
+	[0x51] = "MCA_FIVR_CATAS_OVERVOL_FAULT",
2e11a1
+	[0x52] = "MCA_FIVR_CATAS_OVERCUR_FAULT",
2e11a1
+	[0x58] = "MCA_WATCHDOG_TIMEOUT_PKGC_SLAVE",
2e11a1
+	[0x59] = "MCA_WATCHDOG_TIMEOUT_PKGC_MASTER",
2e11a1
+	[0x5a] = "MCA_WATCHDOG_TIMEOUT_PKGS_MASTER",
2e11a1
+	[0x61] = "MCA_PKGS_CPD_UNCPD_TIMEOUT",
2e11a1
+	[0x63] = "MCA_PKGS_INVALID_REQ_PCH",
2e11a1
+	[0x64] = "MCA_PKGS_INVALID_REQ_INTERNAL",
2e11a1
+	[0x65] = "MCA_PKGS_INVALID_RSP_INTERNAL",
2e11a1
+	[0x6b] = "MCA_PKGS_SMBUS_VPP_PAUSE_TIMEOUT",
2e11a1
+	[0x81] = "MCA_RECOVERABLE_DIE_THERMAL_TOO_HOT",
2e11a1
+};
2e11a1
+
2e11a1
+static struct field pcu_mc4[] = {
2e11a1
+	FIELD(24, pcu_1),
2e11a1
+	{}
2e11a1
+};
2e11a1
+
2e11a1
+/* See IA32 SDM Vol3B Table 16-28 */
2e11a1
+
2e11a1
+static char *qpi[] = {
2e11a1
+	[0x00] = "UC Phy Initialization Failure",
2e11a1
+	[0x01] = "UC Phy detected drift buffer alarm",
2e11a1
+	[0x02] = "UC Phy detected latency buffer rollover",
2e11a1
+	[0x10] = "UC LL Rx detected CRC error: unsuccessful LLR: entered abort state",
2e11a1
+	[0x11] = "UC LL Rx unsupported or undefined packet",
2e11a1
+	[0x12] = "UC LL or Phy control error",
2e11a1
+	[0x13] = "UC LL Rx parameter exchange exception",
2e11a1
+	[0x1F] = "UC LL detected control error from the link-mesh interface",
2e11a1
+	[0x20] = "COR Phy initialization abort",
2e11a1
+	[0x21] = "COR Phy reset",
2e11a1
+	[0x22] = "COR Phy lane failure, recovery in x8 width",
2e11a1
+	[0x23] = "COR Phy L0c error corrected without Phy reset",
2e11a1
+	[0x24] = "COR Phy L0c error triggering Phy Reset",
2e11a1
+	[0x25] = "COR Phy L0p exit error corrected with Phy reset",
2e11a1
+	[0x30] = "COR LL Rx detected CRC error - successful LLR without Phy Reinit",
2e11a1
+	[0x31] = "COR LL Rx detected CRC error - successful LLR with Phy Reinit",
2e11a1
+};
2e11a1
+
2e11a1
+static struct field qpi_mc[] = {
2e11a1
+	FIELD(16, qpi),
2e11a1
+	{}
2e11a1
+};
2e11a1
+
2e11a1
+/* These apply to MSCOD 0x12 "UC LL or Phy control error" */
2e11a1
+static struct field qpi_0x12[] = {
2e11a1
+	SBITFIELD(22, "Phy Control Error"),
2e11a1
+	SBITFIELD(23, "Unexpected Retry.Ack flit"),
2e11a1
+	SBITFIELD(24, "Unexpected Retry.Req flit"),
2e11a1
+	SBITFIELD(25, "RF parity error"),
2e11a1
+	SBITFIELD(26, "Routeback Table error"),
2e11a1
+	SBITFIELD(27, "unexpected Tx Protocol flit (EOP, Header or Data)"),
2e11a1
+	SBITFIELD(28, "Rx Header-or-Credit BGF credit overflow/underflow"),
2e11a1
+	SBITFIELD(29, "Link Layer Reset still in progress when Phy enters L0"),
2e11a1
+	SBITFIELD(30, "Link Layer reset initiated while protocol traffic not idle"),
2e11a1
+	SBITFIELD(31, "Link Layer Tx Parity Error"),
2e11a1
+	{}
2e11a1
+};
2e11a1
+
2e11a1
+/* See IA32 SDM Vol3B Table 16-29 */
2e11a1
+
2e11a1
+static struct field mc_bits[] = {
2e11a1
+	SBITFIELD(16, "Address parity error"),
2e11a1
+	SBITFIELD(17, "HA write data parity error"),
2e11a1
+	SBITFIELD(18, "HA write byte enable parity error"),
2e11a1
+	SBITFIELD(19, "Corrected patrol scrub error"),
2e11a1
+	SBITFIELD(20, "Uncorrected patrol scrub error"),
2e11a1
+	SBITFIELD(21, "Corrected spare error"),
2e11a1
+	SBITFIELD(22, "Uncorrected spare error"),
2e11a1
+	SBITFIELD(23, "Any HA read error"),
2e11a1
+	SBITFIELD(24, "WDB read parity error"),
2e11a1
+	SBITFIELD(25, "DDR4 command address parity error"),
2e11a1
+	SBITFIELD(26, "Uncorrected address parity error"),
2e11a1
+	{}
2e11a1
+};
2e11a1
+
2e11a1
+static char *mc_0x8xx[] = {
2e11a1
+	[0x0] = "Unrecognized request type",
2e11a1
+	[0x1] = "Read response to an invalid scoreboard entry",
2e11a1
+	[0x2] = "Unexpected read response",
2e11a1
+	[0x3] = "DDR4 completion to an invalid scoreboard entry",
2e11a1
+	[0x4] = "Completion to an invalid scoreboard entry",
2e11a1
+	[0x5] = "Completion FIFO overflow",
2e11a1
+	[0x6] = "Correctable parity error",
2e11a1
+	[0x7] = "Uncorrectable error",
2e11a1
+	[0x8] = "Interrupt received while outstanding interrupt was not ACKed",
2e11a1
+	[0x9] = "ERID FIFO overflow",
2e11a1
+	[0xa] = "Error on Write credits",
2e11a1
+	[0xb] = "Error on Read credits",
2e11a1
+	[0xc] = "Scheduler error",
2e11a1
+	[0xd] = "Error event",
2e11a1
+};
2e11a1
+
2e11a1
+static struct field memctrl_mc13[] = {
2e11a1
+	FIELD(16, mc_0x8xx),
2e11a1
+	{}
2e11a1
+};
2e11a1
+
2e11a1
+/* See IA32 SDM Vol3B Table 16-30 */
2e11a1
+
2e11a1
+static struct field m2m[] = {
2e11a1
+	SBITFIELD(16, "MscodDataRdErr"),
2e11a1
+	SBITFIELD(17, "Reserved"),
2e11a1
+	SBITFIELD(18, "MscodPtlWrErr"),
2e11a1
+	SBITFIELD(19, "MscodFullWrErr"),
2e11a1
+	SBITFIELD(20, "MscodBgfErr"),
2e11a1
+	SBITFIELD(21, "MscodTimeout"),
2e11a1
+	SBITFIELD(22, "MscodParErr"),
2e11a1
+	SBITFIELD(23, "MscodBucket1Err"),
2e11a1
+	{}
2e11a1
+};
2e11a1
+
2e11a1
+void skylake_xeon_decode_model(struct ras_events *ras, struct mce_event *e)
2e11a1
+{
2e11a1
+	uint64_t status = e->status;
2e11a1
+	uint32_t mca = status & 0xffff;
2e11a1
+	unsigned rank0 = -1, rank1 = -1, chan;
2e11a1
+
2e11a1
+	switch (e->bank) {
2e11a1
+	case 4:
2e11a1
+		switch (EXTRACT(status, 0, 15) & ~(1ull << 12)) {
2e11a1
+		case 0x402: case 0x403:
2e11a1
+			mce_snprintf(e->mcastatus_msg, "Internal errors ");
2e11a1
+			break;
2e11a1
+		case 0x406:
2e11a1
+			mce_snprintf(e->mcastatus_msg, "Intel TXT errors ");
2e11a1
+			break;
2e11a1
+		case 0x407:
2e11a1
+			mce_snprintf(e->mcastatus_msg, "Other UBOX Internal errors ");
2e11a1
+			break;
2e11a1
+		}
2e11a1
+		if (EXTRACT(status, 16, 19))
2e11a1
+			mce_snprintf(e->mcastatus_msg, "PCU internal error ");
2e11a1
+		decode_bitfield(e, status, pcu_mc4);
2e11a1
+		break;
2e11a1
+	case 5:
2e11a1
+	case 12:
2e11a1
+	case 19:
2e11a1
+		mce_snprintf(e->mcastatus_msg, "QPI: ");
2e11a1
+		decode_bitfield(e, status, qpi_mc);
2e11a1
+		if ((EXTRACT(status, 16, 21) == 0x12))
2e11a1
+			decode_bitfield(e, status, qpi_0x12);
2e11a1
+		break;
2e11a1
+	case 7:
2e11a1
+	case 8:
2e11a1
+		mce_snprintf(e->mcastatus_msg, "M2M: ");
2e11a1
+		decode_bitfield(e, status, m2m);
2e11a1
+		break;
2e11a1
+	case 13:
2e11a1
+	case 14:
2e11a1
+	case 15:
2e11a1
+	case 16:
2e11a1
+		mce_snprintf(e->mcastatus_msg, "MemCtrl: ");
2e11a1
+		if (EXTRACT(status, 27, 27))
2e11a1
+			decode_bitfield(e, status, memctrl_mc13);
2e11a1
+		else
2e11a1
+			decode_bitfield(e, status, mc_bits);
2e11a1
+		break;
2e11a1
+	}
2e11a1
+
2e11a1
+	/*
2e11a1
+	 * Memory error specific code. Returns if the error is not a MC one
2e11a1
+	 */
2e11a1
+
2e11a1
+	/* Check if the error is at the memory controller */
2e11a1
+	if ((mca >> 7) != 1)
2e11a1
+		return;
2e11a1
+
2e11a1
+	/* Ignore unless this is an corrected extended error from an iMC bank */
2e11a1
+	if (e->bank < 9 || e->bank > 16 || (status & MCI_STATUS_UC) ||
2e11a1
+		!test_prefix(7, status & 0xefff))
2e11a1
+		return;
2e11a1
+
2e11a1
+	/*
2e11a1
+	 * Parse the reported channel and ranks
2e11a1
+	 */
2e11a1
+
2e11a1
+	chan = EXTRACT(status, 0, 3);
2e11a1
+	if (chan == 0xf)
2e11a1
+		return;
2e11a1
+
2e11a1
+	mce_snprintf(e->mc_location, "memory_channel=%d", chan);
2e11a1
+
2e11a1
+	if (EXTRACT(e->misc, 62, 62)) {
2e11a1
+		rank0 = EXTRACT(e->misc, 46, 50);
2e11a1
+		if (EXTRACT(e->misc, 63, 63))
2e11a1
+			rank1 = EXTRACT(e->misc, 51, 55);
2e11a1
+	}
2e11a1
+
2e11a1
+	/*
2e11a1
+	 * FIXME: The conversion from rank to dimm requires to parse the
2e11a1
+	 * DMI tables and call failrank2dimm().
2e11a1
+	 */
2e11a1
+	if (rank0 != -1 && rank1 != -1)
2e11a1
+		mce_snprintf(e->mc_location, "ranks=%d and %d",
2e11a1
+				     rank0, rank1);
2e11a1
+	else if (rank0 != -1)
2e11a1
+		mce_snprintf(e->mc_location, "rank=%d", rank0);
2e11a1
+}
2e11a1
+
2e11a1
--- rasdaemon-0.4.1.orig/mce-intel.c	2017-05-30 12:43:11.975591485 -0400
2e11a1
+++ rasdaemon-0.4.1/mce-intel.c	2017-05-30 12:43:16.948531592 -0400
2e11a1
@@ -408,6 +408,9 @@ if (test_prefix(11, (e->status & 0xffffL
2e11a1
 	case CPU_BROADWELL_EPEX:
2e11a1
 		broadwell_epex_decode_model(ras, e);
2e11a1
 		break;
2e11a1
+	case CPU_SKYLAKE_XEON:
2e11a1
+		skylake_xeon_decode_model(ras, e);
2e11a1
+		break;
2e11a1
 	default:
2e11a1
 		break;
2e11a1
 	}
2e11a1
--- rasdaemon-0.4.1.orig/ras-mce-handler.c	2017-05-30 12:43:16.948531592 -0400
2e11a1
+++ rasdaemon-0.4.1/ras-mce-handler.c	2017-05-30 12:44:00.295009527 -0400
2e11a1
@@ -54,6 +54,8 @@ [CPU_XEON75XX] = "Intel Xeon 7500 series
2e11a1
 	[CPU_BROADWELL_EPEX] = "Broadwell EP/EX",
2e11a1
 	[CPU_KNIGHTS_LANDING] = "Knights Landing",
2e11a1
 	[CPU_KNIGHTS_MILL] = "Knights Mill",
2e11a1
+	[CPU_SKYLAKE] = "Skylake",
2e11a1
+	[CPU_SKYLAKE_XEON] = "Skylake Xeon",
2e11a1
 };
2e11a1
 
2e11a1
 static enum cputype select_intel_cputype(struct ras_events *ras)
2e11a1
@@ -103,6 +105,10 @@ else if (mce->model == 0x57)
2e11a1
 			return CPU_KNIGHTS_LANDING;
2e11a1
 		else if (mce->model == 0x85)
2e11a1
 			return CPU_KNIGHTS_MILL;
2e11a1
+		else if (mce->model == 0x4e || mce->model == 0x5e)
2e11a1
+			return CPU_SKYLAKE;
2e11a1
+		else if (mce->model == 0x55)
2e11a1
+			return CPU_SKYLAKE_XEON;
2e11a1
 
2e11a1
 		if (mce->model > 0x1a) {
2e11a1
 			log(ALL, LOG_INFO,
2e11a1
--- rasdaemon-0.4.1.orig/ras-mce-handler.h	2017-05-30 12:43:11.976591473 -0400
2e11a1
+++ rasdaemon-0.4.1/ras-mce-handler.h	2017-05-30 12:44:25.745703000 -0400
2e11a1
@@ -49,6 +49,8 @@ enum cputype {
2e11a1
 	CPU_BROADWELL_EPEX,
2e11a1
 	CPU_KNIGHTS_LANDING,
2e11a1
 	CPU_KNIGHTS_MILL,
2e11a1
+	CPU_SKYLAKE,
2e11a1
+	CPU_SKYLAKE_XEON,
2e11a1
 };
2e11a1
 
2e11a1
 struct mce_event {
2e11a1
@@ -126,6 +128,7 @@ void knl_decode_model(struct ras_events
2e11a1
 void tulsa_decode_model(struct mce_event *e);
2e11a1
 void broadwell_de_decode_model(struct ras_events *ras, struct mce_event *e);
2e11a1
 void broadwell_epex_decode_model(struct ras_events *ras, struct mce_event *e);
2e11a1
+void skylake_xeon_decode_model(struct ras_events *ras, struct mce_event *e);
2e11a1
 
2e11a1
 /* Software defined banks */
2e11a1
 #define MCE_EXTENDED_BANK	128