x86/mce: Define mce_severity function pointer
Rename mce_severity() to mce_severity_intel() and assign the mce_severity function pointer to mce_severity_amd() during init on AMD. This way, we can avoid a test to call mce_severity_amd every time we get into mce_severity(). And it's cleaner to do it this way. Signed-off-by: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com> Suggested-by: Tony Luck <tony.luck@intel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@kernel.org> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Chen Yucong <slaoub@gmail.com> Cc: Andy Lutomirski <luto@amacapital.net> Cc: linux-edac <linux-edac@vger.kernel.org> Link: http://lkml.kernel.org/r/1427125373-2918-3-git-send-email-Aravind.Gopalakrishnan@amd.com Signed-off-by: Borislav Petkov <bp@suse.de>
This commit is contained in:

committed by
Borislav Petkov

parent
bf80bbd7dc
commit
43eaa2a1ad
@@ -190,8 +190,10 @@ static int error_context(struct mce *m)
|
||||
* See AMD Error Scope Hierarchy table in a newer BKDG. For example
|
||||
* 49125_15h_Models_30h-3Fh_BKDG.pdf, section "RAS Features"
|
||||
*/
|
||||
static int mce_severity_amd(struct mce *m, enum context ctx)
|
||||
static int mce_severity_amd(struct mce *m, int tolerant, char **msg, bool is_excp)
|
||||
{
|
||||
enum context ctx = error_context(m);
|
||||
|
||||
/* Processor Context Corrupt, no need to fumble too much, die! */
|
||||
if (m->status & MCI_STATUS_PCC)
|
||||
return MCE_PANIC_SEVERITY;
|
||||
@@ -239,15 +241,12 @@ static int mce_severity_amd(struct mce *m, enum context ctx)
|
||||
return MCE_KEEP_SEVERITY;
|
||||
}
|
||||
|
||||
int mce_severity(struct mce *m, int tolerant, char **msg, bool is_excp)
|
||||
static int mce_severity_intel(struct mce *m, int tolerant, char **msg, bool is_excp)
|
||||
{
|
||||
enum exception excp = (is_excp ? EXCP_CONTEXT : NO_EXCP);
|
||||
enum context ctx = error_context(m);
|
||||
struct severity *s;
|
||||
|
||||
if (m->cpuvendor == X86_VENDOR_AMD)
|
||||
return mce_severity_amd(m, ctx);
|
||||
|
||||
for (s = severities;; s++) {
|
||||
if ((m->status & s->mask) != s->result)
|
||||
continue;
|
||||
@@ -272,6 +271,16 @@ int mce_severity(struct mce *m, int tolerant, char **msg, bool is_excp)
|
||||
}
|
||||
}
|
||||
|
||||
/* Default to mce_severity_intel */
|
||||
int (*mce_severity)(struct mce *m, int tolerant, char **msg, bool is_excp) =
|
||||
mce_severity_intel;
|
||||
|
||||
void __init mcheck_vendor_init_severity(void)
|
||||
{
|
||||
if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD)
|
||||
mce_severity = mce_severity_amd;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
static void *s_start(struct seq_file *f, loff_t *pos)
|
||||
{
|
||||
|
Reference in New Issue
Block a user