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

From: Yazen Ghannam
Date: Thu Dec 07 2017 - 15:40:18 EST


From: Yazen Ghannam <yazen.ghannam@xxxxxxx>

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@xxxxxxx>
---
Link:
https://lkml.kernel.org/r/20171201155034.39206-1-Yazen.Ghannam@xxxxxxx

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

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

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 } */

--
2.14.1