aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYazen Ghannam <Yazen.Ghannam@amd.com>2016-05-11 08:58:28 -0400
committerIngo Molnar <mingo@kernel.org>2016-05-12 03:08:23 -0400
commita348ed83d9efe8c11ecc85c15d7329825b97431e (patch)
treecc38922d645934182f48c91214f073f881181635
parent14cddfd5308b0880abd6e58b6660f5cc8e8020f9 (diff)
EDAC, mce_amd: Detect SMCA using X86_FEATURE_SMCA
Use X86_FEATURE_SMCA when detecting if SMCA is available instead of directly using CPUID 0x80000007_EBX. Signed-off-by: Yazen Ghannam <Yazen.Ghannam@amd.com> Signed-off-by: Borislav Petkov <bp@suse.de> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Tony Luck <tony.luck@intel.com> Cc: linux-edac <linux-edac@vger.kernel.org> Link: http://lkml.kernel.org/r/1462971509-3856-7-git-send-email-bp@alien8.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--drivers/edac/mce_amd.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/edac/mce_amd.c b/drivers/edac/mce_amd.c
index 49768c08ac07..9b6800a79c7f 100644
--- a/drivers/edac/mce_amd.c
+++ b/drivers/edac/mce_amd.c
@@ -1052,7 +1052,6 @@ int amd_decode_mce(struct notifier_block *nb, unsigned long val, void *data)
1052 struct mce *m = (struct mce *)data; 1052 struct mce *m = (struct mce *)data;
1053 struct cpuinfo_x86 *c = &cpu_data(m->extcpu); 1053 struct cpuinfo_x86 *c = &cpu_data(m->extcpu);
1054 int ecc; 1054 int ecc;
1055 u32 ebx = cpuid_ebx(0x80000007);
1056 1055
1057 if (amd_filter_mce(m)) 1056 if (amd_filter_mce(m))
1058 return NOTIFY_STOP; 1057 return NOTIFY_STOP;
@@ -1075,7 +1074,7 @@ int amd_decode_mce(struct notifier_block *nb, unsigned long val, void *data)
1075 ((m->status & MCI_STATUS_DEFERRED) ? "Deferred" : "-"), 1074 ((m->status & MCI_STATUS_DEFERRED) ? "Deferred" : "-"),
1076 ((m->status & MCI_STATUS_POISON) ? "Poison" : "-")); 1075 ((m->status & MCI_STATUS_POISON) ? "Poison" : "-"));
1077 1076
1078 if (!!(ebx & BIT(3))) { 1077 if (boot_cpu_has(X86_FEATURE_SMCA)) {
1079 u32 low, high; 1078 u32 low, high;
1080 u32 addr = MSR_AMD64_SMCA_MCx_CONFIG(m->bank); 1079 u32 addr = MSR_AMD64_SMCA_MCx_CONFIG(m->bank);
1081 1080
@@ -1094,7 +1093,7 @@ int amd_decode_mce(struct notifier_block *nb, unsigned long val, void *data)
1094 if (m->status & MCI_STATUS_ADDRV) 1093 if (m->status & MCI_STATUS_ADDRV)
1095 pr_emerg(HW_ERR "MC%d Error Address: 0x%016llx\n", m->bank, m->addr); 1094 pr_emerg(HW_ERR "MC%d Error Address: 0x%016llx\n", m->bank, m->addr);
1096 1095
1097 if (!!(ebx & BIT(3))) { 1096 if (boot_cpu_has(X86_FEATURE_SMCA)) {
1098 decode_smca_errors(m); 1097 decode_smca_errors(m);
1099 goto err_code; 1098 goto err_code;
1100 } 1099 }
@@ -1149,7 +1148,6 @@ static struct notifier_block amd_mce_dec_nb = {
1149static int __init mce_amd_init(void) 1148static int __init mce_amd_init(void)
1150{ 1149{
1151 struct cpuinfo_x86 *c = &boot_cpu_data; 1150 struct cpuinfo_x86 *c = &boot_cpu_data;
1152 u32 ebx;
1153 1151
1154 if (c->x86_vendor != X86_VENDOR_AMD) 1152 if (c->x86_vendor != X86_VENDOR_AMD)
1155 return -ENODEV; 1153 return -ENODEV;
@@ -1205,9 +1203,8 @@ static int __init mce_amd_init(void)
1205 break; 1203 break;
1206 1204
1207 case 0x17: 1205 case 0x17:
1208 ebx = cpuid_ebx(0x80000007);
1209 xec_mask = 0x3f; 1206 xec_mask = 0x3f;
1210 if (!(ebx & BIT(3))) { 1207 if (!boot_cpu_has(X86_FEATURE_SMCA)) {
1211 printk(KERN_WARNING "Decoding supported only on Scalable MCA processors.\n"); 1208 printk(KERN_WARNING "Decoding supported only on Scalable MCA processors.\n");
1212 goto err_out; 1209 goto err_out;
1213 } 1210 }