Patchwork [v2,1/2] x86/mce/AMD: Define function to get SMCA bank type

login
register
mail settings
Submitter Yazen Ghannam
Date Dec. 7, 2017, 8:39 p.m.
Message ID <20171207203955.118171-1-Yazen.Ghannam@amd.com>
Download mbox | patch
Permalink /patch/10100975/
State New
Headers show

Comments

Yazen Ghannam - Dec. 7, 2017, 8:39 p.m.
From: Yazen Ghannam <yazen.ghannam@amd.com>

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 then we will need to convert its address from a normalized address
to a system physical address before handling the error.

Define a static function to return a bank's SMCA type.

Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
---
Link:
https://lkml.kernel.org/r/20171201155034.39206-1-Yazen.Ghannam@amd.com

v1->v2:
* Make function static to mcheck/mce_amd.c.

 arch/x86/kernel/cpu/mcheck/mce_amd.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Patch

diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index a38ab1fa53a2..219d5115f4d4 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -110,6 +110,16 @@  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 bank = smca_banks[m->bank];
+
+	if (!bank.hwid)
+		return N_SMCA_BANK_TYPES;
+
+	return bank.hwid->bank_type;
+}
+
 static struct smca_hwid smca_hwid_mcatypes[] = {
 	/* { bank_type, hwid_mcatype, xec_bitmap } */