Blame SOURCES/0064-add_support_for_skylake.patch

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