From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933478AbdLRMCM (ORCPT ); Mon, 18 Dec 2017 07:02:12 -0500 Received: from terminus.zytor.com ([65.50.211.136]:50043 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758631AbdLRMCH (ORCPT ); Mon, 18 Dec 2017 07:02:07 -0500 Date: Mon, 18 Dec 2017 04:00:49 -0800 From: tip-bot for Yazen Ghannam Message-ID: Cc: bp@suse.de, tglx@linutronix.de, linux-kernel@vger.kernel.org, yazen.ghannam@amd.com, mingo@kernel.org, hpa@zytor.com Reply-To: linux-kernel@vger.kernel.org, tglx@linutronix.de, yazen.ghannam@amd.com, hpa@zytor.com, mingo@kernel.org, bp@suse.de In-Reply-To: <20171207203955.118171-1-Yazen.Ghannam@amd.com> References: <20171207203955.118171-1-Yazen.Ghannam@amd.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:ras/core] x86/MCE/AMD: Define a function to get SMCA bank type Git-Commit-ID: 11cf887728a3d1de77cc12ce247b64ef32608891 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 11cf887728a3d1de77cc12ce247b64ef32608891 Gitweb: https://git.kernel.org/tip/11cf887728a3d1de77cc12ce247b64ef32608891 Author: Yazen Ghannam AuthorDate: Mon, 18 Dec 2017 12:37:12 +0100 Committer: Thomas Gleixner CommitDate: Mon, 18 Dec 2017 12:58:28 +0100 x86/MCE/AMD: Define a function to get SMCA bank type Scalable MCA systems have various types of banks. The bank's type can determine how we handle errors from it. For example, if a bank represents a UMC (Unified Memory Controller) then we will need to convert its address from a normalized address to a system physical address before handling the error. [ bp: Verify m->bank is within range and use bank pointer. ] Signed-off-by: Yazen Ghannam Signed-off-by: Borislav Petkov Signed-off-by: Thomas Gleixner Link: http://lkml.kernel.org/r/20171207203955.118171-1-Yazen.Ghannam@amd.com --- arch/x86/kernel/cpu/mcheck/mce_amd.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c index a38ab1f..661c473 100644 --- a/arch/x86/kernel/cpu/mcheck/mce_amd.c +++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c @@ -110,6 +110,20 @@ const char *smca_get_long_name(enum smca_bank_types t) } EXPORT_SYMBOL_GPL(smca_get_long_name); +static enum smca_bank_types smca_get_bank_type(struct mce *m) +{ + struct smca_bank *b; + + if (m->bank >= N_SMCA_BANK_TYPES) + return N_SMCA_BANK_TYPES; + + b = &smca_banks[m->bank]; + if (!b->hwid) + return N_SMCA_BANK_TYPES; + + return b->hwid->bank_type; +} + static struct smca_hwid smca_hwid_mcatypes[] = { /* { bank_type, hwid_mcatype, xec_bitmap } */