Skip to content

Commit fd0f5ff

Browse files
committed
MCE, AMD: Fix decoding module loading on unsupported hw
We want to still be able to issue some error information on systems for which there is no decoding support (think older distro kernels here, for example). Therefore, we allow module registration but skip the per-family bank-specific decoders and issue the general information only, i.e.: [ 46.822828] [Hardware Error]: Error Status: Uncorrected, software containable error. [ 46.822846] [Hardware Error]: CPU:0 (15:30:0) MC0_STATUS[-|UE|-|-|-|-|-]: 0xa000000000010f0f [ 46.822858] [Hardware Error]: cache level: L3/GEN, mem/io: GEN, mem-tx: GEN, part-proc: GEN (timed out) with the hope that it still contains helpful useful bits. Suggested-by: Aravind Gopalakrishnan <aravind.gopalakrishnan@amd.com> Tested-by: Aravind Gopalakrishnan <aravind.gopalakrishnan@amd.com> Link: http://lkml.kernel.org/r/1392659391-2411-1-git-send-email-Aravind.Gopalakrishnan@amd.com Signed-off-by: Borislav Petkov <bp@suse.de>
1 parent 9d6c7cb commit fd0f5ff

1 file changed

Lines changed: 33 additions & 32 deletions

File tree

‎drivers/edac/mce_amd.c‎

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,36 @@ int amd_decode_mce(struct notifier_block *nb, unsigned long val, void *data)
741741
if (amd_filter_mce(m))
742742
return NOTIFY_STOP;
743743

744+
pr_emerg(HW_ERR "%s\n", decode_error_status(m));
745+
746+
pr_emerg(HW_ERR "CPU:%d (%x:%x:%x) MC%d_STATUS[%s|%s|%s|%s|%s",
747+
m->extcpu,
748+
c->x86, c->x86_model, c->x86_mask,
749+
m->bank,
750+
((m->status & MCI_STATUS_OVER) ? "Over" : "-"),
751+
((m->status & MCI_STATUS_UC) ? "UE" : "CE"),
752+
((m->status & MCI_STATUS_MISCV) ? "MiscV" : "-"),
753+
((m->status & MCI_STATUS_PCC) ? "PCC" : "-"),
754+
((m->status & MCI_STATUS_ADDRV) ? "AddrV" : "-"));
755+
756+
if (c->x86 == 0x15 || c->x86 == 0x16)
757+
pr_cont("|%s|%s",
758+
((m->status & MCI_STATUS_DEFERRED) ? "Deferred" : "-"),
759+
((m->status & MCI_STATUS_POISON) ? "Poison" : "-"));
760+
761+
/* do the two bits[14:13] together */
762+
ecc = (m->status >> 45) & 0x3;
763+
if (ecc)
764+
pr_cont("|%sECC", ((ecc == 2) ? "C" : "U"));
765+
766+
pr_cont("]: 0x%016llx\n", m->status);
767+
768+
if (m->status & MCI_STATUS_ADDRV)
769+
pr_emerg(HW_ERR "MC%d_ADDR: 0x%016llx\n", m->bank, m->addr);
770+
771+
if (!fam_ops)
772+
goto err_code;
773+
744774
switch (m->bank) {
745775
case 0:
746776
decode_mc0_mce(m);
@@ -774,33 +804,7 @@ int amd_decode_mce(struct notifier_block *nb, unsigned long val, void *data)
774804
break;
775805
}
776806

777-
pr_emerg(HW_ERR "Error Status: %s\n", decode_error_status(m));
778-
779-
pr_emerg(HW_ERR "CPU:%d (%x:%x:%x) MC%d_STATUS[%s|%s|%s|%s|%s",
780-
m->extcpu,
781-
c->x86, c->x86_model, c->x86_mask,
782-
m->bank,
783-
((m->status & MCI_STATUS_OVER) ? "Over" : "-"),
784-
((m->status & MCI_STATUS_UC) ? "UE" : "CE"),
785-
((m->status & MCI_STATUS_MISCV) ? "MiscV" : "-"),
786-
((m->status & MCI_STATUS_PCC) ? "PCC" : "-"),
787-
((m->status & MCI_STATUS_ADDRV) ? "AddrV" : "-"));
788-
789-
if (c->x86 == 0x15 || c->x86 == 0x16)
790-
pr_cont("|%s|%s",
791-
((m->status & MCI_STATUS_DEFERRED) ? "Deferred" : "-"),
792-
((m->status & MCI_STATUS_POISON) ? "Poison" : "-"));
793-
794-
/* do the two bits[14:13] together */
795-
ecc = (m->status >> 45) & 0x3;
796-
if (ecc)
797-
pr_cont("|%sECC", ((ecc == 2) ? "C" : "U"));
798-
799-
pr_cont("]: 0x%016llx\n", m->status);
800-
801-
if (m->status & MCI_STATUS_ADDRV)
802-
pr_emerg(HW_ERR "MC%d_ADDR: 0x%016llx\n", m->bank, m->addr);
803-
807+
err_code:
804808
amd_decode_err_code(m->status & 0xffff);
805809

806810
return NOTIFY_STOP;
@@ -816,10 +820,7 @@ static int __init mce_amd_init(void)
816820
struct cpuinfo_x86 *c = &boot_cpu_data;
817821

818822
if (c->x86_vendor != X86_VENDOR_AMD)
819-
return 0;
820-
821-
if (c->x86 < 0xf || c->x86 > 0x16)
822-
return 0;
823+
return -ENODEV;
823824

824825
fam_ops = kzalloc(sizeof(struct amd_decoder_ops), GFP_KERNEL);
825826
if (!fam_ops)
@@ -874,7 +875,7 @@ static int __init mce_amd_init(void)
874875
default:
875876
printk(KERN_WARNING "Huh? What family is it: 0x%x?!\n", c->x86);
876877
kfree(fam_ops);
877-
return -EINVAL;
878+
fam_ops = NULL;
878879
}
879880

880881
pr_info("MCE: In-kernel MCE decoding enabled.\n");

0 commit comments

Comments
 (0)