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 smca_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 smca_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",
188 "L2 Cache Response Poison error",
189 "System Read Data error",
192 static const char * const smca_l2_mce_desc
[] = {
193 "L2M tag multi-way-hit error",
195 "L2M data ECC error",
199 static const char * const smca_de_mce_desc
[] = {
200 "uop cache tag parity error",
201 "uop cache data parity error",
202 "Insn buffer parity error",
203 "uop queue parity error",
204 "Insn dispatch queue parity error",
205 "Fetch address FIFO parity",
206 "Patch RAM data parity",
207 "Patch RAM sequencer parity",
211 static const char * const smca_ex_mce_desc
[] = {
212 "Watchdog timeout error",
213 "Phy register file parity",
214 "Flag register file parity",
215 "Immediate displacement register file parity",
216 "Address generator payload parity",
218 "Checkpoint queue parity",
219 "Retire dispatch queue parity",
220 "Retire status queue parity error",
221 "Scheduling queue parity error",
222 "Branch buffer queue parity error",
225 static const char * const smca_fp_mce_desc
[] = {
226 "Physical register file parity",
227 "Freelist parity error",
228 "Schedule queue parity",
230 "Retire queue parity",
231 "Status register file parity",
232 "Hardware assertion",
235 static const char * const smca_l3_mce_desc
[] = {
236 "Shadow tag macro ECC error",
237 "Shadow tag macro multi-way-hit error",
239 "L3M tag multi-way-hit error",
240 "L3M data ECC error",
241 "XI parity, L3 fill done channel error",
242 "L3 victim queue parity",
246 static const char * const smca_cs_mce_desc
[] = {
247 "Illegal request from transport layer",
249 "Security violation",
250 "Illegal response from transport layer",
251 "Unexpected response",
252 "Parity error on incoming request or probe response data",
253 "Parity error on incoming read response data",
254 "Atomic request parity",
255 "ECC error on probe filter access",
258 static const char * const smca_pie_mce_desc
[] = {
260 "Internal PIE register security violation",
262 "Poison data written to internal PIE register",
265 static const char * const smca_umc_mce_desc
[] = {
267 "Data poison error on DRAM",
269 "Advanced peripheral bus error",
270 "Command/address parity error",
271 "Write data CRC error",
274 static const char * const smca_pb_mce_desc
[] = {
275 "Parameter Block RAM ECC error",
278 static const char * const smca_psp_mce_desc
[] = {
279 "PSP RAM ECC or parity error",
282 static const char * const smca_smu_mce_desc
[] = {
283 "SMU RAM ECC or parity error",
286 static bool f12h_mc0_mce(u16 ec
, u8 xec
)
295 pr_cont("during L1 linefill from L2.\n");
296 else if (ll
== LL_L1
)
297 pr_cont("Data/Tag %s error.\n", R4_MSG(ec
));
304 static bool f10h_mc0_mce(u16 ec
, u8 xec
)
306 if (R4(ec
) == R4_GEN
&& LL(ec
) == LL_L1
) {
307 pr_cont("during data scrub.\n");
310 return f12h_mc0_mce(ec
, xec
);
313 static bool k8_mc0_mce(u16 ec
, u8 xec
)
316 pr_cont("during system linefill.\n");
320 return f10h_mc0_mce(ec
, xec
);
323 static bool cat_mc0_mce(u16 ec
, u8 xec
)
330 if (TT(ec
) != TT_DATA
|| LL(ec
) != LL_L1
)
336 pr_cont("Data/Tag parity error due to %s.\n",
337 (r4
== R4_DRD
? "load/hw prf" : "store"));
340 pr_cont("Copyback parity error on a tag miss.\n");
343 pr_cont("Tag parity error during snoop.\n");
348 } else if (BUS_ERROR(ec
)) {
350 if ((II(ec
) != II_MEM
&& II(ec
) != II_IO
) || LL(ec
) != LL_LG
)
353 pr_cont("System read data error on a ");
357 pr_cont("TLB reload.\n");
375 static bool f15h_mc0_mce(u16 ec
, u8 xec
)
383 pr_cont("Data Array access error.\n");
387 pr_cont("UC error during a linefill from L2/NB.\n");
392 pr_cont("STQ access error.\n");
396 pr_cont("SCB access error.\n");
400 pr_cont("Tag error.\n");
404 pr_cont("LDQ access error.\n");
410 } else if (BUS_ERROR(ec
)) {
413 pr_cont("System Read Data Error.\n");
415 pr_cont(" Internal error condition type %d.\n", xec
);
416 } else if (INT_ERROR(ec
)) {
418 pr_cont("Hardware Assert.\n");
428 static void decode_mc0_mce(struct mce
*m
)
430 u16 ec
= EC(m
->status
);
431 u8 xec
= XEC(m
->status
, xec_mask
);
433 pr_emerg(HW_ERR
"MC0 Error: ");
435 /* TLB error signatures are the same across families */
437 if (TT(ec
) == TT_DATA
) {
438 pr_cont("%s TLB %s.\n", LL_MSG(ec
),
439 ((xec
== 2) ? "locked miss"
440 : (xec
? "multimatch" : "parity")));
443 } else if (fam_ops
->mc0_mce(ec
, xec
))
446 pr_emerg(HW_ERR
"Corrupted MC0 MCE info?\n");
449 static bool k8_mc1_mce(u16 ec
, u8 xec
)
458 pr_cont("during a linefill from L2.\n");
459 else if (ll
== 0x1) {
462 pr_cont("Parity error during data load.\n");
466 pr_cont("Copyback Parity/Victim error.\n");
470 pr_cont("Tag Snoop error.\n");
483 static bool cat_mc1_mce(u16 ec
, u8 xec
)
491 if (TT(ec
) != TT_INSTR
)
495 pr_cont("Data/tag array parity error for a tag hit.\n");
496 else if (r4
== R4_SNOOP
)
497 pr_cont("Tag error during snoop/victimization.\n");
499 pr_cont("Tag parity error from victim castout.\n");
501 pr_cont("Microcode patch RAM parity error.\n");
508 static bool f15h_mc1_mce(u16 ec
, u8 xec
)
517 pr_cont("%s.\n", f15h_mc1_mce_desc
[xec
]);
521 pr_cont("%s.\n", f15h_mc1_mce_desc
[xec
-2]);
525 pr_cont("%s.\n", f15h_mc1_mce_desc
[xec
-4]);
529 pr_cont("Decoder %s parity error.\n", f15h_mc1_mce_desc
[xec
-4]);
538 static void decode_mc1_mce(struct mce
*m
)
540 u16 ec
= EC(m
->status
);
541 u8 xec
= XEC(m
->status
, xec_mask
);
543 pr_emerg(HW_ERR
"MC1 Error: ");
546 pr_cont("%s TLB %s.\n", LL_MSG(ec
),
547 (xec
? "multimatch" : "parity error"));
548 else if (BUS_ERROR(ec
)) {
549 bool k8
= (boot_cpu_data
.x86
== 0xf && (m
->status
& BIT_64(58)));
551 pr_cont("during %s.\n", (k8
? "system linefill" : "NB data read"));
552 } else if (INT_ERROR(ec
)) {
554 pr_cont("Hardware Assert.\n");
557 } else if (fam_ops
->mc1_mce(ec
, xec
))
565 pr_emerg(HW_ERR
"Corrupted MC1 MCE info?\n");
568 static bool k8_mc2_mce(u16 ec
, u8 xec
)
573 pr_cont(" in the write data buffers.\n");
575 pr_cont(" in the victim data buffers.\n");
576 else if (xec
== 0x2 && MEM_ERROR(ec
))
577 pr_cont(": %s error in the L2 cache tags.\n", R4_MSG(ec
));
578 else if (xec
== 0x0) {
580 pr_cont("%s error in a Page Descriptor Cache or Guest TLB.\n",
582 else if (BUS_ERROR(ec
))
583 pr_cont(": %s/ECC error in data read from NB: %s.\n",
584 R4_MSG(ec
), PP_MSG(ec
));
585 else if (MEM_ERROR(ec
)) {
589 pr_cont(": %s error during data copyback.\n",
592 pr_cont(": %s parity/ECC error during data "
593 "access from L2.\n", R4_MSG(ec
));
604 static bool f15h_mc2_mce(u16 ec
, u8 xec
)
610 pr_cont("Data parity TLB read error.\n");
612 pr_cont("Poison data provided for TLB fill.\n");
615 } else if (BUS_ERROR(ec
)) {
619 pr_cont("Error during attempted NB data read.\n");
620 } else if (MEM_ERROR(ec
)) {
623 pr_cont("%s.\n", f15h_mc2_mce_desc
[xec
- 0x4]);
627 pr_cont("%s.\n", f15h_mc2_mce_desc
[xec
- 0x7]);
633 } else if (INT_ERROR(ec
)) {
635 pr_cont("Hardware Assert.\n");
643 static bool f16h_mc2_mce(u16 ec
, u8 xec
)
652 pr_cont("%cBUFF parity error.\n", (r4
== R4_RD
) ? 'I' : 'O');
657 pr_cont("ECC error in L2 tag (%s).\n",
658 ((r4
== R4_GEN
) ? "BankReq" :
659 ((r4
== R4_SNOOP
) ? "Prb" : "Fill")));
664 pr_cont("ECC error in L2 data array (%s).\n",
665 (((r4
== R4_RD
) && !(xec
& 0x3)) ? "Hit" :
666 ((r4
== R4_GEN
) ? "Attr" :
667 ((r4
== R4_EVICT
) ? "Vict" : "Fill"))));
672 pr_cont("Parity error in L2 attribute bits (%s).\n",
673 ((r4
== R4_RD
) ? "Hit" :
674 ((r4
== R4_GEN
) ? "Attr" : "Fill")));
684 static void decode_mc2_mce(struct mce
*m
)
686 u16 ec
= EC(m
->status
);
687 u8 xec
= XEC(m
->status
, xec_mask
);
689 pr_emerg(HW_ERR
"MC2 Error: ");
691 if (!fam_ops
->mc2_mce(ec
, xec
))
692 pr_cont(HW_ERR
"Corrupted MC2 MCE info?\n");
695 static void decode_mc3_mce(struct mce
*m
)
697 u16 ec
= EC(m
->status
);
698 u8 xec
= XEC(m
->status
, xec_mask
);
700 if (boot_cpu_data
.x86
>= 0x14) {
701 pr_emerg("You shouldn't be seeing MC3 MCE on this cpu family,"
702 " please report on LKML.\n");
706 pr_emerg(HW_ERR
"MC3 Error");
711 if (!BUS_ERROR(ec
) || (r4
!= R4_DRD
&& r4
!= R4_DWR
))
714 pr_cont(" during %s.\n", R4_MSG(ec
));
721 pr_emerg(HW_ERR
"Corrupted MC3 MCE info?\n");
724 static void decode_mc4_mce(struct mce
*m
)
726 struct cpuinfo_x86
*c
= &boot_cpu_data
;
727 int node_id
= amd_get_nb_id(m
->extcpu
);
728 u16 ec
= EC(m
->status
);
729 u8 xec
= XEC(m
->status
, 0x1f);
732 pr_emerg(HW_ERR
"MC4 Error (node %d): ", node_id
);
737 /* special handling for DRAM ECCs */
738 if (xec
== 0x0 || xec
== 0x8) {
739 /* no ECCs on F11h */
743 pr_cont("%s.\n", mc4_mce_desc
[xec
]);
746 nb_bus_decoder(node_id
, m
);
753 pr_cont("GART Table Walk data error.\n");
754 else if (BUS_ERROR(ec
))
755 pr_cont("DMA Exclusion Vector Table Walk error.\n");
761 if (boot_cpu_data
.x86
== 0x15 || boot_cpu_data
.x86
== 0x16)
762 pr_cont("Compute Unit Data Error.\n");
775 pr_cont("%s.\n", mc4_mce_desc
[xec
- offset
]);
779 pr_emerg(HW_ERR
"Corrupted MC4 MCE info?\n");
782 static void decode_mc5_mce(struct mce
*m
)
784 struct cpuinfo_x86
*c
= &boot_cpu_data
;
785 u16 ec
= EC(m
->status
);
786 u8 xec
= XEC(m
->status
, xec_mask
);
788 if (c
->x86
== 0xf || c
->x86
== 0x11)
791 pr_emerg(HW_ERR
"MC5 Error: ");
795 pr_cont("Hardware Assert.\n");
801 if (xec
== 0x0 || xec
== 0xc)
802 pr_cont("%s.\n", mc5_mce_desc
[xec
]);
804 pr_cont("%s parity error.\n", mc5_mce_desc
[xec
]);
811 pr_emerg(HW_ERR
"Corrupted MC5 MCE info?\n");
814 static void decode_mc6_mce(struct mce
*m
)
816 u8 xec
= XEC(m
->status
, xec_mask
);
818 pr_emerg(HW_ERR
"MC6 Error: ");
823 pr_cont("%s parity error.\n", mc6_mce_desc
[xec
]);
827 pr_emerg(HW_ERR
"Corrupted MC6 MCE info?\n");
830 static void decode_f17h_core_errors(const char *ip_name
, u8 xec
,
831 unsigned int mca_type
)
833 const char * const *error_desc_array
;
836 pr_emerg(HW_ERR
"%s Error: ", ip_name
);
840 error_desc_array
= smca_ls_mce_desc
;
841 len
= ARRAY_SIZE(smca_ls_mce_desc
) - 1;
844 pr_cont("Unrecognized LS MCA error code.\n");
850 error_desc_array
= smca_if_mce_desc
;
851 len
= ARRAY_SIZE(smca_if_mce_desc
) - 1;
855 error_desc_array
= smca_l2_mce_desc
;
856 len
= ARRAY_SIZE(smca_l2_mce_desc
) - 1;
860 error_desc_array
= smca_de_mce_desc
;
861 len
= ARRAY_SIZE(smca_de_mce_desc
) - 1;
865 error_desc_array
= smca_ex_mce_desc
;
866 len
= ARRAY_SIZE(smca_ex_mce_desc
) - 1;
870 error_desc_array
= smca_fp_mce_desc
;
871 len
= ARRAY_SIZE(smca_fp_mce_desc
) - 1;
875 error_desc_array
= smca_l3_mce_desc
;
876 len
= ARRAY_SIZE(smca_l3_mce_desc
) - 1;
880 pr_cont("Corrupted MCA core error info.\n");
885 pr_cont("Unrecognized %s MCA bank error code.\n",
886 amd_core_mcablock_names
[mca_type
]);
890 pr_cont("%s.\n", error_desc_array
[xec
]);
893 static void decode_df_errors(u8 xec
, unsigned int mca_type
)
895 const char * const *error_desc_array
;
898 pr_emerg(HW_ERR
"Data Fabric Error: ");
902 error_desc_array
= smca_cs_mce_desc
;
903 len
= ARRAY_SIZE(smca_cs_mce_desc
) - 1;
907 error_desc_array
= smca_pie_mce_desc
;
908 len
= ARRAY_SIZE(smca_pie_mce_desc
) - 1;
912 pr_cont("Corrupted MCA Data Fabric info.\n");
917 pr_cont("Unrecognized %s MCA bank error code.\n",
918 amd_df_mcablock_names
[mca_type
]);
922 pr_cont("%s.\n", error_desc_array
[xec
]);
925 /* Decode errors according to Scalable MCA specification */
926 static void decode_smca_errors(struct mce
*m
)
928 u32 addr
= MSR_AMD64_SMCA_MCx_IPID(m
->bank
);
929 unsigned int hwid
, mca_type
, i
;
930 u8 xec
= XEC(m
->status
, xec_mask
);
931 const char * const *error_desc_array
;
936 if (rdmsr_safe(addr
, &low
, &high
)) {
937 pr_emerg(HW_ERR
"Invalid IP block specified.\n");
941 hwid
= high
& MCI_IPID_HWID
;
942 mca_type
= (high
& MCI_IPID_MCATYPE
) >> 16;
944 pr_emerg(HW_ERR
"MC%d IPID value: 0x%08x%08x\n", m
->bank
, high
, low
);
947 * Based on hwid and mca_type values, decode errors from respective IPs.
948 * Note: mca_type values make sense only in the context of an hwid.
950 for (i
= 0; i
< ARRAY_SIZE(amd_hwids
); i
++)
951 if (amd_hwids
[i
].hwid
== hwid
)
956 ip_name
= (mca_type
== SMCA_L3_CACHE
) ?
957 "L3 Cache" : "F17h Core";
958 return decode_f17h_core_errors(ip_name
, xec
, mca_type
);
962 return decode_df_errors(xec
, mca_type
);
966 error_desc_array
= smca_umc_mce_desc
;
967 len
= ARRAY_SIZE(smca_umc_mce_desc
) - 1;
971 error_desc_array
= smca_pb_mce_desc
;
972 len
= ARRAY_SIZE(smca_pb_mce_desc
) - 1;
976 error_desc_array
= smca_psp_mce_desc
;
977 len
= ARRAY_SIZE(smca_psp_mce_desc
) - 1;
981 error_desc_array
= smca_smu_mce_desc
;
982 len
= ARRAY_SIZE(smca_smu_mce_desc
) - 1;
986 pr_emerg(HW_ERR
"HWID:%d does not match any existing IPs.\n", hwid
);
990 ip_name
= amd_hwids
[i
].name
;
991 pr_emerg(HW_ERR
"%s Error: ", ip_name
);
994 pr_cont("Unrecognized %s MCA bank error code.\n", ip_name
);
998 pr_cont("%s.\n", error_desc_array
[xec
]);
1001 static inline void amd_decode_err_code(u16 ec
)
1003 if (INT_ERROR(ec
)) {
1004 pr_emerg(HW_ERR
"internal: %s\n", UU_MSG(ec
));
1008 pr_emerg(HW_ERR
"cache level: %s", LL_MSG(ec
));
1011 pr_cont(", mem/io: %s", II_MSG(ec
));
1013 pr_cont(", tx: %s", TT_MSG(ec
));
1015 if (MEM_ERROR(ec
) || BUS_ERROR(ec
)) {
1016 pr_cont(", mem-tx: %s", R4_MSG(ec
));
1019 pr_cont(", part-proc: %s (%s)", PP_MSG(ec
), TO_MSG(ec
));
1026 * Filter out unwanted MCE signatures here.
1028 static bool amd_filter_mce(struct mce
*m
)
1030 u8 xec
= (m
->status
>> 16) & 0x1f;
1033 * NB GART TLB error reporting is disabled by default.
1035 if (m
->bank
== 4 && xec
== 0x5 && !report_gart_errors
)
1041 static const char *decode_error_status(struct mce
*m
)
1043 if (m
->status
& MCI_STATUS_UC
) {
1044 if (m
->status
& MCI_STATUS_PCC
)
1045 return "System Fatal error.";
1046 if (m
->mcgstatus
& MCG_STATUS_RIPV
)
1047 return "Uncorrected, software restartable error.";
1048 return "Uncorrected, software containable error.";
1051 if (m
->status
& MCI_STATUS_DEFERRED
)
1052 return "Deferred error.";
1054 return "Corrected error, no action required.";
1057 int amd_decode_mce(struct notifier_block
*nb
, unsigned long val
, void *data
)
1059 struct mce
*m
= (struct mce
*)data
;
1060 struct cpuinfo_x86
*c
= &cpu_data(m
->extcpu
);
1063 if (amd_filter_mce(m
))
1066 pr_emerg(HW_ERR
"%s\n", decode_error_status(m
));
1068 pr_emerg(HW_ERR
"CPU:%d (%x:%x:%x) MC%d_STATUS[%s|%s|%s|%s|%s",
1070 c
->x86
, c
->x86_model
, c
->x86_mask
,
1072 ((m
->status
& MCI_STATUS_OVER
) ? "Over" : "-"),
1073 ((m
->status
& MCI_STATUS_UC
) ? "UE" :
1074 (m
->status
& MCI_STATUS_DEFERRED
) ? "-" : "CE"),
1075 ((m
->status
& MCI_STATUS_MISCV
) ? "MiscV" : "-"),
1076 ((m
->status
& MCI_STATUS_PCC
) ? "PCC" : "-"),
1077 ((m
->status
& MCI_STATUS_ADDRV
) ? "AddrV" : "-"));
1081 ((m
->status
& MCI_STATUS_DEFERRED
) ? "Deferred" : "-"),
1082 ((m
->status
& MCI_STATUS_POISON
) ? "Poison" : "-"));
1084 if (boot_cpu_has(X86_FEATURE_SMCA
)) {
1086 u32 addr
= MSR_AMD64_SMCA_MCx_CONFIG(m
->bank
);
1088 pr_cont("|%s", ((m
->status
& MCI_STATUS_SYNDV
) ? "SyndV" : "-"));
1090 if (!rdmsr_safe(addr
, &low
, &high
) &&
1091 (low
& MCI_CONFIG_MCAX
))
1092 pr_cont("|%s", ((m
->status
& MCI_STATUS_TCC
) ? "TCC" : "-"));
1095 /* do the two bits[14:13] together */
1096 ecc
= (m
->status
>> 45) & 0x3;
1098 pr_cont("|%sECC", ((ecc
== 2) ? "C" : "U"));
1100 pr_cont("]: 0x%016llx\n", m
->status
);
1102 if (m
->status
& MCI_STATUS_ADDRV
)
1103 pr_emerg(HW_ERR
"Error Addr: 0x%016llx", m
->addr
);
1105 if (boot_cpu_has(X86_FEATURE_SMCA
)) {
1106 if (m
->status
& MCI_STATUS_SYNDV
)
1107 pr_cont(", Syndrome: 0x%016llx", m
->synd
);
1111 decode_smca_errors(m
);
1153 amd_decode_err_code(m
->status
& 0xffff);
1157 EXPORT_SYMBOL_GPL(amd_decode_mce
);
1159 static struct notifier_block amd_mce_dec_nb
= {
1160 .notifier_call
= amd_decode_mce
,
1163 static int __init
mce_amd_init(void)
1165 struct cpuinfo_x86
*c
= &boot_cpu_data
;
1167 if (c
->x86_vendor
!= X86_VENDOR_AMD
)
1170 fam_ops
= kzalloc(sizeof(struct amd_decoder_ops
), GFP_KERNEL
);
1176 fam_ops
->mc0_mce
= k8_mc0_mce
;
1177 fam_ops
->mc1_mce
= k8_mc1_mce
;
1178 fam_ops
->mc2_mce
= k8_mc2_mce
;
1182 fam_ops
->mc0_mce
= f10h_mc0_mce
;
1183 fam_ops
->mc1_mce
= k8_mc1_mce
;
1184 fam_ops
->mc2_mce
= k8_mc2_mce
;
1188 fam_ops
->mc0_mce
= k8_mc0_mce
;
1189 fam_ops
->mc1_mce
= k8_mc1_mce
;
1190 fam_ops
->mc2_mce
= k8_mc2_mce
;
1194 fam_ops
->mc0_mce
= f12h_mc0_mce
;
1195 fam_ops
->mc1_mce
= k8_mc1_mce
;
1196 fam_ops
->mc2_mce
= k8_mc2_mce
;
1200 fam_ops
->mc0_mce
= cat_mc0_mce
;
1201 fam_ops
->mc1_mce
= cat_mc1_mce
;
1202 fam_ops
->mc2_mce
= k8_mc2_mce
;
1206 xec_mask
= c
->x86_model
== 0x60 ? 0x3f : 0x1f;
1208 fam_ops
->mc0_mce
= f15h_mc0_mce
;
1209 fam_ops
->mc1_mce
= f15h_mc1_mce
;
1210 fam_ops
->mc2_mce
= f15h_mc2_mce
;
1215 fam_ops
->mc0_mce
= cat_mc0_mce
;
1216 fam_ops
->mc1_mce
= cat_mc1_mce
;
1217 fam_ops
->mc2_mce
= f16h_mc2_mce
;
1222 if (!boot_cpu_has(X86_FEATURE_SMCA
)) {
1223 printk(KERN_WARNING
"Decoding supported only on Scalable MCA processors.\n");
1229 printk(KERN_WARNING
"Huh? What family is it: 0x%x?!\n", c
->x86
);
1233 pr_info("MCE: In-kernel MCE decoding enabled.\n");
1235 mce_register_decode_chain(&amd_mce_dec_nb
);
1244 early_initcall(mce_amd_init
);
1247 static void __exit
mce_amd_exit(void)
1249 mce_unregister_decode_chain(&amd_mce_dec_nb
);
1253 MODULE_DESCRIPTION("AMD MCE decoder");
1254 MODULE_ALIAS("edac-mce-amd");
1255 MODULE_LICENSE("GPL");
1256 module_exit(mce_amd_exit
);