diff options
Diffstat (limited to 'arch/x86/kernel/cpu/mcheck/mce.c')
| -rw-r--r-- | arch/x86/kernel/cpu/mcheck/mce.c | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c index 5e095f873e3e..292d0258311c 100644 --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c | |||
| @@ -103,6 +103,8 @@ DEFINE_PER_CPU(mce_banks_t, mce_poll_banks) = { | |||
| 103 | 103 | ||
| 104 | static DEFINE_PER_CPU(struct work_struct, mce_work); | 104 | static DEFINE_PER_CPU(struct work_struct, mce_work); |
| 105 | 105 | ||
| 106 | static void (*quirk_no_way_out)(int bank, struct mce *m, struct pt_regs *regs); | ||
| 107 | |||
| 106 | /* | 108 | /* |
| 107 | * CPU/chipset specific EDAC code can register a notifier call here to print | 109 | * CPU/chipset specific EDAC code can register a notifier call here to print |
| 108 | * MCE errors in a human-readable form. | 110 | * MCE errors in a human-readable form. |
| @@ -650,14 +652,18 @@ EXPORT_SYMBOL_GPL(machine_check_poll); | |||
| 650 | * Do a quick check if any of the events requires a panic. | 652 | * Do a quick check if any of the events requires a panic. |
| 651 | * This decides if we keep the events around or clear them. | 653 | * This decides if we keep the events around or clear them. |
| 652 | */ | 654 | */ |
| 653 | static int mce_no_way_out(struct mce *m, char **msg, unsigned long *validp) | 655 | static int mce_no_way_out(struct mce *m, char **msg, unsigned long *validp, |
| 656 | struct pt_regs *regs) | ||
| 654 | { | 657 | { |
| 655 | int i, ret = 0; | 658 | int i, ret = 0; |
| 656 | 659 | ||
| 657 | for (i = 0; i < banks; i++) { | 660 | for (i = 0; i < banks; i++) { |
| 658 | m->status = mce_rdmsrl(MSR_IA32_MCx_STATUS(i)); | 661 | m->status = mce_rdmsrl(MSR_IA32_MCx_STATUS(i)); |
| 659 | if (m->status & MCI_STATUS_VAL) | 662 | if (m->status & MCI_STATUS_VAL) { |
| 660 | __set_bit(i, validp); | 663 | __set_bit(i, validp); |
| 664 | if (quirk_no_way_out) | ||
| 665 | quirk_no_way_out(i, m, regs); | ||
| 666 | } | ||
| 661 | if (mce_severity(m, tolerant, msg) >= MCE_PANIC_SEVERITY) | 667 | if (mce_severity(m, tolerant, msg) >= MCE_PANIC_SEVERITY) |
| 662 | ret = 1; | 668 | ret = 1; |
| 663 | } | 669 | } |
| @@ -1040,7 +1046,7 @@ void do_machine_check(struct pt_regs *regs, long error_code) | |||
| 1040 | *final = m; | 1046 | *final = m; |
| 1041 | 1047 | ||
| 1042 | memset(valid_banks, 0, sizeof(valid_banks)); | 1048 | memset(valid_banks, 0, sizeof(valid_banks)); |
| 1043 | no_way_out = mce_no_way_out(&m, &msg, valid_banks); | 1049 | no_way_out = mce_no_way_out(&m, &msg, valid_banks, regs); |
| 1044 | 1050 | ||
| 1045 | barrier(); | 1051 | barrier(); |
| 1046 | 1052 | ||
| @@ -1418,6 +1424,34 @@ static void __mcheck_cpu_init_generic(void) | |||
| 1418 | } | 1424 | } |
| 1419 | } | 1425 | } |
| 1420 | 1426 | ||
| 1427 | /* | ||
| 1428 | * During IFU recovery Sandy Bridge -EP4S processors set the RIPV and | ||
| 1429 | * EIPV bits in MCG_STATUS to zero on the affected logical processor (SDM | ||
| 1430 | * Vol 3B Table 15-20). But this confuses both the code that determines | ||
| 1431 | * whether the machine check occurred in kernel or user mode, and also | ||
| 1432 | * the severity assessment code. Pretend that EIPV was set, and take the | ||
| 1433 | * ip/cs values from the pt_regs that mce_gather_info() ignored earlier. | ||
| 1434 | */ | ||
| 1435 | static void quirk_sandybridge_ifu(int bank, struct mce *m, struct pt_regs *regs) | ||
| 1436 | { | ||
| 1437 | if (bank != 0) | ||
| 1438 | return; | ||
| 1439 | if ((m->mcgstatus & (MCG_STATUS_EIPV|MCG_STATUS_RIPV)) != 0) | ||
| 1440 | return; | ||
| 1441 | if ((m->status & (MCI_STATUS_OVER|MCI_STATUS_UC| | ||
| 1442 | MCI_STATUS_EN|MCI_STATUS_MISCV|MCI_STATUS_ADDRV| | ||
| 1443 | MCI_STATUS_PCC|MCI_STATUS_S|MCI_STATUS_AR| | ||
| 1444 | MCACOD)) != | ||
| 1445 | (MCI_STATUS_UC|MCI_STATUS_EN| | ||
| 1446 | MCI_STATUS_MISCV|MCI_STATUS_ADDRV|MCI_STATUS_S| | ||
| 1447 | MCI_STATUS_AR|MCACOD_INSTR)) | ||
| 1448 | return; | ||
| 1449 | |||
| 1450 | m->mcgstatus |= MCG_STATUS_EIPV; | ||
| 1451 | m->ip = regs->ip; | ||
| 1452 | m->cs = regs->cs; | ||
| 1453 | } | ||
| 1454 | |||
| 1421 | /* Add per CPU specific workarounds here */ | 1455 | /* Add per CPU specific workarounds here */ |
| 1422 | static int __cpuinit __mcheck_cpu_apply_quirks(struct cpuinfo_x86 *c) | 1456 | static int __cpuinit __mcheck_cpu_apply_quirks(struct cpuinfo_x86 *c) |
| 1423 | { | 1457 | { |
| @@ -1515,6 +1549,9 @@ static int __cpuinit __mcheck_cpu_apply_quirks(struct cpuinfo_x86 *c) | |||
| 1515 | */ | 1549 | */ |
| 1516 | if (c->x86 == 6 && c->x86_model <= 13 && mce_bootlog < 0) | 1550 | if (c->x86 == 6 && c->x86_model <= 13 && mce_bootlog < 0) |
| 1517 | mce_bootlog = 0; | 1551 | mce_bootlog = 0; |
| 1552 | |||
| 1553 | if (c->x86 == 6 && c->x86_model == 45) | ||
| 1554 | quirk_no_way_out = quirk_sandybridge_ifu; | ||
| 1518 | } | 1555 | } |
| 1519 | if (monarch_timeout < 0) | 1556 | if (monarch_timeout < 0) |
| 1520 | monarch_timeout = 0; | 1557 | monarch_timeout = 0; |
