|
|
d9e469 |
From 2d656c4ec9d5f68ac39b2a8461b0cd4f77dd7c21 Mon Sep 17 00:00:00 2001
|
|
|
d9e469 |
From: Marcin Koss <marcin.koss@intel.com>
|
|
|
d9e469 |
Date: Thu, 3 Dec 2015 15:19:47 +0100
|
|
|
d9e469 |
Subject: [PATCH 3/5] rasdaemon: Add support for Knights Landing processor
|
|
|
d9e469 |
|
|
|
d9e469 |
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
|
|
|
d9e469 |
---
|
|
|
d9e469 |
Makefile.am | 3 +-
|
|
|
d9e469 |
mce-intel-knl.c | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
d9e469 |
mce-intel.c | 5 +++
|
|
|
d9e469 |
ras-mce-handler.c | 1 +
|
|
|
d9e469 |
ras-mce-handler.h | 1 +
|
|
|
d9e469 |
5 files changed, 137 insertions(+), 1 deletion(-)
|
|
|
d9e469 |
create mode 100644 mce-intel-knl.c
|
|
|
d9e469 |
|
|
|
d9e469 |
diff --git a/Makefile.am b/Makefile.am
|
|
|
d9e469 |
index a6bf18f..a1cb02a 100644
|
|
|
d9e469 |
--- a/Makefile.am
|
|
|
d9e469 |
+++ b/Makefile.am
|
|
|
d9e469 |
@@ -28,7 +28,8 @@ if WITH_MCE
|
|
|
d9e469 |
rasdaemon_SOURCES += ras-mce-handler.c mce-intel.c mce-amd-k8.c \
|
|
|
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-sb.c mce-intel-ivb.c mce-intel-haswell.c \
|
|
|
d9e469 |
+ mce-intel-knl.c
|
|
|
d9e469 |
endif
|
|
|
d9e469 |
if WITH_EXTLOG
|
|
|
d9e469 |
rasdaemon_SOURCES += ras-extlog-handler.c
|
|
|
d9e469 |
diff --git a/mce-intel-knl.c b/mce-intel-knl.c
|
|
|
d9e469 |
new file mode 100644
|
|
|
d9e469 |
index 0000000..96b0a59
|
|
|
d9e469 |
--- /dev/null
|
|
|
d9e469 |
+++ b/mce-intel-knl.c
|
|
|
d9e469 |
@@ -0,0 +1,128 @@
|
|
|
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 |
+static struct field memctrl_mc7[] = {
|
|
|
d9e469 |
+ SBITFIELD(16, "CA Parity error"),
|
|
|
d9e469 |
+ SBITFIELD(17, "Internal Parity error except WDB"),
|
|
|
d9e469 |
+ SBITFIELD(18, "Internal Parity error from WDB"),
|
|
|
d9e469 |
+ SBITFIELD(19, "Correctable Patrol Scrub"),
|
|
|
d9e469 |
+ SBITFIELD(20, "Uncorrectable Patrol Scrub"),
|
|
|
d9e469 |
+ SBITFIELD(21, "Spare Correctable Error"),
|
|
|
d9e469 |
+ SBITFIELD(22, "Spare UC Error"),
|
|
|
d9e469 |
+ SBITFIELD(23, "CORR Chip fail even MC only, 4 bit burst error EDC only"),
|
|
|
d9e469 |
+ {}
|
|
|
d9e469 |
+};
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+void knl_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 = 0;
|
|
|
d9e469 |
+
|
|
|
d9e469 |
+ switch (e->bank) {
|
|
|
d9e469 |
+ case 5:
|
|
|
d9e469 |
+ switch (EXTRACT(status, 0, 15)) {
|
|
|
d9e469 |
+ case 0x402:
|
|
|
d9e469 |
+ mce_snprintf(e->mcastatus_msg, "PCU Internal Errors");
|
|
|
d9e469 |
+ break;
|
|
|
d9e469 |
+ case 0x403:
|
|
|
d9e469 |
+ mce_snprintf(e->mcastatus_msg, "VCU Internal Errors");
|
|
|
d9e469 |
+ break;
|
|
|
d9e469 |
+ case 0x407:
|
|
|
d9e469 |
+ mce_snprintf(e->mcastatus_msg, "Other UBOX Internal Errors");
|
|
|
d9e469 |
+ break;
|
|
|
d9e469 |
+ }
|
|
|
d9e469 |
+ break;
|
|
|
d9e469 |
+ case 7: case 8: case 9: case 10:
|
|
|
d9e469 |
+ case 11: case 12: case 13: case 14:
|
|
|
d9e469 |
+ case 15: case 16:
|
|
|
d9e469 |
+ if ((EXTRACT(status, 0, 15)) == 0x5) {
|
|
|
d9e469 |
+ mce_snprintf(e->mcastatus_msg, "Internal Parity error");
|
|
|
d9e469 |
+ } else {
|
|
|
d9e469 |
+ chan = (EXTRACT(status, 0, 3)) + 3 * (e->bank == 15);
|
|
|
d9e469 |
+ switch (EXTRACT(status, 4, 7)) {
|
|
|
d9e469 |
+ case 0x0:
|
|
|
d9e469 |
+ mce_snprintf(e->mcastatus_msg, "Undefined request on channel %d", chan);
|
|
|
d9e469 |
+ break;
|
|
|
d9e469 |
+ case 0x1:
|
|
|
d9e469 |
+ mce_snprintf(e->mcastatus_msg, "Read on channel %d", chan);
|
|
|
d9e469 |
+ break;
|
|
|
d9e469 |
+ case 0x2:
|
|
|
d9e469 |
+ mce_snprintf(e->mcastatus_msg, "Write on channel %d", chan);
|
|
|
d9e469 |
+ break;
|
|
|
d9e469 |
+ case 0x3:
|
|
|
d9e469 |
+ mce_snprintf(e->mcastatus_msg, "CA error on channel %d", chan);
|
|
|
d9e469 |
+ break;
|
|
|
d9e469 |
+ case 0x4:
|
|
|
d9e469 |
+ mce_snprintf(e->mcastatus_msg, "Scrub error on channel %d", chan);
|
|
|
d9e469 |
+ break;
|
|
|
d9e469 |
+ }
|
|
|
d9e469 |
+ }
|
|
|
d9e469 |
+ decode_bitfield(e, status, memctrl_mc7);
|
|
|
d9e469 |
+ break;
|
|
|
d9e469 |
+ default:
|
|
|
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 < 7 || 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 |
+ {
|
|
|
d9e469 |
+ mce_snprintf(e->mc_location, "memory_channel=unspecified");
|
|
|
d9e469 |
+ }
|
|
|
d9e469 |
+ else
|
|
|
d9e469 |
+ {
|
|
|
d9e469 |
+ chan = chan + 3 * (e->bank == 15);
|
|
|
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 |
+ * 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 |
diff --git a/mce-intel.c b/mce-intel.c
|
|
|
d9e469 |
index 77b929b..032f4e0 100644
|
|
|
d9e469 |
--- a/mce-intel.c
|
|
|
d9e469 |
+++ b/mce-intel.c
|
|
|
d9e469 |
@@ -397,6 +397,10 @@ int parse_intel_event(struct ras_events *ras, struct mce_event *e)
|
|
|
d9e469 |
break;
|
|
|
d9e469 |
case CPU_HASWELL_EPEX:
|
|
|
d9e469 |
hsw_decode_model(ras, e);
|
|
|
d9e469 |
+ break;
|
|
|
d9e469 |
+ case CPU_KNIGHTS_LANDING:
|
|
|
d9e469 |
+ knl_decode_model(ras, e);
|
|
|
d9e469 |
+ break;
|
|
|
d9e469 |
default:
|
|
|
d9e469 |
break;
|
|
|
d9e469 |
}
|
|
|
d9e469 |
@@ -460,6 +464,7 @@ int set_intel_imc_log(enum cputype cputype, unsigned ncpus)
|
|
|
d9e469 |
case CPU_SANDY_BRIDGE_EP:
|
|
|
d9e469 |
case CPU_IVY_BRIDGE_EPEX:
|
|
|
d9e469 |
case CPU_HASWELL_EPEX:
|
|
|
d9e469 |
+ case CPU_KNIGHTS_LANDING:
|
|
|
d9e469 |
msr = 0x17f; /* MSR_ERROR_CONTROL */
|
|
|
d9e469 |
bit = 0x2; /* MemError Log Enable */
|
|
|
d9e469 |
break;
|
|
|
d9e469 |
diff --git a/ras-mce-handler.c b/ras-mce-handler.c
|
|
|
d9e469 |
index 23f2488..3b0b05b 100644
|
|
|
d9e469 |
--- a/ras-mce-handler.c
|
|
|
d9e469 |
+++ b/ras-mce-handler.c
|
|
|
d9e469 |
@@ -223,6 +223,7 @@ int register_mce_handler(struct ras_events *ras, unsigned ncpus)
|
|
|
d9e469 |
case CPU_SANDY_BRIDGE_EP:
|
|
|
d9e469 |
case CPU_IVY_BRIDGE_EPEX:
|
|
|
d9e469 |
case CPU_HASWELL_EPEX:
|
|
|
d9e469 |
+ case CPU_KNIGHTS_LANDING:
|
|
|
d9e469 |
set_intel_imc_log(mce->cputype, ncpus);
|
|
|
d9e469 |
default:
|
|
|
d9e469 |
break;
|
|
|
d9e469 |
diff --git a/ras-mce-handler.h b/ras-mce-handler.h
|
|
|
d9e469 |
index 13b8f52..5466743 100644
|
|
|
d9e469 |
--- a/ras-mce-handler.h
|
|
|
d9e469 |
+++ b/ras-mce-handler.h
|
|
|
d9e469 |
@@ -119,6 +119,7 @@ void dunnington_decode_model(struct mce_event *e);
|
|
|
d9e469 |
void snb_decode_model(struct ras_events *ras, struct mce_event *e);
|
|
|
d9e469 |
void ivb_decode_model(struct ras_events *ras, struct mce_event *e);
|
|
|
d9e469 |
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 |
|
|
|
d9e469 |
/* Software defined banks */
|
|
|
d9e469 |
--
|
|
|
d9e469 |
1.8.3.1
|
|
|
d9e469 |
|