summaryrefslogtreecommitdiffstats
path: root/drivers/edac
diff options
context:
space:
mode:
authorBorislav Petkov <bp@suse.de>2017-07-25 05:07:03 -0400
committerBorislav Petkov <bp@suse.de>2017-08-21 11:54:57 -0400
commitf3c0891c2feafa008cc35d6ffb8cf593df66c867 (patch)
tree6397f1f8635c3dc2fb2b92790b28ca1b23271f2e /drivers/edac
parent4ab1784b48b384e52a6539ab10201fed7a3127f5 (diff)
EDAC, mce_amd: Get rid of most struct cpuinfo_x86 uses
struct mce.cpuid contains CPUID(1).EAX which contains family, model and stepping and thus has enough information for our purposes. Thus get rid of some external dependencies which are not really needed. No functionality change. Signed-off-by: Borislav Petkov <bp@suse.de>
Diffstat (limited to 'drivers/edac')
-rw-r--r--drivers/edac/mce_amd.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/edac/mce_amd.c b/drivers/edac/mce_amd.c
index 94cadd7f69e9..c0ae47a5c7b7 100644
--- a/drivers/edac/mce_amd.c
+++ b/drivers/edac/mce_amd.c
@@ -1,6 +1,8 @@
1#include <linux/module.h> 1#include <linux/module.h>
2#include <linux/slab.h> 2#include <linux/slab.h>
3 3
4#include <asm/cpu.h>
5
4#include "mce_amd.h" 6#include "mce_amd.h"
5 7
6static struct amd_decoder_ops *fam_ops; 8static struct amd_decoder_ops *fam_ops;
@@ -744,7 +746,7 @@ static void decode_mc3_mce(struct mce *m)
744 746
745static void decode_mc4_mce(struct mce *m) 747static void decode_mc4_mce(struct mce *m)
746{ 748{
747 struct cpuinfo_x86 *c = &boot_cpu_data; 749 unsigned int fam = x86_family(m->cpuid);
748 int node_id = amd_get_nb_id(m->extcpu); 750 int node_id = amd_get_nb_id(m->extcpu);
749 u16 ec = EC(m->status); 751 u16 ec = EC(m->status);
750 u8 xec = XEC(m->status, 0x1f); 752 u8 xec = XEC(m->status, 0x1f);
@@ -758,7 +760,7 @@ static void decode_mc4_mce(struct mce *m)
758 /* special handling for DRAM ECCs */ 760 /* special handling for DRAM ECCs */
759 if (xec == 0x0 || xec == 0x8) { 761 if (xec == 0x0 || xec == 0x8) {
760 /* no ECCs on F11h */ 762 /* no ECCs on F11h */
761 if (c->x86 == 0x11) 763 if (fam == 0x11)
762 goto wrong_mc4_mce; 764 goto wrong_mc4_mce;
763 765
764 pr_cont("%s.\n", mc4_mce_desc[xec]); 766 pr_cont("%s.\n", mc4_mce_desc[xec]);
@@ -779,7 +781,7 @@ static void decode_mc4_mce(struct mce *m)
779 return; 781 return;
780 782
781 case 0x19: 783 case 0x19:
782 if (boot_cpu_data.x86 == 0x15 || boot_cpu_data.x86 == 0x16) 784 if (fam == 0x15 || fam == 0x16)
783 pr_cont("Compute Unit Data Error.\n"); 785 pr_cont("Compute Unit Data Error.\n");
784 else 786 else
785 goto wrong_mc4_mce; 787 goto wrong_mc4_mce;
@@ -802,11 +804,11 @@ static void decode_mc4_mce(struct mce *m)
802 804
803static void decode_mc5_mce(struct mce *m) 805static void decode_mc5_mce(struct mce *m)
804{ 806{
805 struct cpuinfo_x86 *c = &boot_cpu_data; 807 unsigned int fam = x86_family(m->cpuid);
806 u16 ec = EC(m->status); 808 u16 ec = EC(m->status);
807 u8 xec = XEC(m->status, xec_mask); 809 u8 xec = XEC(m->status, xec_mask);
808 810
809 if (c->x86 == 0xf || c->x86 == 0x11) 811 if (fam == 0xf || fam == 0x11)
810 goto wrong_mc5_mce; 812 goto wrong_mc5_mce;
811 813
812 pr_emerg(HW_ERR "MC5 Error: "); 814 pr_emerg(HW_ERR "MC5 Error: ");
@@ -859,7 +861,7 @@ static void decode_smca_error(struct mce *m)
859 if (m->bank >= ARRAY_SIZE(smca_banks)) 861 if (m->bank >= ARRAY_SIZE(smca_banks))
860 return; 862 return;
861 863
862 if (boot_cpu_data.x86 >= 0x17 && m->bank == 4) 864 if (x86_family(m->cpuid) >= 0x17 && m->bank == 4)
863 pr_emerg(HW_ERR "Bank 4 is reserved on Fam17h.\n"); 865 pr_emerg(HW_ERR "Bank 4 is reserved on Fam17h.\n");
864 866
865 hwid = smca_banks[m->bank].hwid; 867 hwid = smca_banks[m->bank].hwid;
@@ -942,7 +944,7 @@ static int
942amd_decode_mce(struct notifier_block *nb, unsigned long val, void *data) 944amd_decode_mce(struct notifier_block *nb, unsigned long val, void *data)
943{ 945{
944 struct mce *m = (struct mce *)data; 946 struct mce *m = (struct mce *)data;
945 struct cpuinfo_x86 *c = &cpu_data(m->extcpu); 947 unsigned int fam = x86_family(m->cpuid);
946 int ecc; 948 int ecc;
947 949
948 if (amd_filter_mce(m)) 950 if (amd_filter_mce(m))
@@ -952,7 +954,7 @@ amd_decode_mce(struct notifier_block *nb, unsigned long val, void *data)
952 954
953 pr_emerg(HW_ERR "CPU:%d (%x:%x:%x) MC%d_STATUS[%s|%s|%s|%s|%s", 955 pr_emerg(HW_ERR "CPU:%d (%x:%x:%x) MC%d_STATUS[%s|%s|%s|%s|%s",
954 m->extcpu, 956 m->extcpu,
955 c->x86, c->x86_model, c->x86_mask, 957 fam, x86_model(m->cpuid), x86_stepping(m->cpuid),
956 m->bank, 958 m->bank,
957 ((m->status & MCI_STATUS_OVER) ? "Over" : "-"), 959 ((m->status & MCI_STATUS_OVER) ? "Over" : "-"),
958 ((m->status & MCI_STATUS_UC) ? "UE" : 960 ((m->status & MCI_STATUS_UC) ? "UE" :
@@ -961,11 +963,11 @@ amd_decode_mce(struct notifier_block *nb, unsigned long val, void *data)
961 ((m->status & MCI_STATUS_PCC) ? "PCC" : "-"), 963 ((m->status & MCI_STATUS_PCC) ? "PCC" : "-"),
962 ((m->status & MCI_STATUS_ADDRV) ? "AddrV" : "-")); 964 ((m->status & MCI_STATUS_ADDRV) ? "AddrV" : "-"));
963 965
964 if (c->x86 >= 0x15) { 966 if (fam >= 0x15) {
965 pr_cont("|%s", (m->status & MCI_STATUS_DEFERRED ? "Deferred" : "-")); 967 pr_cont("|%s", (m->status & MCI_STATUS_DEFERRED ? "Deferred" : "-"));
966 968
967 /* F15h, bank4, bit 43 is part of McaStatSubCache. */ 969 /* F15h, bank4, bit 43 is part of McaStatSubCache. */
968 if (c->x86 != 0x15 || m->bank != 4) 970 if (fam != 0x15 || m->bank != 4)
969 pr_cont("|%s", (m->status & MCI_STATUS_POISON ? "Poison" : "-")); 971 pr_cont("|%s", (m->status & MCI_STATUS_POISON ? "Poison" : "-"));
970 } 972 }
971 973