Blame SOURCES/0064-add_support_for_skylake.patch

ac32bf
commit f9a5724021d8bc9f38cee3a0a71eb4032da1ec66
ac32bf
Author: Aristeu Rozanski <arozansk@redhat.com>
ac32bf
Date:   Mon Sep 19 15:28:33 2016 -0400
ac32bf
ac32bf
    rasdaemon: add support for Skylake client and server
ac32bf
    
ac32bf
    Base on upstream mcelog commits
ac32bf
    	6c07f906dadfe2c4bb7a21e5fc60dc2f34056bf0
ac32bf
    	e4aca6312aee03066ab45632a7bee23dc892a425
ac32bf
    
ac32bf
    Signed-off-by: Aristeu Rozanski <arozansk@redhat.com>
ac32bf
ac32bf
---
ac32bf
 Makefile.am       |    2 
ac32bf
 mce-intel-skx.c   |  257 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
ac32bf
 mce-intel.c       |    3 
ac32bf
 ras-mce-handler.c |    6 +
ac32bf
 ras-mce-handler.h |    3 
ac32bf
 5 files changed, 270 insertions(+), 1 deletion(-)
ac32bf
ac32bf
--- rasdaemon-0.4.1.orig/Makefile.am	2017-05-30 12:43:11.975591485 -0400
ac32bf
+++ rasdaemon-0.4.1/Makefile.am	2017-05-30 12:43:16.948531592 -0400
ac32bf
@@ -30,7 +30,7 @@ if WITH_MCE
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-broadwell-epex.c
ac32bf
+			mce-intel-broadwell-epex.c mce-intel-skx.c
ac32bf
 endif
ac32bf
 if WITH_EXTLOG
ac32bf
    rasdaemon_SOURCES += ras-extlog-handler.c
ac32bf
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
ac32bf
+++ rasdaemon-0.4.1/mce-intel-skx.c	2017-05-30 12:43:16.948531592 -0400
ac32bf
@@ -0,0 +1,257 @@
ac32bf
+/*
ac32bf
+ * The code below came from Tony Luck 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
+
ac32bf
+/* See IA32 SDM Vol3B Table 16-27 */
ac32bf
+
ac32bf
+static char *pcu_1[] = {
ac32bf
+	[0x00] = "No Error",
ac32bf
+	[0x0d] = "MCA_DMI_TRAINING_TIMEOUT",
ac32bf
+	[0x0f] = "MCA_DMI_CPU_RESET_ACK_TIMEOUT",
ac32bf
+	[0x10] = "MCA_MORE_THAN_ONE_LT_AGENT",
ac32bf
+	[0x1e] = "MCA_BIOS_RST_CPL_INVALID_SEQ",
ac32bf
+	[0x1f] = "MCA_BIOS_INVALID_PKG_STATE_CONFIG",
ac32bf
+	[0x25] = "MCA_MESSAGE_CHANNEL_TIMEOUT",
ac32bf
+	[0x27] = "MCA_MSGCH_PMREQ_CMP_TIMEOUT",
ac32bf
+	[0x30] = "MCA_PKGC_DIRECT_WAKE_RING_TIMEOUT",
ac32bf
+	[0x31] = "MCA_PKGC_INVALID_RSP_PCH",
ac32bf
+	[0x33] = "MCA_PKGC_WATCHDOG_HANG_CBZ_DOWN",
ac32bf
+	[0x34] = "MCA_PKGC_WATCHDOG_HANG_CBZ_UP",
ac32bf
+	[0x38] = "MCA_PKGC_WATCHDOG_HANG_C3_UP_SF",
ac32bf
+	[0x40] = "MCA_SVID_VCCIN_VR_ICC_MAX_FAILURE",
ac32bf
+	[0x41] = "MCA_SVID_COMMAND_TIMEOUT",
ac32bf
+	[0x42] = "MCA_SVID_VCCIN_VR_VOUT_FAILURE",
ac32bf
+	[0x43] = "MCA_SVID_CPU_VR_CAPABILITY_ERROR",
ac32bf
+	[0x44] = "MCA_SVID_CRITICAL_VR_FAILED",
ac32bf
+	[0x45] = "MCA_SVID_SA_ITD_ERROR",
ac32bf
+	[0x46] = "MCA_SVID_READ_REG_FAILED",
ac32bf
+	[0x47] = "MCA_SVID_WRITE_REG_FAILED",
ac32bf
+	[0x48] = "MCA_SVID_PKGC_INIT_FAILED",
ac32bf
+	[0x49] = "MCA_SVID_PKGC_CONFIG_FAILED",
ac32bf
+	[0x4a] = "MCA_SVID_PKGC_REQUEST_FAILED",
ac32bf
+	[0x4b] = "MCA_SVID_IMON_REQUEST_FAILED",
ac32bf
+	[0x4c] = "MCA_SVID_ALERT_REQUEST_FAILED",
ac32bf
+	[0x4d] = "MCA_SVID_MCP_VR_ABSENT_OR_RAMP_ERROR",
ac32bf
+	[0x4e] = "MCA_SVID_UNEXPECTED_MCP_VR_DETECTED",
ac32bf
+	[0x51] = "MCA_FIVR_CATAS_OVERVOL_FAULT",
ac32bf
+	[0x52] = "MCA_FIVR_CATAS_OVERCUR_FAULT",
ac32bf
+	[0x58] = "MCA_WATCHDOG_TIMEOUT_PKGC_SLAVE",
ac32bf
+	[0x59] = "MCA_WATCHDOG_TIMEOUT_PKGC_MASTER",
ac32bf
+	[0x5a] = "MCA_WATCHDOG_TIMEOUT_PKGS_MASTER",
ac32bf
+	[0x61] = "MCA_PKGS_CPD_UNCPD_TIMEOUT",
ac32bf
+	[0x63] = "MCA_PKGS_INVALID_REQ_PCH",
ac32bf
+	[0x64] = "MCA_PKGS_INVALID_REQ_INTERNAL",
ac32bf
+	[0x65] = "MCA_PKGS_INVALID_RSP_INTERNAL",
ac32bf
+	[0x6b] = "MCA_PKGS_SMBUS_VPP_PAUSE_TIMEOUT",
ac32bf
+	[0x81] = "MCA_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-28 */
ac32bf
+
ac32bf
+static char *qpi[] = {
ac32bf
+	[0x00] = "UC Phy Initialization Failure",
ac32bf
+	[0x01] = "UC Phy detected drift buffer alarm",
ac32bf
+	[0x02] = "UC Phy detected latency buffer rollover",
ac32bf
+	[0x10] = "UC LL Rx detected CRC error: unsuccessful LLR: entered abort state",
ac32bf
+	[0x11] = "UC LL Rx unsupported or undefined packet",
ac32bf
+	[0x12] = "UC LL or Phy control error",
ac32bf
+	[0x13] = "UC LL Rx parameter exchange exception",
ac32bf
+	[0x1F] = "UC LL detected control error from the link-mesh interface",
ac32bf
+	[0x20] = "COR Phy initialization abort",
ac32bf
+	[0x21] = "COR Phy reset",
ac32bf
+	[0x22] = "COR Phy lane failure, recovery in x8 width",
ac32bf
+	[0x23] = "COR Phy L0c error corrected without Phy reset",
ac32bf
+	[0x24] = "COR Phy L0c error triggering Phy Reset",
ac32bf
+	[0x25] = "COR Phy L0p exit error corrected with Phy reset",
ac32bf
+	[0x30] = "COR LL Rx detected CRC error - successful LLR without Phy Reinit",
ac32bf
+	[0x31] = "COR LL Rx detected CRC error - successful LLR with Phy Reinit",
ac32bf
+};
ac32bf
+
ac32bf
+static struct field qpi_mc[] = {
ac32bf
+	FIELD(16, qpi),
ac32bf
+	{}
ac32bf
+};
ac32bf
+
ac32bf
+/* These apply to MSCOD 0x12 "UC LL or Phy control error" */
ac32bf
+static struct field qpi_0x12[] = {
ac32bf
+	SBITFIELD(22, "Phy Control Error"),
ac32bf
+	SBITFIELD(23, "Unexpected Retry.Ack flit"),
ac32bf
+	SBITFIELD(24, "Unexpected Retry.Req flit"),
ac32bf
+	SBITFIELD(25, "RF parity error"),
ac32bf
+	SBITFIELD(26, "Routeback Table error"),
ac32bf
+	SBITFIELD(27, "unexpected Tx Protocol flit (EOP, Header or Data)"),
ac32bf
+	SBITFIELD(28, "Rx Header-or-Credit BGF credit overflow/underflow"),
ac32bf
+	SBITFIELD(29, "Link Layer Reset still in progress when Phy enters L0"),
ac32bf
+	SBITFIELD(30, "Link Layer reset initiated while protocol traffic not idle"),
ac32bf
+	SBITFIELD(31, "Link Layer Tx Parity Error"),
ac32bf
+	{}
ac32bf
+};
ac32bf
+
ac32bf
+/* See IA32 SDM Vol3B Table 16-29 */
ac32bf
+
ac32bf
+static struct field mc_bits[] = {
ac32bf
+	SBITFIELD(16, "Address parity error"),
ac32bf
+	SBITFIELD(17, "HA write data parity error"),
ac32bf
+	SBITFIELD(18, "HA write byte enable parity 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(23, "Any HA read error"),
ac32bf
+	SBITFIELD(24, "WDB read parity error"),
ac32bf
+	SBITFIELD(25, "DDR4 command address parity error"),
ac32bf
+	SBITFIELD(26, "Uncorrected address parity error"),
ac32bf
+	{}
ac32bf
+};
ac32bf
+
ac32bf
+static char *mc_0x8xx[] = {
ac32bf
+	[0x0] = "Unrecognized request type",
ac32bf
+	[0x1] = "Read response to an invalid scoreboard entry",
ac32bf
+	[0x2] = "Unexpected read response",
ac32bf
+	[0x3] = "DDR4 completion to an invalid scoreboard entry",
ac32bf
+	[0x4] = "Completion to an invalid scoreboard entry",
ac32bf
+	[0x5] = "Completion FIFO overflow",
ac32bf
+	[0x6] = "Correctable parity error",
ac32bf
+	[0x7] = "Uncorrectable error",
ac32bf
+	[0x8] = "Interrupt received while outstanding interrupt was not ACKed",
ac32bf
+	[0x9] = "ERID FIFO overflow",
ac32bf
+	[0xa] = "Error on Write credits",
ac32bf
+	[0xb] = "Error on Read credits",
ac32bf
+	[0xc] = "Scheduler error",
ac32bf
+	[0xd] = "Error event",
ac32bf
+};
ac32bf
+
ac32bf
+static struct field memctrl_mc13[] = {
ac32bf
+	FIELD(16, mc_0x8xx),
ac32bf
+	{}
ac32bf
+};
ac32bf
+
ac32bf
+/* See IA32 SDM Vol3B Table 16-30 */
ac32bf
+
ac32bf
+static struct field m2m[] = {
ac32bf
+	SBITFIELD(16, "MscodDataRdErr"),
ac32bf
+	SBITFIELD(17, "Reserved"),
ac32bf
+	SBITFIELD(18, "MscodPtlWrErr"),
ac32bf
+	SBITFIELD(19, "MscodFullWrErr"),
ac32bf
+	SBITFIELD(20, "MscodBgfErr"),
ac32bf
+	SBITFIELD(21, "MscodTimeout"),
ac32bf
+	SBITFIELD(22, "MscodParErr"),
ac32bf
+	SBITFIELD(23, "MscodBucket1Err"),
ac32bf
+	{}
ac32bf
+};
ac32bf
+
ac32bf
+void skylake_xeon_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 12:
ac32bf
+	case 19:
ac32bf
+		mce_snprintf(e->mcastatus_msg, "QPI: ");
ac32bf
+		decode_bitfield(e, status, qpi_mc);
ac32bf
+		if ((EXTRACT(status, 16, 21) == 0x12))
ac32bf
+			decode_bitfield(e, status, qpi_0x12);
ac32bf
+		break;
ac32bf
+	case 7:
ac32bf
+	case 8:
ac32bf
+		mce_snprintf(e->mcastatus_msg, "M2M: ");
ac32bf
+		decode_bitfield(e, status, m2m);
ac32bf
+		break;
ac32bf
+	case 13:
ac32bf
+	case 14:
ac32bf
+	case 15:
ac32bf
+	case 16:
ac32bf
+		mce_snprintf(e->mcastatus_msg, "MemCtrl: ");
ac32bf
+		if (EXTRACT(status, 27, 27))
ac32bf
+			decode_bitfield(e, status, memctrl_mc13);
ac32bf
+		else
ac32bf
+			decode_bitfield(e, status, mc_bits);
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
+
ac32bf
--- rasdaemon-0.4.1.orig/mce-intel.c	2017-05-30 12:43:11.975591485 -0400
ac32bf
+++ rasdaemon-0.4.1/mce-intel.c	2017-05-30 12:43:16.948531592 -0400
ac32bf
@@ -408,6 +408,9 @@ if (test_prefix(11, (e->status & 0xffffL
ac32bf
 	case CPU_BROADWELL_EPEX:
ac32bf
 		broadwell_epex_decode_model(ras, e);
ac32bf
 		break;
ac32bf
+	case CPU_SKYLAKE_XEON:
ac32bf
+		skylake_xeon_decode_model(ras, e);
ac32bf
+		break;
ac32bf
 	default:
ac32bf
 		break;
ac32bf
 	}
ac32bf
--- rasdaemon-0.4.1.orig/ras-mce-handler.c	2017-05-30 12:43:16.948531592 -0400
ac32bf
+++ rasdaemon-0.4.1/ras-mce-handler.c	2017-05-30 12:44:00.295009527 -0400
ac32bf
@@ -54,6 +54,8 @@ [CPU_XEON75XX] = "Intel Xeon 7500 series
ac32bf
 	[CPU_BROADWELL_EPEX] = "Broadwell EP/EX",
ac32bf
 	[CPU_KNIGHTS_LANDING] = "Knights Landing",
ac32bf
 	[CPU_KNIGHTS_MILL] = "Knights Mill",
ac32bf
+	[CPU_SKYLAKE] = "Skylake",
ac32bf
+	[CPU_SKYLAKE_XEON] = "Skylake Xeon",
ac32bf
 };
ac32bf
 
ac32bf
 static enum cputype select_intel_cputype(struct ras_events *ras)
ac32bf
@@ -103,6 +105,10 @@ else if (mce->model == 0x57)
ac32bf
 			return CPU_KNIGHTS_LANDING;
ac32bf
 		else if (mce->model == 0x85)
ac32bf
 			return CPU_KNIGHTS_MILL;
ac32bf
+		else if (mce->model == 0x4e || mce->model == 0x5e)
ac32bf
+			return CPU_SKYLAKE;
ac32bf
+		else if (mce->model == 0x55)
ac32bf
+			return CPU_SKYLAKE_XEON;
ac32bf
 
ac32bf
 		if (mce->model > 0x1a) {
ac32bf
 			log(ALL, LOG_INFO,
ac32bf
--- rasdaemon-0.4.1.orig/ras-mce-handler.h	2017-05-30 12:43:11.976591473 -0400
ac32bf
+++ rasdaemon-0.4.1/ras-mce-handler.h	2017-05-30 12:44:25.745703000 -0400
ac32bf
@@ -49,6 +49,8 @@ enum cputype {
ac32bf
 	CPU_BROADWELL_EPEX,
ac32bf
 	CPU_KNIGHTS_LANDING,
ac32bf
 	CPU_KNIGHTS_MILL,
ac32bf
+	CPU_SKYLAKE,
ac32bf
+	CPU_SKYLAKE_XEON,
ac32bf
 };
ac32bf
 
ac32bf
 struct mce_event {
ac32bf
@@ -126,6 +128,7 @@ void knl_decode_model(struct ras_events
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
+void skylake_xeon_decode_model(struct ras_events *ras, struct mce_event *e);
ac32bf
 
ac32bf
 /* Software defined banks */
ac32bf
 #define MCE_EXTENDED_BANK	128