1 #include <linux/module.h>
2 #include <linux/slab.h>
6 static struct amd_decoder_ops
*fam_ops
;
8 static u8 xec_mask
= 0xf;
10 static bool report_gart_errors
;
11 static void (*nb_bus_decoder
)(int node_id
, struct mce
*m
);
13 void amd_report_gart_errors(bool v
)
15 report_gart_errors
= v
;
17 EXPORT_SYMBOL_GPL(amd_report_gart_errors
);
19 void amd_register_ecc_decoder(void (*f
)(int, struct mce
*))
23 EXPORT_SYMBOL_GPL(amd_register_ecc_decoder
);
25 void amd_unregister_ecc_decoder(void (*f
)(int, struct mce
*))
28 WARN_ON(nb_bus_decoder
!= f
);
30 nb_bus_decoder
= NULL
;
33 EXPORT_SYMBOL_GPL(amd_unregister_ecc_decoder
);
36 * string representation for the different MCA reported error types, see F3x48
40 /* transaction type */
41 static const char * const tt_msgs
[] = { "INSN", "DATA", "GEN", "RESV" };
44 static const char * const ll_msgs
[] = { "RESV", "L1", "L2", "L3/GEN" };
46 /* memory transaction type */
47 static const char * const rrrr_msgs
[] = {
48 "GEN", "RD", "WR", "DRD", "DWR", "IRD", "PRF", "EV", "SNP"
51 /* participating processor */
52 const char * const pp_msgs
[] = { "SRC", "RES", "OBS", "GEN" };
53 EXPORT_SYMBOL_GPL(pp_msgs
);
56 static const char * const to_msgs
[] = { "no timeout", "timed out" };
59 static const char * const ii_msgs
[] = { "MEM", "RESV", "IO", "GEN" };
61 /* internal error type */
62 static const char * const uu_msgs
[] = { "RESV", "RESV", "HWA", "RESV" };
64 static const char * const f15h_mc1_mce_desc
[] = {
65 "UC during a demand linefill from L2",
66 "Parity error during data load from IC",
67 "Parity error for IC valid bit",
68 "Main tag parity error",
69 "Parity error in prediction queue",
70 "PFB data/address parity error",
71 "Parity error in the branch status reg",
72 "PFB promotion address error",
73 "Tag error during probe/victimization",
74 "Parity error for IC probe tag valid bit",
75 "PFB non-cacheable bit parity error",
76 "PFB valid bit parity error", /* xec = 0xd */
77 "Microcode Patch Buffer", /* xec = 010 */
85 static const char * const f15h_mc2_mce_desc
[] = {
86 "Fill ECC error on data fills", /* xec = 0x4 */
87 "Fill parity error on insn fills",
88 "Prefetcher request FIFO parity error",
89 "PRQ address parity error",
90 "PRQ data parity error",
93 "WCB Data parity error",
94 "VB Data ECC or parity error",
95 "L2 Tag ECC error", /* xec = 0x10 */
96 "Hard L2 Tag ECC error",
97 "Multiple hits on L2 tag",
99 "PRB address parity error"
102 static const char * const mc4_mce_desc
[] = {
103 "DRAM ECC error detected on the NB",
104 "CRC error detected on HT link",
105 "Link-defined sync error packets detected on HT link",
108 "Invalid GART PTE entry during GART table walk",
109 "Unsupported atomic RMW received from an IO link",
110 "Watchdog timeout due to lack of progress",
111 "DRAM ECC error detected on the NB",
112 "SVM DMA Exclusion Vector error",
113 "HT data error detected on link",
114 "Protocol error (link, L3, probe filter)",
115 "NB internal arrays parity error",
116 "DRAM addr/ctl signals parity error",
117 "IO link transmission error",
118 "L3 data cache ECC error", /* xec = 0x1c */
119 "L3 cache tag error",
120 "L3 LRU parity bits error",
121 "ECC Error in the Probe Filter directory"
124 static const char * const mc5_mce_desc
[] = {
125 "CPU Watchdog timer expire",
126 "Wakeup array dest tag",
130 "Retire dispatch queue",
131 "Mapper checkpoint array",
132 "Physical register file EX0 port",
133 "Physical register file EX1 port",
134 "Physical register file AG0 port",
135 "Physical register file AG1 port",
136 "Flag register file",
138 "Retire status queue"
141 static const char * const mc6_mce_desc
[] = {
142 "Hardware Assertion",
144 "Physical Register File",
147 "Status Register File",
150 /* Scalable MCA error strings */
151 static const char * const f17h_ls_mce_desc
[] = {
153 "Store queue parity",
154 "Miss address buffer payload parity",
157 "DC tag error type 6",
158 "DC tag error type 1",
159 "Internal error type 1",
160 "Internal error type 2",
161 "Sys Read data error thread 0",
162 "Sys read data error thread 1",
163 "DC tag error type 2",
164 "DC data error type 1 (poison comsumption)",
165 "DC data error type 2",
166 "DC data error type 3",
167 "DC tag error type 4",
170 "DC tag error type 3",
171 "DC tag error type 5",
172 "L2 fill data error",
175 static const char * const f17h_if_mce_desc
[] = {
176 "microtag probe port parity error",
177 "IC microtag or full tag multi-hit error",
178 "IC full tag parity",
179 "IC data array parity",
180 "Decoupling queue phys addr parity error",
181 "L0 ITLB parity error",
182 "L1 ITLB parity error",
183 "L2 ITLB parity error",
184 "BPQ snoop parity on Thread 0",
185 "BPQ snoop parity on Thread 1",
186 "L1 BTB multi-match error",
187 "L2 BTB multi-match error",
190 static const char * const f17h_l2_mce_desc
[] = {
191 "L2M tag multi-way-hit error",
193 "L2M data ECC error",
197 static const char * const f17h_de_mce_desc
[] = {
198 "uop cache tag parity error",
199 "uop cache data parity error",
200 "Insn buffer parity error",
201 "Insn dispatch queue parity error",
202 "Fetch address FIFO parity",
203 "Patch RAM data parity",
204 "Patch RAM sequencer parity",
208 static const char * const f17h_ex_mce_desc
[] = {
209 "Watchdog timeout error",
210 "Phy register file parity",
211 "Flag register file parity",
212 "Immediate displacement register file parity",
213 "Address generator payload parity",
215 "Checkpoint queue parity",
216 "Retire dispatch queue parity",
219 static const char * const f17h_fp_mce_desc
[] = {
220 "Physical register file parity",
221 "Freelist parity error",
222 "Schedule queue parity",
224 "Retire queue parity",
225 "Status register file parity",
228 static const char * const f17h_l3_mce_desc
[] = {
229 "Shadow tag macro ECC error",
230 "Shadow tag macro multi-way-hit error",
232 "L3M tag multi-way-hit error",
233 "L3M data ECC error",
234 "XI parity, L3 fill done channel error",
235 "L3 victim queue parity",
239 static const char * const f17h_cs_mce_desc
[] = {
240 "Illegal request from transport layer",
242 "Security violation",
243 "Illegal response from transport layer",
244 "Unexpected response",
245 "Parity error on incoming request or probe response data",
246 "Parity error on incoming read response data",
247 "Atomic request parity",
248 "ECC error on probe filter access",
251 static const char * const f17h_pie_mce_desc
[] = {
253 "Internal PIE register security violation",
255 "Poison data written to internal PIE register",
258 static const char * const f17h_umc_mce_desc
[] = {
260 "Data poison error on DRAM",
262 "Advanced peripheral bus error",
263 "Command/address parity error",
264 "Write data CRC error",
267 static const char * const f17h_pb_mce_desc
[] = {
268 "Parameter Block RAM ECC error",
271 static const char * const f17h_psp_mce_desc
[] = {
272 "PSP RAM ECC or parity error",
275 static const char * const f17h_smu_mce_desc
[] = {
276 "SMU RAM ECC or parity error",
279 static bool f12h_mc0_mce(u16 ec
, u8 xec
)
288 pr_cont("during L1 linefill from L2.\n");
289 else if (ll
== LL_L1
)
290 pr_cont("Data/Tag %s error.\n", R4_MSG(ec
));
297 static bool f10h_mc0_mce(u16 ec
, u8 xec
)
299 if (R4(ec
) == R4_GEN
&& LL(ec
) == LL_L1
) {
300 pr_cont("during data scrub.\n");
303 return f12h_mc0_mce(ec
, xec
);
306 static bool k8_mc0_mce(u16 ec
, u8 xec
)
309 pr_cont("during system linefill.\n");
313 return f10h_mc0_mce(ec
, xec
);
316 static bool cat_mc0_mce(u16 ec
, u8 xec
)
323 if (TT(ec
) != TT_DATA
|| LL(ec
) != LL_L1
)
329 pr_cont("Data/Tag parity error due to %s.\n",
330 (r4
== R4_DRD
? "load/hw prf" : "store"));
333 pr_cont("Copyback parity error on a tag miss.\n");
336 pr_cont("Tag parity error during snoop.\n");
341 } else if (BUS_ERROR(ec
)) {
343 if ((II(ec
) != II_MEM
&& II(ec
) != II_IO
) || LL(ec
) != LL_LG
)
346 pr_cont("System read data error on a ");
350 pr_cont("TLB reload.\n");
368 static bool f15h_mc0_mce(u16 ec
, u8 xec
)
376 pr_cont("Data Array access error.\n");
380 pr_cont("UC error during a linefill from L2/NB.\n");
385 pr_cont("STQ access error.\n");
389 pr_cont("SCB access error.\n");
393 pr_cont("Tag error.\n");
397 pr_cont("LDQ access error.\n");
403 } else if (BUS_ERROR(ec
)) {
406 pr_cont("System Read Data Error.\n");
408 pr_cont(" Internal error condition type %d.\n", xec
);
409 } else if (INT_ERROR(ec
)) {
411 pr_cont("Hardware Assert.\n");
421 static void decode_mc0_mce(struct mce
*m
)
423 u16 ec
= EC(m
->status
);
424 u8 xec
= XEC(m
->status
, xec_mask
);
426 pr_emerg(HW_ERR
"MC0 Error: ");
428 /* TLB error signatures are the same across families */
430 if (TT(ec
) == TT_DATA
) {
431 pr_cont("%s TLB %s.\n", LL_MSG(ec
),
432 ((xec
== 2) ? "locked miss"
433 : (xec
? "multimatch" : "parity")));
436 } else if (fam_ops
->mc0_mce(ec
, xec
))
439 pr_emerg(HW_ERR
"Corrupted MC0 MCE info?\n");
442 static bool k8_mc1_mce(u16 ec
, u8 xec
)
451 pr_cont("during a linefill from L2.\n");
452 else if (ll
== 0x1) {
455 pr_cont("Parity error during data load.\n");
459 pr_cont("Copyback Parity/Victim error.\n");
463 pr_cont("Tag Snoop error.\n");
476 static bool cat_mc1_mce(u16 ec
, u8 xec
)
484 if (TT(ec
) != TT_INSTR
)
488 pr_cont("Data/tag array parity error for a tag hit.\n");
489 else if (r4
== R4_SNOOP
)
490 pr_cont("Tag error during snoop/victimization.\n");
492 pr_cont("Tag parity error from victim castout.\n");
494 pr_cont("Microcode patch RAM parity error.\n");
501 static bool f15h_mc1_mce(u16 ec
, u8 xec
)
510 pr_cont("%s.\n", f15h_mc1_mce_desc
[xec
]);
514 pr_cont("%s.\n", f15h_mc1_mce_desc
[xec
-2]);
518 pr_cont("%s.\n", f15h_mc1_mce_desc
[xec
-4]);
522 pr_cont("Decoder %s parity error.\n", f15h_mc1_mce_desc
[xec
-4]);
531 static void decode_mc1_mce(struct mce
*m
)
533 u16 ec
= EC(m
->status
);
534 u8 xec
= XEC(m
->status
, xec_mask
);
536 pr_emerg(HW_ERR
"MC1 Error: ");
539 pr_cont("%s TLB %s.\n", LL_MSG(ec
),
540 (xec
? "multimatch" : "parity error"));
541 else if (BUS_ERROR(ec
)) {
542 bool k8
= (boot_cpu_data
.x86
== 0xf && (m
->status
& BIT_64(58)));
544 pr_cont("during %s.\n", (k8
? "system linefill" : "NB data read"));
545 } else if (INT_ERROR(ec
)) {
547 pr_cont("Hardware Assert.\n");
550 } else if (fam_ops
->mc1_mce(ec
, xec
))
558 pr_emerg(HW_ERR
"Corrupted MC1 MCE info?\n");
561 static bool k8_mc2_mce(u16 ec
, u8 xec
)
566 pr_cont(" in the write data buffers.\n");
568 pr_cont(" in the victim data buffers.\n");
569 else if (xec
== 0x2 && MEM_ERROR(ec
))
570 pr_cont(": %s error in the L2 cache tags.\n", R4_MSG(ec
));
571 else if (xec
== 0x0) {
573 pr_cont("%s error in a Page Descriptor Cache or Guest TLB.\n",
575 else if (BUS_ERROR(ec
))
576 pr_cont(": %s/ECC error in data read from NB: %s.\n",
577 R4_MSG(ec
), PP_MSG(ec
));
578 else if (MEM_ERROR(ec
)) {
582 pr_cont(": %s error during data copyback.\n",
585 pr_cont(": %s parity/ECC error during data "
586 "access from L2.\n", R4_MSG(ec
));
597 static bool f15h_mc2_mce(u16 ec
, u8 xec
)
603 pr_cont("Data parity TLB read error.\n");
605 pr_cont("Poison data provided for TLB fill.\n");
608 } else if (BUS_ERROR(ec
)) {
612 pr_cont("Error during attempted NB data read.\n");
613 } else if (MEM_ERROR(ec
)) {
616 pr_cont("%s.\n", f15h_mc2_mce_desc
[xec
- 0x4]);
620 pr_cont("%s.\n", f15h_mc2_mce_desc
[xec
- 0x7]);
626 } else if (INT_ERROR(ec
)) {
628 pr_cont("Hardware Assert.\n");
636 static bool f16h_mc2_mce(u16 ec
, u8 xec
)
645 pr_cont("%cBUFF parity error.\n", (r4
== R4_RD
) ? 'I' : 'O');
650 pr_cont("ECC error in L2 tag (%s).\n",
651 ((r4
== R4_GEN
) ? "BankReq" :
652 ((r4
== R4_SNOOP
) ? "Prb" : "Fill")));
657 pr_cont("ECC error in L2 data array (%s).\n",
658 (((r4
== R4_RD
) && !(xec
& 0x3)) ? "Hit" :
659 ((r4
== R4_GEN
) ? "Attr" :
660 ((r4
== R4_EVICT
) ? "Vict" : "Fill"))));
665 pr_cont("Parity error in L2 attribute bits (%s).\n",
666 ((r4
== R4_RD
) ? "Hit" :
667 ((r4
== R4_GEN
) ? "Attr" : "Fill")));
677 static void decode_mc2_mce(struct mce
*m
)
679 u16 ec
= EC(m
->status
);
680 u8 xec
= XEC(m
->status
, xec_mask
);
682 pr_emerg(HW_ERR
"MC2 Error: ");
684 if (!fam_ops
->mc2_mce(ec
, xec
))
685 pr_cont(HW_ERR
"Corrupted MC2 MCE info?\n");
688 static void decode_mc3_mce(struct mce
*m
)
690 u16 ec
= EC(m
->status
);
691 u8 xec
= XEC(m
->status
, xec_mask
);
693 if (boot_cpu_data
.x86
>= 0x14) {
694 pr_emerg("You shouldn't be seeing MC3 MCE on this cpu family,"
695 " please report on LKML.\n");
699 pr_emerg(HW_ERR
"MC3 Error");
704 if (!BUS_ERROR(ec
) || (r4
!= R4_DRD
&& r4
!= R4_DWR
))
707 pr_cont(" during %s.\n", R4_MSG(ec
));
714 pr_emerg(HW_ERR
"Corrupted MC3 MCE info?\n");
717 static void decode_mc4_mce(struct mce
*m
)
719 struct cpuinfo_x86
*c
= &boot_cpu_data
;
720 int node_id
= amd_get_nb_id(m
->extcpu
);
721 u16 ec
= EC(m
->status
);
722 u8 xec
= XEC(m
->status
, 0x1f);
725 pr_emerg(HW_ERR
"MC4 Error (node %d): ", node_id
);
730 /* special handling for DRAM ECCs */
731 if (xec
== 0x0 || xec
== 0x8) {
732 /* no ECCs on F11h */
736 pr_cont("%s.\n", mc4_mce_desc
[xec
]);
739 nb_bus_decoder(node_id
, m
);
746 pr_cont("GART Table Walk data error.\n");
747 else if (BUS_ERROR(ec
))
748 pr_cont("DMA Exclusion Vector Table Walk error.\n");
754 if (boot_cpu_data
.x86
== 0x15 || boot_cpu_data
.x86
== 0x16)
755 pr_cont("Compute Unit Data Error.\n");
768 pr_cont("%s.\n", mc4_mce_desc
[xec
- offset
]);
772 pr_emerg(HW_ERR
"Corrupted MC4 MCE info?\n");
775 static void decode_mc5_mce(struct mce
*m
)
777 struct cpuinfo_x86
*c
= &boot_cpu_data
;
778 u16 ec
= EC(m
->status
);
779 u8 xec
= XEC(m
->status
, xec_mask
);
781 if (c
->x86
== 0xf || c
->x86
== 0x11)
784 pr_emerg(HW_ERR
"MC5 Error: ");
788 pr_cont("Hardware Assert.\n");
794 if (xec
== 0x0 || xec
== 0xc)
795 pr_cont("%s.\n", mc5_mce_desc
[xec
]);
797 pr_cont("%s parity error.\n", mc5_mce_desc
[xec
]);
804 pr_emerg(HW_ERR
"Corrupted MC5 MCE info?\n");
807 static void decode_mc6_mce(struct mce
*m
)
809 u8 xec
= XEC(m
->status
, xec_mask
);
811 pr_emerg(HW_ERR
"MC6 Error: ");
816 pr_cont("%s parity error.\n", mc6_mce_desc
[xec
]);
820 pr_emerg(HW_ERR
"Corrupted MC6 MCE info?\n");
823 static void decode_f17h_core_errors(const char *ip_name
, u8 xec
,
824 unsigned int mca_type
)
826 const char * const *error_desc_array
;
829 pr_emerg(HW_ERR
"%s Error: ", ip_name
);
833 error_desc_array
= f17h_ls_mce_desc
;
834 len
= ARRAY_SIZE(f17h_ls_mce_desc
) - 1;
837 pr_cont("Unrecognized LS MCA error code.\n");
843 error_desc_array
= f17h_if_mce_desc
;
844 len
= ARRAY_SIZE(f17h_if_mce_desc
) - 1;
848 error_desc_array
= f17h_l2_mce_desc
;
849 len
= ARRAY_SIZE(f17h_l2_mce_desc
) - 1;
853 error_desc_array
= f17h_de_mce_desc
;
854 len
= ARRAY_SIZE(f17h_de_mce_desc
) - 1;
858 error_desc_array
= f17h_ex_mce_desc
;
859 len
= ARRAY_SIZE(f17h_ex_mce_desc
) - 1;
863 error_desc_array
= f17h_fp_mce_desc
;
864 len
= ARRAY_SIZE(f17h_fp_mce_desc
) - 1;
868 error_desc_array
= f17h_l3_mce_desc
;
869 len
= ARRAY_SIZE(f17h_l3_mce_desc
) - 1;
873 pr_cont("Corrupted MCA core error info.\n");
878 pr_cont("Unrecognized %s MCA bank error code.\n",
879 amd_core_mcablock_names
[mca_type
]);
883 pr_cont("%s.\n", error_desc_array
[xec
]);
886 static void decode_df_errors(u8 xec
, unsigned int mca_type
)
888 const char * const *error_desc_array
;
891 pr_emerg(HW_ERR
"Data Fabric Error: ");
895 error_desc_array
= f17h_cs_mce_desc
;
896 len
= ARRAY_SIZE(f17h_cs_mce_desc
) - 1;
900 error_desc_array
= f17h_pie_mce_desc
;
901 len
= ARRAY_SIZE(f17h_pie_mce_desc
) - 1;
905 pr_cont("Corrupted MCA Data Fabric info.\n");
910 pr_cont("Unrecognized %s MCA bank error code.\n",
911 amd_df_mcablock_names
[mca_type
]);
915 pr_cont("%s.\n", error_desc_array
[xec
]);
918 /* Decode errors according to Scalable MCA specification */
919 static void decode_smca_errors(struct mce
*m
)
921 u32 addr
= MSR_AMD64_SMCA_MCx_IPID(m
->bank
);
922 unsigned int hwid
, mca_type
, i
;
923 u8 xec
= XEC(m
->status
, xec_mask
);
924 const char * const *error_desc_array
;
929 if (rdmsr_safe(addr
, &low
, &high
)) {
930 pr_emerg("Invalid IP block specified, error information is unreliable.\n");
934 hwid
= high
& MCI_IPID_HWID
;
935 mca_type
= (high
& MCI_IPID_MCATYPE
) >> 16;
937 pr_emerg(HW_ERR
"MC%d IPID value: 0x%08x%08x\n", m
->bank
, high
, low
);
940 * Based on hwid and mca_type values, decode errors from respective IPs.
941 * Note: mca_type values make sense only in the context of an hwid.
943 for (i
= 0; i
< ARRAY_SIZE(amd_hwids
); i
++)
944 if (amd_hwids
[i
].hwid
== hwid
)
949 ip_name
= (mca_type
== SMCA_L3_CACHE
) ?
950 "L3 Cache" : "F17h Core";
951 return decode_f17h_core_errors(ip_name
, xec
, mca_type
);
955 return decode_df_errors(xec
, mca_type
);
959 error_desc_array
= f17h_umc_mce_desc
;
960 len
= ARRAY_SIZE(f17h_umc_mce_desc
) - 1;
964 error_desc_array
= f17h_pb_mce_desc
;
965 len
= ARRAY_SIZE(f17h_pb_mce_desc
) - 1;
969 error_desc_array
= f17h_psp_mce_desc
;
970 len
= ARRAY_SIZE(f17h_psp_mce_desc
) - 1;
974 error_desc_array
= f17h_smu_mce_desc
;
975 len
= ARRAY_SIZE(f17h_smu_mce_desc
) - 1;
979 pr_emerg(HW_ERR
"HWID:%d does not match any existing IPs.\n", hwid
);
983 ip_name
= amd_hwids
[i
].name
;
984 pr_emerg(HW_ERR
"%s Error: ", ip_name
);
987 pr_cont("Unrecognized %s MCA bank error code.\n", ip_name
);
991 pr_cont("%s.\n", error_desc_array
[xec
]);
994 static inline void amd_decode_err_code(u16 ec
)
997 pr_emerg(HW_ERR
"internal: %s\n", UU_MSG(ec
));
1001 pr_emerg(HW_ERR
"cache level: %s", LL_MSG(ec
));
1004 pr_cont(", mem/io: %s", II_MSG(ec
));
1006 pr_cont(", tx: %s", TT_MSG(ec
));
1008 if (MEM_ERROR(ec
) || BUS_ERROR(ec
)) {
1009 pr_cont(", mem-tx: %s", R4_MSG(ec
));
1012 pr_cont(", part-proc: %s (%s)", PP_MSG(ec
), TO_MSG(ec
));
1019 * Filter out unwanted MCE signatures here.
1021 static bool amd_filter_mce(struct mce
*m
)
1023 u8 xec
= (m
->status
>> 16) & 0x1f;
1026 * NB GART TLB error reporting is disabled by default.
1028 if (m
->bank
== 4 && xec
== 0x5 && !report_gart_errors
)
1034 static const char *decode_error_status(struct mce
*m
)
1036 if (m
->status
& MCI_STATUS_UC
) {
1037 if (m
->status
& MCI_STATUS_PCC
)
1038 return "System Fatal error.";
1039 if (m
->mcgstatus
& MCG_STATUS_RIPV
)
1040 return "Uncorrected, software restartable error.";
1041 return "Uncorrected, software containable error.";
1044 if (m
->status
& MCI_STATUS_DEFERRED
)
1045 return "Deferred error.";
1047 return "Corrected error, no action required.";
1050 int amd_decode_mce(struct notifier_block
*nb
, unsigned long val
, void *data
)
1052 struct mce
*m
= (struct mce
*)data
;
1053 struct cpuinfo_x86
*c
= &cpu_data(m
->extcpu
);
1055 u32 ebx
= cpuid_ebx(0x80000007);
1057 if (amd_filter_mce(m
))
1060 pr_emerg(HW_ERR
"%s\n", decode_error_status(m
));
1062 pr_emerg(HW_ERR
"CPU:%d (%x:%x:%x) MC%d_STATUS[%s|%s|%s|%s|%s",
1064 c
->x86
, c
->x86_model
, c
->x86_mask
,
1066 ((m
->status
& MCI_STATUS_OVER
) ? "Over" : "-"),
1067 ((m
->status
& MCI_STATUS_UC
) ? "UE" :
1068 (m
->status
& MCI_STATUS_DEFERRED
) ? "-" : "CE"),
1069 ((m
->status
& MCI_STATUS_MISCV
) ? "MiscV" : "-"),
1070 ((m
->status
& MCI_STATUS_PCC
) ? "PCC" : "-"),
1071 ((m
->status
& MCI_STATUS_ADDRV
) ? "AddrV" : "-"));
1075 ((m
->status
& MCI_STATUS_DEFERRED
) ? "Deferred" : "-"),
1076 ((m
->status
& MCI_STATUS_POISON
) ? "Poison" : "-"));
1078 if (!!(ebx
& BIT(3))) {
1080 u32 addr
= MSR_AMD64_SMCA_MCx_CONFIG(m
->bank
);
1082 if (!rdmsr_safe(addr
, &low
, &high
) &&
1083 (low
& MCI_CONFIG_MCAX
))
1084 pr_cont("|%s", ((m
->status
& MCI_STATUS_TCC
) ? "TCC" : "-"));
1087 /* do the two bits[14:13] together */
1088 ecc
= (m
->status
>> 45) & 0x3;
1090 pr_cont("|%sECC", ((ecc
== 2) ? "C" : "U"));
1092 pr_cont("]: 0x%016llx\n", m
->status
);
1094 if (m
->status
& MCI_STATUS_ADDRV
)
1095 pr_emerg(HW_ERR
"MC%d Error Address: 0x%016llx\n", m
->bank
, m
->addr
);
1097 if (!!(ebx
& BIT(3))) {
1098 decode_smca_errors(m
);
1139 amd_decode_err_code(m
->status
& 0xffff);
1143 EXPORT_SYMBOL_GPL(amd_decode_mce
);
1145 static struct notifier_block amd_mce_dec_nb
= {
1146 .notifier_call
= amd_decode_mce
,
1149 static int __init
mce_amd_init(void)
1151 struct cpuinfo_x86
*c
= &boot_cpu_data
;
1154 if (c
->x86_vendor
!= X86_VENDOR_AMD
)
1157 fam_ops
= kzalloc(sizeof(struct amd_decoder_ops
), GFP_KERNEL
);
1163 fam_ops
->mc0_mce
= k8_mc0_mce
;
1164 fam_ops
->mc1_mce
= k8_mc1_mce
;
1165 fam_ops
->mc2_mce
= k8_mc2_mce
;
1169 fam_ops
->mc0_mce
= f10h_mc0_mce
;
1170 fam_ops
->mc1_mce
= k8_mc1_mce
;
1171 fam_ops
->mc2_mce
= k8_mc2_mce
;
1175 fam_ops
->mc0_mce
= k8_mc0_mce
;
1176 fam_ops
->mc1_mce
= k8_mc1_mce
;
1177 fam_ops
->mc2_mce
= k8_mc2_mce
;
1181 fam_ops
->mc0_mce
= f12h_mc0_mce
;
1182 fam_ops
->mc1_mce
= k8_mc1_mce
;
1183 fam_ops
->mc2_mce
= k8_mc2_mce
;
1187 fam_ops
->mc0_mce
= cat_mc0_mce
;
1188 fam_ops
->mc1_mce
= cat_mc1_mce
;
1189 fam_ops
->mc2_mce
= k8_mc2_mce
;
1193 xec_mask
= c
->x86_model
== 0x60 ? 0x3f : 0x1f;
1195 fam_ops
->mc0_mce
= f15h_mc0_mce
;
1196 fam_ops
->mc1_mce
= f15h_mc1_mce
;
1197 fam_ops
->mc2_mce
= f15h_mc2_mce
;
1202 fam_ops
->mc0_mce
= cat_mc0_mce
;
1203 fam_ops
->mc1_mce
= cat_mc1_mce
;
1204 fam_ops
->mc2_mce
= f16h_mc2_mce
;
1208 ebx
= cpuid_ebx(0x80000007);
1210 if (!(ebx
& BIT(3))) {
1211 printk(KERN_WARNING
"Decoding supported only on Scalable MCA processors.\n");
1217 printk(KERN_WARNING
"Huh? What family is it: 0x%x?!\n", c
->x86
);
1221 pr_info("MCE: In-kernel MCE decoding enabled.\n");
1223 mce_register_decode_chain(&amd_mce_dec_nb
);
1232 early_initcall(mce_amd_init
);
1235 static void __exit
mce_amd_exit(void)
1237 mce_unregister_decode_chain(&amd_mce_dec_nb
);
1241 MODULE_DESCRIPTION("AMD MCE decoder");
1242 MODULE_ALIAS("edac-mce-amd");
1243 MODULE_LICENSE("GPL");
1244 module_exit(mce_amd_exit
);