Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp465363pxx; Wed, 28 Oct 2020 08:58:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYJhbsxoELBrPdcdYNyZJISHT+mGUzGMcEDebnnzi9IWJCnw2gJJNfh0Nyn3HG6d42EJ22 X-Received: by 2002:a50:f0c5:: with SMTP id a5mr8347399edm.91.1603900718913; Wed, 28 Oct 2020 08:58:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603900718; cv=none; d=google.com; s=arc-20160816; b=bPS1qtPohFb/X1FSOViepAWyiIaDblXbTEbLC6z3U8Fx8JniN76tOa1G93VwWdJyFF 3QRiEAxAtkZw66F19IXdGpOFfR+72srJH7gqLzcAzEdWuqKXZ7OcxlrZy3Gxg5xDb9D+ yLy2AwlL+9v6N2p0Nhp1AvATe66QE2wTOn7iMN4yXleBzM2ReThS4o2I4qRUuL/1k/GK yv5ijnPkl6RG7g8Z4Y+CMLJkiajPNz4YrA+wSNxj6xiV3Kq5fUW/EpXAw9htT+5E/OA/ GwWS7BxSJ2M3pVhudS6Jv+B2pQ2lXbQglc1gmOx8Hbd1JT3revTKZH7Vv7dXyvT6iryU NjsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ery7m4SFED2500N8N82EU/sZ+cpPntylEG4lm1d1a0o=; b=hp5CAmYp8k0aeQfxOZddoOAT7iz3ESaqDzZh5yvGG6Gqp+AyEyQHqNqiL+wyA6+tLl K4Lg1hW3kLkDsllTy/vS/sUAD+gGYgt9u7TTsdbMXJlt2VhaEBQ20g/gG9OVbT+yyJrA oyhmzDFaHt0rzifha+Q2Pv9hPzJOgF9zDgFTo+HEKAjnt/Lbzrx9CbUnTPDqUH499DB2 NG3rMLjMudnxBuoRS+Z2P7xzUqA2t32e4MgltUQXz7o040OnYNS6NdAA+WSiVUzkYcMq tQSNlmkyJ44r8QDrMZmqwwfxqEdkYVEIYegCDzBgcAIcIMd7wJsbz643JcpO+wAJ6C9C IjyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xkEbwZj0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b29si2827715edn.354.2020.10.28.08.58.16; Wed, 28 Oct 2020 08:58:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xkEbwZj0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1813694AbgJ0Qxi (ORCPT + 99 others); Tue, 27 Oct 2020 12:53:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:48878 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1794568AbgJ0PM3 (ORCPT ); Tue, 27 Oct 2020 11:12:29 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A92CC2225E; Tue, 27 Oct 2020 15:12:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603811549; bh=Q9CHD5Ou3bkw3/j9FIqWOLtSLv6yrwBRIhK/v9KYZrQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xkEbwZj0gPs5gkEOQreGOkJP4EE6t8OKB+pYm0TgEWNHyfiwha+1RYelQAl2THU75 cr/9wHBGe3l1nenlpm4GZH1OC08r/z/axMZdFqXfGDDajz8SIx2En7rxIJk4WrRal+ v8R8ffe1jwJdQbhwsa6UZ4Q1scTSqn76p8Tfpyg8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Youquan Song , Borislav Petkov , Tony Luck , Sasha Levin Subject: [PATCH 5.8 532/633] x86/mce: Add Skylake quirk for patrol scrub reported errors Date: Tue, 27 Oct 2020 14:54:35 +0100 Message-Id: <20201027135547.732024977@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Borislav Petkov [ Upstream commit fd258dc4442c5c1c069c6b5b42bfe7d10cddda95 ] The patrol scrubber in Skylake and Cascade Lake systems can be configured to report uncorrected errors using a special signature in the machine check bank and to signal using CMCI instead of machine check. Update the severity calculation mechanism to allow specifying the model, minimum stepping and range of machine check bank numbers. Add a new rule to detect the special signature (on model 0x55, stepping >=4 in any of the memory controller banks). [ bp: Rewrite it. aegl: Productize it. ] Suggested-by: Youquan Song Signed-off-by: Borislav Petkov Co-developed-by: Tony Luck Signed-off-by: Tony Luck Signed-off-by: Borislav Petkov Link: https://lkml.kernel.org/r/20200930021313.31810-2-tony.luck@intel.com Signed-off-by: Sasha Levin --- arch/x86/kernel/cpu/mce/severity.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/mce/severity.c b/arch/x86/kernel/cpu/mce/severity.c index e1da619add192..567ce09a02868 100644 --- a/arch/x86/kernel/cpu/mce/severity.c +++ b/arch/x86/kernel/cpu/mce/severity.c @@ -9,9 +9,11 @@ #include #include #include -#include #include +#include +#include + #include "internal.h" /* @@ -40,9 +42,14 @@ static struct severity { unsigned char context; unsigned char excp; unsigned char covered; + unsigned char cpu_model; + unsigned char cpu_minstepping; + unsigned char bank_lo, bank_hi; char *msg; } severities[] = { #define MCESEV(s, m, c...) { .sev = MCE_ ## s ## _SEVERITY, .msg = m, ## c } +#define BANK_RANGE(l, h) .bank_lo = l, .bank_hi = h +#define MODEL_STEPPING(m, s) .cpu_model = m, .cpu_minstepping = s #define KERNEL .context = IN_KERNEL #define USER .context = IN_USER #define KERNEL_RECOV .context = IN_KERNEL_RECOV @@ -97,7 +104,6 @@ static struct severity { KEEP, "Corrected error", NOSER, BITCLR(MCI_STATUS_UC) ), - /* * known AO MCACODs reported via MCE or CMC: * @@ -113,6 +119,18 @@ static struct severity { AO, "Action optional: last level cache writeback error", SER, MASK(MCI_UC_AR|MCACOD, MCI_STATUS_UC|MCACOD_L3WB) ), + /* + * Quirk for Skylake/Cascade Lake. Patrol scrubber may be configured + * to report uncorrected errors using CMCI with a special signature. + * UC=0, MSCOD=0x0010, MCACOD=binary(000X 0000 1100 XXXX) reported + * in one of the memory controller banks. + * Set severity to "AO" for same action as normal patrol scrub error. + */ + MCESEV( + AO, "Uncorrected Patrol Scrub Error", + SER, MASK(MCI_STATUS_UC|MCI_ADDR|0xffffeff0, MCI_ADDR|0x001000c0), + MODEL_STEPPING(INTEL_FAM6_SKYLAKE_X, 4), BANK_RANGE(13, 18) + ), /* ignore OVER for UCNA */ MCESEV( @@ -324,6 +342,12 @@ static int mce_severity_intel(struct mce *m, int tolerant, char **msg, bool is_e continue; if (s->excp && excp != s->excp) continue; + if (s->cpu_model && boot_cpu_data.x86_model != s->cpu_model) + continue; + if (s->cpu_minstepping && boot_cpu_data.x86_stepping < s->cpu_minstepping) + continue; + if (s->bank_lo && (m->bank < s->bank_lo || m->bank > s->bank_hi)) + continue; if (msg) *msg = s->msg; s->covered = 1; -- 2.25.1