-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yaml --- r: 148919 b: refs/heads/master c: 817f32d h: refs/heads/master i: 148917: cfa07dd 148915: 2872559 148911: 07c14ea v: v3
- Loading branch information
Andi Kleen
authored and
H. Peter Anvin
committed
Jun 3, 2009
1 parent
bab84c6
commit 2b034af
Showing
4 changed files
with
73 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: a0189c70e5f17f4253dd7bc575c97469900e23d6 | ||
refs/heads/master: 817f32d02a52dd7f5941534e0699883691e918df |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include <asm/mce.h> | ||
|
||
enum severity_level { | ||
MCE_NO_SEVERITY, | ||
MCE_SOME_SEVERITY, | ||
MCE_UC_SEVERITY, | ||
MCE_PANIC_SEVERITY, | ||
}; | ||
|
||
int mce_severity(struct mce *a, int tolerant, char **msg); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* MCE grading rules. | ||
* Copyright 2008, 2009 Intel Corporation. | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; version 2 | ||
* of the License. | ||
* | ||
* Author: Andi Kleen | ||
*/ | ||
#include <linux/kernel.h> | ||
#include <asm/mce.h> | ||
|
||
#include "mce-internal.h" | ||
|
||
/* | ||
* Grade an mce by severity. In general the most severe ones are processed | ||
* first. Since there are quite a lot of combinations test the bits in a | ||
* table-driven way. The rules are simply processed in order, first | ||
* match wins. | ||
*/ | ||
|
||
static struct severity { | ||
u64 mask; | ||
u64 result; | ||
unsigned char sev; | ||
unsigned char mcgmask; | ||
unsigned char mcgres; | ||
char *msg; | ||
} severities[] = { | ||
#define SEV(s) .sev = MCE_ ## s ## _SEVERITY | ||
#define BITCLR(x, s, m, r...) { .mask = x, .result = 0, SEV(s), .msg = m, ## r } | ||
#define BITSET(x, s, m, r...) { .mask = x, .result = x, SEV(s), .msg = m, ## r } | ||
#define MCGMASK(x, res, s, m, r...) \ | ||
{ .mcgmask = x, .mcgres = res, SEV(s), .msg = m, ## r } | ||
BITCLR(MCI_STATUS_VAL, NO, "Invalid"), | ||
BITCLR(MCI_STATUS_EN, NO, "Not enabled"), | ||
BITSET(MCI_STATUS_PCC, PANIC, "Processor context corrupt"), | ||
MCGMASK(MCG_STATUS_RIPV, 0, PANIC, "No restart IP"), | ||
BITSET(MCI_STATUS_UC|MCI_STATUS_OVER, PANIC, "Overflowed uncorrected"), | ||
BITSET(MCI_STATUS_UC, UC, "Uncorrected"), | ||
BITSET(0, SOME, "No match") /* always matches. keep at end */ | ||
}; | ||
|
||
int mce_severity(struct mce *a, int tolerant, char **msg) | ||
{ | ||
struct severity *s; | ||
for (s = severities;; s++) { | ||
if ((a->status & s->mask) != s->result) | ||
continue; | ||
if ((a->mcgstatus & s->mcgmask) != s->mcgres) | ||
continue; | ||
if (s->sev > MCE_NO_SEVERITY && (a->status & MCI_STATUS_UC) && | ||
tolerant < 1) | ||
return MCE_PANIC_SEVERITY; | ||
if (msg) | ||
*msg = s->msg; | ||
return s->sev; | ||
} | ||
} |