Borislav Petkov | b70ef01 | 2009-06-25 19:32:38 +0200 | [diff] [blame] | 1 | #include <linux/module.h> |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 2 | #include <linux/slab.h> |
| 3 | |
Borislav Petkov | f3c0891 | 2017-07-25 11:07:03 +0200 | [diff] [blame] | 4 | #include <asm/cpu.h> |
| 5 | |
Borislav Petkov | 47ca08a | 2010-09-27 15:30:39 +0200 | [diff] [blame] | 6 | #include "mce_amd.h" |
Doug Thompson | b52401ce | 2009-05-06 17:57:20 +0200 | [diff] [blame] | 7 | |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 8 | static struct amd_decoder_ops *fam_ops; |
| 9 | |
Borislav Petkov | 2be64bf | 2010-09-17 19:11:47 +0200 | [diff] [blame] | 10 | static u8 xec_mask = 0xf; |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 11 | |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 12 | static bool report_gart_errors; |
Yazen Ghannam | 5c33220 | 2016-11-17 17:57:29 -0500 | [diff] [blame] | 13 | static void (*decode_dram_ecc)(int node_id, struct mce *m); |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 14 | |
| 15 | void amd_report_gart_errors(bool v) |
| 16 | { |
| 17 | report_gart_errors = v; |
| 18 | } |
| 19 | EXPORT_SYMBOL_GPL(amd_report_gart_errors); |
| 20 | |
Borislav Petkov | b0b07a2 | 2011-08-24 18:44:22 +0200 | [diff] [blame] | 21 | void amd_register_ecc_decoder(void (*f)(int, struct mce *)) |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 22 | { |
Yazen Ghannam | 5c33220 | 2016-11-17 17:57:29 -0500 | [diff] [blame] | 23 | decode_dram_ecc = f; |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 24 | } |
| 25 | EXPORT_SYMBOL_GPL(amd_register_ecc_decoder); |
| 26 | |
Borislav Petkov | b0b07a2 | 2011-08-24 18:44:22 +0200 | [diff] [blame] | 27 | void amd_unregister_ecc_decoder(void (*f)(int, struct mce *)) |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 28 | { |
Yazen Ghannam | 5c33220 | 2016-11-17 17:57:29 -0500 | [diff] [blame] | 29 | if (decode_dram_ecc) { |
| 30 | WARN_ON(decode_dram_ecc != f); |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 31 | |
Yazen Ghannam | 5c33220 | 2016-11-17 17:57:29 -0500 | [diff] [blame] | 32 | decode_dram_ecc = NULL; |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 33 | } |
| 34 | } |
| 35 | EXPORT_SYMBOL_GPL(amd_unregister_ecc_decoder); |
| 36 | |
Doug Thompson | b52401ce | 2009-05-06 17:57:20 +0200 | [diff] [blame] | 37 | /* |
| 38 | * string representation for the different MCA reported error types, see F3x48 |
| 39 | * or MSR0000_0411. |
| 40 | */ |
Borislav Petkov | 6337583 | 2010-09-06 18:13:39 +0200 | [diff] [blame] | 41 | |
| 42 | /* transaction type */ |
Borislav Petkov | 0f08669 | 2012-12-23 12:40:45 +0100 | [diff] [blame] | 43 | static const char * const tt_msgs[] = { "INSN", "DATA", "GEN", "RESV" }; |
Doug Thompson | b52401ce | 2009-05-06 17:57:20 +0200 | [diff] [blame] | 44 | |
Borislav Petkov | 6337583 | 2010-09-06 18:13:39 +0200 | [diff] [blame] | 45 | /* cache level */ |
Borislav Petkov | 0f08669 | 2012-12-23 12:40:45 +0100 | [diff] [blame] | 46 | static const char * const ll_msgs[] = { "RESV", "L1", "L2", "L3/GEN" }; |
Doug Thompson | b52401ce | 2009-05-06 17:57:20 +0200 | [diff] [blame] | 47 | |
Borislav Petkov | 6337583 | 2010-09-06 18:13:39 +0200 | [diff] [blame] | 48 | /* memory transaction type */ |
Borislav Petkov | 0f08669 | 2012-12-23 12:40:45 +0100 | [diff] [blame] | 49 | static const char * const rrrr_msgs[] = { |
Borislav Petkov | 6337583 | 2010-09-06 18:13:39 +0200 | [diff] [blame] | 50 | "GEN", "RD", "WR", "DRD", "DWR", "IRD", "PRF", "EV", "SNP" |
Doug Thompson | b52401ce | 2009-05-06 17:57:20 +0200 | [diff] [blame] | 51 | }; |
| 52 | |
Borislav Petkov | 6337583 | 2010-09-06 18:13:39 +0200 | [diff] [blame] | 53 | /* participating processor */ |
Borislav Petkov | ebe2aea | 2011-11-29 19:03:25 +0100 | [diff] [blame] | 54 | const char * const pp_msgs[] = { "SRC", "RES", "OBS", "GEN" }; |
Borislav Petkov | b70ef01 | 2009-06-25 19:32:38 +0200 | [diff] [blame] | 55 | EXPORT_SYMBOL_GPL(pp_msgs); |
Doug Thompson | b52401ce | 2009-05-06 17:57:20 +0200 | [diff] [blame] | 56 | |
Borislav Petkov | 6337583 | 2010-09-06 18:13:39 +0200 | [diff] [blame] | 57 | /* request timeout */ |
Borislav Petkov | 0f08669 | 2012-12-23 12:40:45 +0100 | [diff] [blame] | 58 | static const char * const to_msgs[] = { "no timeout", "timed out" }; |
Doug Thompson | b52401ce | 2009-05-06 17:57:20 +0200 | [diff] [blame] | 59 | |
Borislav Petkov | 6337583 | 2010-09-06 18:13:39 +0200 | [diff] [blame] | 60 | /* memory or i/o */ |
Borislav Petkov | 0f08669 | 2012-12-23 12:40:45 +0100 | [diff] [blame] | 61 | static const char * const ii_msgs[] = { "MEM", "RESV", "IO", "GEN" }; |
Doug Thompson | b52401ce | 2009-05-06 17:57:20 +0200 | [diff] [blame] | 62 | |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 63 | /* internal error type */ |
Borislav Petkov | 0f08669 | 2012-12-23 12:40:45 +0100 | [diff] [blame] | 64 | static const char * const uu_msgs[] = { "RESV", "RESV", "HWA", "RESV" }; |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 65 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 66 | static const char * const f15h_mc1_mce_desc[] = { |
Borislav Petkov | 86039cd | 2010-11-08 15:03:35 +0100 | [diff] [blame] | 67 | "UC during a demand linefill from L2", |
| 68 | "Parity error during data load from IC", |
| 69 | "Parity error for IC valid bit", |
| 70 | "Main tag parity error", |
| 71 | "Parity error in prediction queue", |
| 72 | "PFB data/address parity error", |
| 73 | "Parity error in the branch status reg", |
| 74 | "PFB promotion address error", |
| 75 | "Tag error during probe/victimization", |
| 76 | "Parity error for IC probe tag valid bit", |
| 77 | "PFB non-cacheable bit parity error", |
| 78 | "PFB valid bit parity error", /* xec = 0xd */ |
Borislav Petkov | 6c1173a | 2011-11-21 19:45:34 +0100 | [diff] [blame] | 79 | "Microcode Patch Buffer", /* xec = 010 */ |
Borislav Petkov | 86039cd | 2010-11-08 15:03:35 +0100 | [diff] [blame] | 80 | "uop queue", |
| 81 | "insn buffer", |
| 82 | "predecode buffer", |
Aravind Gopalakrishnan | eba4bfb | 2014-07-14 16:58:19 +0200 | [diff] [blame] | 83 | "fetch address FIFO", |
| 84 | "dispatch uop queue" |
Borislav Petkov | 86039cd | 2010-11-08 15:03:35 +0100 | [diff] [blame] | 85 | }; |
| 86 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 87 | static const char * const f15h_mc2_mce_desc[] = { |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 88 | "Fill ECC error on data fills", /* xec = 0x4 */ |
| 89 | "Fill parity error on insn fills", |
| 90 | "Prefetcher request FIFO parity error", |
| 91 | "PRQ address parity error", |
| 92 | "PRQ data parity error", |
| 93 | "WCC Tag ECC error", |
| 94 | "WCC Data ECC error", |
| 95 | "WCB Data parity error", |
Borislav Petkov | b64a99c | 2011-11-23 14:50:44 +0100 | [diff] [blame] | 96 | "VB Data ECC or parity error", |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 97 | "L2 Tag ECC error", /* xec = 0x10 */ |
| 98 | "Hard L2 Tag ECC error", |
| 99 | "Multiple hits on L2 tag", |
| 100 | "XAB parity error", |
| 101 | "PRB address parity error" |
| 102 | }; |
| 103 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 104 | static const char * const mc4_mce_desc[] = { |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 105 | "DRAM ECC error detected on the NB", |
| 106 | "CRC error detected on HT link", |
| 107 | "Link-defined sync error packets detected on HT link", |
| 108 | "HT Master abort", |
| 109 | "HT Target abort", |
| 110 | "Invalid GART PTE entry during GART table walk", |
| 111 | "Unsupported atomic RMW received from an IO link", |
| 112 | "Watchdog timeout due to lack of progress", |
| 113 | "DRAM ECC error detected on the NB", |
| 114 | "SVM DMA Exclusion Vector error", |
| 115 | "HT data error detected on link", |
| 116 | "Protocol error (link, L3, probe filter)", |
| 117 | "NB internal arrays parity error", |
| 118 | "DRAM addr/ctl signals parity error", |
| 119 | "IO link transmission error", |
| 120 | "L3 data cache ECC error", /* xec = 0x1c */ |
| 121 | "L3 cache tag error", |
| 122 | "L3 LRU parity bits error", |
| 123 | "ECC Error in the Probe Filter directory" |
| 124 | }; |
| 125 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 126 | static const char * const mc5_mce_desc[] = { |
Borislav Petkov | 8259a7e | 2010-09-22 15:28:59 +0200 | [diff] [blame] | 127 | "CPU Watchdog timer expire", |
| 128 | "Wakeup array dest tag", |
| 129 | "AG payload array", |
| 130 | "EX payload array", |
| 131 | "IDRF array", |
| 132 | "Retire dispatch queue", |
| 133 | "Mapper checkpoint array", |
| 134 | "Physical register file EX0 port", |
| 135 | "Physical register file EX1 port", |
| 136 | "Physical register file AG0 port", |
| 137 | "Physical register file AG1 port", |
| 138 | "Flag register file", |
Aravind Gopalakrishnan | aad19e5 | 2013-06-05 15:50:03 -0500 | [diff] [blame] | 139 | "DE error occurred", |
| 140 | "Retire status queue" |
Borislav Petkov | 8259a7e | 2010-09-22 15:28:59 +0200 | [diff] [blame] | 141 | }; |
| 142 | |
Aravind Gopalakrishnan | bc4febe | 2014-11-04 11:41:08 -0600 | [diff] [blame] | 143 | static const char * const mc6_mce_desc[] = { |
| 144 | "Hardware Assertion", |
| 145 | "Free List", |
| 146 | "Physical Register File", |
| 147 | "Retire Queue", |
| 148 | "Scheduler table", |
| 149 | "Status Register File", |
| 150 | }; |
| 151 | |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 152 | /* Scalable MCA error strings */ |
Yazen Ghannam | 856095b | 2016-09-12 09:59:33 +0200 | [diff] [blame] | 153 | static const char * const smca_ls_mce_desc[] = { |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 154 | "Load queue parity", |
| 155 | "Store queue parity", |
| 156 | "Miss address buffer payload parity", |
| 157 | "L1 TLB parity", |
Yazen Ghannam | 856095b | 2016-09-12 09:59:33 +0200 | [diff] [blame] | 158 | "Reserved", |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 159 | "DC tag error type 6", |
| 160 | "DC tag error type 1", |
| 161 | "Internal error type 1", |
| 162 | "Internal error type 2", |
| 163 | "Sys Read data error thread 0", |
| 164 | "Sys read data error thread 1", |
| 165 | "DC tag error type 2", |
Yazen Ghannam | bdf1bf1 | 2017-06-12 11:58:23 -0500 | [diff] [blame] | 166 | "DC data error type 1 (poison consumption)", |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 167 | "DC data error type 2", |
| 168 | "DC data error type 3", |
| 169 | "DC tag error type 4", |
| 170 | "L2 TLB parity", |
| 171 | "PDC parity error", |
| 172 | "DC tag error type 3", |
| 173 | "DC tag error type 5", |
| 174 | "L2 fill data error", |
| 175 | }; |
| 176 | |
Yazen Ghannam | 856095b | 2016-09-12 09:59:33 +0200 | [diff] [blame] | 177 | static const char * const smca_if_mce_desc[] = { |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 178 | "microtag probe port parity error", |
| 179 | "IC microtag or full tag multi-hit error", |
| 180 | "IC full tag parity", |
| 181 | "IC data array parity", |
| 182 | "Decoupling queue phys addr parity error", |
| 183 | "L0 ITLB parity error", |
| 184 | "L1 ITLB parity error", |
| 185 | "L2 ITLB parity error", |
| 186 | "BPQ snoop parity on Thread 0", |
| 187 | "BPQ snoop parity on Thread 1", |
| 188 | "L1 BTB multi-match error", |
| 189 | "L2 BTB multi-match error", |
Yazen Ghannam | c019b95 | 2016-09-12 09:59:32 +0200 | [diff] [blame] | 190 | "L2 Cache Response Poison error", |
| 191 | "System Read Data error", |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 192 | }; |
| 193 | |
Yazen Ghannam | 856095b | 2016-09-12 09:59:33 +0200 | [diff] [blame] | 194 | static const char * const smca_l2_mce_desc[] = { |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 195 | "L2M tag multi-way-hit error", |
| 196 | "L2M tag ECC error", |
| 197 | "L2M data ECC error", |
| 198 | "HW assert", |
| 199 | }; |
| 200 | |
Yazen Ghannam | 856095b | 2016-09-12 09:59:33 +0200 | [diff] [blame] | 201 | static const char * const smca_de_mce_desc[] = { |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 202 | "uop cache tag parity error", |
| 203 | "uop cache data parity error", |
| 204 | "Insn buffer parity error", |
Yazen Ghannam | c019b95 | 2016-09-12 09:59:32 +0200 | [diff] [blame] | 205 | "uop queue parity error", |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 206 | "Insn dispatch queue parity error", |
| 207 | "Fetch address FIFO parity", |
| 208 | "Patch RAM data parity", |
| 209 | "Patch RAM sequencer parity", |
| 210 | "uop buffer parity" |
| 211 | }; |
| 212 | |
Yazen Ghannam | 856095b | 2016-09-12 09:59:33 +0200 | [diff] [blame] | 213 | static const char * const smca_ex_mce_desc[] = { |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 214 | "Watchdog timeout error", |
| 215 | "Phy register file parity", |
| 216 | "Flag register file parity", |
| 217 | "Immediate displacement register file parity", |
| 218 | "Address generator payload parity", |
| 219 | "EX payload parity", |
| 220 | "Checkpoint queue parity", |
| 221 | "Retire dispatch queue parity", |
Yazen Ghannam | c019b95 | 2016-09-12 09:59:32 +0200 | [diff] [blame] | 222 | "Retire status queue parity error", |
| 223 | "Scheduling queue parity error", |
| 224 | "Branch buffer queue parity error", |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 225 | }; |
| 226 | |
Yazen Ghannam | 856095b | 2016-09-12 09:59:33 +0200 | [diff] [blame] | 227 | static const char * const smca_fp_mce_desc[] = { |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 228 | "Physical register file parity", |
| 229 | "Freelist parity error", |
| 230 | "Schedule queue parity", |
| 231 | "NSQ parity error", |
| 232 | "Retire queue parity", |
| 233 | "Status register file parity", |
Yazen Ghannam | c019b95 | 2016-09-12 09:59:32 +0200 | [diff] [blame] | 234 | "Hardware assertion", |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 235 | }; |
| 236 | |
Yazen Ghannam | 856095b | 2016-09-12 09:59:33 +0200 | [diff] [blame] | 237 | static const char * const smca_l3_mce_desc[] = { |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 238 | "Shadow tag macro ECC error", |
| 239 | "Shadow tag macro multi-way-hit error", |
| 240 | "L3M tag ECC error", |
| 241 | "L3M tag multi-way-hit error", |
| 242 | "L3M data ECC error", |
| 243 | "XI parity, L3 fill done channel error", |
| 244 | "L3 victim queue parity", |
| 245 | "L3 HW assert", |
| 246 | }; |
| 247 | |
Yazen Ghannam | 856095b | 2016-09-12 09:59:33 +0200 | [diff] [blame] | 248 | static const char * const smca_cs_mce_desc[] = { |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 249 | "Illegal request from transport layer", |
| 250 | "Address violation", |
| 251 | "Security violation", |
| 252 | "Illegal response from transport layer", |
| 253 | "Unexpected response", |
| 254 | "Parity error on incoming request or probe response data", |
| 255 | "Parity error on incoming read response data", |
| 256 | "Atomic request parity", |
| 257 | "ECC error on probe filter access", |
| 258 | }; |
| 259 | |
Yazen Ghannam | 856095b | 2016-09-12 09:59:33 +0200 | [diff] [blame] | 260 | static const char * const smca_pie_mce_desc[] = { |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 261 | "HW assert", |
| 262 | "Internal PIE register security violation", |
| 263 | "Error on GMI link", |
| 264 | "Poison data written to internal PIE register", |
| 265 | }; |
| 266 | |
Yazen Ghannam | 856095b | 2016-09-12 09:59:33 +0200 | [diff] [blame] | 267 | static const char * const smca_umc_mce_desc[] = { |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 268 | "DRAM ECC error", |
| 269 | "Data poison error on DRAM", |
| 270 | "SDP parity error", |
| 271 | "Advanced peripheral bus error", |
| 272 | "Command/address parity error", |
| 273 | "Write data CRC error", |
| 274 | }; |
| 275 | |
Yazen Ghannam | 856095b | 2016-09-12 09:59:33 +0200 | [diff] [blame] | 276 | static const char * const smca_pb_mce_desc[] = { |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 277 | "Parameter Block RAM ECC error", |
| 278 | }; |
| 279 | |
Yazen Ghannam | 856095b | 2016-09-12 09:59:33 +0200 | [diff] [blame] | 280 | static const char * const smca_psp_mce_desc[] = { |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 281 | "PSP RAM ECC or parity error", |
| 282 | }; |
| 283 | |
Yazen Ghannam | 856095b | 2016-09-12 09:59:33 +0200 | [diff] [blame] | 284 | static const char * const smca_smu_mce_desc[] = { |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 285 | "SMU RAM ECC or parity error", |
| 286 | }; |
| 287 | |
Yazen Ghannam | 5896820 | 2016-09-12 09:59:34 +0200 | [diff] [blame] | 288 | struct smca_mce_desc { |
| 289 | const char * const *descs; |
| 290 | unsigned int num_descs; |
| 291 | }; |
| 292 | |
| 293 | static struct smca_mce_desc smca_mce_descs[] = { |
| 294 | [SMCA_LS] = { smca_ls_mce_desc, ARRAY_SIZE(smca_ls_mce_desc) }, |
| 295 | [SMCA_IF] = { smca_if_mce_desc, ARRAY_SIZE(smca_if_mce_desc) }, |
| 296 | [SMCA_L2_CACHE] = { smca_l2_mce_desc, ARRAY_SIZE(smca_l2_mce_desc) }, |
| 297 | [SMCA_DE] = { smca_de_mce_desc, ARRAY_SIZE(smca_de_mce_desc) }, |
| 298 | [SMCA_EX] = { smca_ex_mce_desc, ARRAY_SIZE(smca_ex_mce_desc) }, |
| 299 | [SMCA_FP] = { smca_fp_mce_desc, ARRAY_SIZE(smca_fp_mce_desc) }, |
| 300 | [SMCA_L3_CACHE] = { smca_l3_mce_desc, ARRAY_SIZE(smca_l3_mce_desc) }, |
| 301 | [SMCA_CS] = { smca_cs_mce_desc, ARRAY_SIZE(smca_cs_mce_desc) }, |
| 302 | [SMCA_PIE] = { smca_pie_mce_desc, ARRAY_SIZE(smca_pie_mce_desc) }, |
| 303 | [SMCA_UMC] = { smca_umc_mce_desc, ARRAY_SIZE(smca_umc_mce_desc) }, |
| 304 | [SMCA_PB] = { smca_pb_mce_desc, ARRAY_SIZE(smca_pb_mce_desc) }, |
| 305 | [SMCA_PSP] = { smca_psp_mce_desc, ARRAY_SIZE(smca_psp_mce_desc) }, |
| 306 | [SMCA_SMU] = { smca_smu_mce_desc, ARRAY_SIZE(smca_smu_mce_desc) }, |
| 307 | }; |
| 308 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 309 | static bool f12h_mc0_mce(u16 ec, u8 xec) |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 310 | { |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 311 | bool ret = false; |
| 312 | |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 313 | if (MEM_ERROR(ec)) { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 314 | u8 ll = LL(ec); |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 315 | ret = true; |
| 316 | |
| 317 | if (ll == LL_L2) |
| 318 | pr_cont("during L1 linefill from L2.\n"); |
| 319 | else if (ll == LL_L1) |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 320 | pr_cont("Data/Tag %s error.\n", R4_MSG(ec)); |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 321 | else |
| 322 | ret = false; |
| 323 | } |
| 324 | return ret; |
| 325 | } |
| 326 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 327 | static bool f10h_mc0_mce(u16 ec, u8 xec) |
Borislav Petkov | 9be0bb1 | 2010-09-16 15:08:14 +0200 | [diff] [blame] | 328 | { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 329 | if (R4(ec) == R4_GEN && LL(ec) == LL_L1) { |
Borislav Petkov | 9be0bb1 | 2010-09-16 15:08:14 +0200 | [diff] [blame] | 330 | pr_cont("during data scrub.\n"); |
| 331 | return true; |
| 332 | } |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 333 | return f12h_mc0_mce(ec, xec); |
Borislav Petkov | 9be0bb1 | 2010-09-16 15:08:14 +0200 | [diff] [blame] | 334 | } |
| 335 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 336 | static bool k8_mc0_mce(u16 ec, u8 xec) |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 337 | { |
| 338 | if (BUS_ERROR(ec)) { |
| 339 | pr_cont("during system linefill.\n"); |
| 340 | return true; |
| 341 | } |
| 342 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 343 | return f10h_mc0_mce(ec, xec); |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 344 | } |
| 345 | |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 346 | static bool cat_mc0_mce(u16 ec, u8 xec) |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 347 | { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 348 | u8 r4 = R4(ec); |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 349 | bool ret = true; |
| 350 | |
| 351 | if (MEM_ERROR(ec)) { |
| 352 | |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 353 | if (TT(ec) != TT_DATA || LL(ec) != LL_L1) |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 354 | return false; |
| 355 | |
| 356 | switch (r4) { |
| 357 | case R4_DRD: |
| 358 | case R4_DWR: |
| 359 | pr_cont("Data/Tag parity error due to %s.\n", |
| 360 | (r4 == R4_DRD ? "load/hw prf" : "store")); |
| 361 | break; |
| 362 | case R4_EVICT: |
| 363 | pr_cont("Copyback parity error on a tag miss.\n"); |
| 364 | break; |
| 365 | case R4_SNOOP: |
| 366 | pr_cont("Tag parity error during snoop.\n"); |
| 367 | break; |
| 368 | default: |
| 369 | ret = false; |
| 370 | } |
| 371 | } else if (BUS_ERROR(ec)) { |
| 372 | |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 373 | if ((II(ec) != II_MEM && II(ec) != II_IO) || LL(ec) != LL_LG) |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 374 | return false; |
| 375 | |
| 376 | pr_cont("System read data error on a "); |
| 377 | |
| 378 | switch (r4) { |
| 379 | case R4_RD: |
| 380 | pr_cont("TLB reload.\n"); |
| 381 | break; |
| 382 | case R4_DWR: |
| 383 | pr_cont("store.\n"); |
| 384 | break; |
| 385 | case R4_DRD: |
| 386 | pr_cont("load.\n"); |
| 387 | break; |
| 388 | default: |
| 389 | ret = false; |
| 390 | } |
| 391 | } else { |
| 392 | ret = false; |
| 393 | } |
| 394 | |
| 395 | return ret; |
| 396 | } |
| 397 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 398 | static bool f15h_mc0_mce(u16 ec, u8 xec) |
Borislav Petkov | 25a4f8b | 2010-09-17 19:22:34 +0200 | [diff] [blame] | 399 | { |
| 400 | bool ret = true; |
| 401 | |
| 402 | if (MEM_ERROR(ec)) { |
| 403 | |
| 404 | switch (xec) { |
| 405 | case 0x0: |
| 406 | pr_cont("Data Array access error.\n"); |
| 407 | break; |
| 408 | |
| 409 | case 0x1: |
| 410 | pr_cont("UC error during a linefill from L2/NB.\n"); |
| 411 | break; |
| 412 | |
| 413 | case 0x2: |
| 414 | case 0x11: |
| 415 | pr_cont("STQ access error.\n"); |
| 416 | break; |
| 417 | |
| 418 | case 0x3: |
| 419 | pr_cont("SCB access error.\n"); |
| 420 | break; |
| 421 | |
| 422 | case 0x10: |
| 423 | pr_cont("Tag error.\n"); |
| 424 | break; |
| 425 | |
| 426 | case 0x12: |
| 427 | pr_cont("LDQ access error.\n"); |
| 428 | break; |
| 429 | |
| 430 | default: |
| 431 | ret = false; |
| 432 | } |
| 433 | } else if (BUS_ERROR(ec)) { |
| 434 | |
| 435 | if (!xec) |
Borislav Petkov | 344f0a0 | 2011-11-15 17:10:58 +0100 | [diff] [blame] | 436 | pr_cont("System Read Data Error.\n"); |
Borislav Petkov | 25a4f8b | 2010-09-17 19:22:34 +0200 | [diff] [blame] | 437 | else |
Borislav Petkov | 344f0a0 | 2011-11-15 17:10:58 +0100 | [diff] [blame] | 438 | pr_cont(" Internal error condition type %d.\n", xec); |
Aravind Gopalakrishnan | eba4bfb | 2014-07-14 16:58:19 +0200 | [diff] [blame] | 439 | } else if (INT_ERROR(ec)) { |
| 440 | if (xec <= 0x1f) |
| 441 | pr_cont("Hardware Assert.\n"); |
| 442 | else |
| 443 | ret = false; |
| 444 | |
Borislav Petkov | 25a4f8b | 2010-09-17 19:22:34 +0200 | [diff] [blame] | 445 | } else |
| 446 | ret = false; |
| 447 | |
| 448 | return ret; |
| 449 | } |
| 450 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 451 | static void decode_mc0_mce(struct mce *m) |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 452 | { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 453 | u16 ec = EC(m->status); |
| 454 | u8 xec = XEC(m->status, xec_mask); |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 455 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 456 | pr_emerg(HW_ERR "MC0 Error: "); |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 457 | |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 458 | /* TLB error signatures are the same across families */ |
| 459 | if (TLB_ERROR(ec)) { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 460 | if (TT(ec) == TT_DATA) { |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 461 | pr_cont("%s TLB %s.\n", LL_MSG(ec), |
Borislav Petkov | 25a4f8b | 2010-09-17 19:22:34 +0200 | [diff] [blame] | 462 | ((xec == 2) ? "locked miss" |
| 463 | : (xec ? "multimatch" : "parity"))); |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 464 | return; |
| 465 | } |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 466 | } else if (fam_ops->mc0_mce(ec, xec)) |
Borislav Petkov | 25a4f8b | 2010-09-17 19:22:34 +0200 | [diff] [blame] | 467 | ; |
| 468 | else |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 469 | pr_emerg(HW_ERR "Corrupted MC0 MCE info?\n"); |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 470 | } |
| 471 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 472 | static bool k8_mc1_mce(u16 ec, u8 xec) |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 473 | { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 474 | u8 ll = LL(ec); |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 475 | bool ret = true; |
| 476 | |
| 477 | if (!MEM_ERROR(ec)) |
| 478 | return false; |
| 479 | |
| 480 | if (ll == 0x2) |
| 481 | pr_cont("during a linefill from L2.\n"); |
| 482 | else if (ll == 0x1) { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 483 | switch (R4(ec)) { |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 484 | case R4_IRD: |
| 485 | pr_cont("Parity error during data load.\n"); |
| 486 | break; |
| 487 | |
| 488 | case R4_EVICT: |
| 489 | pr_cont("Copyback Parity/Victim error.\n"); |
| 490 | break; |
| 491 | |
| 492 | case R4_SNOOP: |
| 493 | pr_cont("Tag Snoop error.\n"); |
| 494 | break; |
| 495 | |
| 496 | default: |
| 497 | ret = false; |
| 498 | break; |
| 499 | } |
| 500 | } else |
| 501 | ret = false; |
| 502 | |
| 503 | return ret; |
| 504 | } |
| 505 | |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 506 | static bool cat_mc1_mce(u16 ec, u8 xec) |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 507 | { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 508 | u8 r4 = R4(ec); |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 509 | bool ret = true; |
| 510 | |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 511 | if (!MEM_ERROR(ec)) |
| 512 | return false; |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 513 | |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 514 | if (TT(ec) != TT_INSTR) |
| 515 | return false; |
| 516 | |
| 517 | if (r4 == R4_IRD) |
| 518 | pr_cont("Data/tag array parity error for a tag hit.\n"); |
| 519 | else if (r4 == R4_SNOOP) |
| 520 | pr_cont("Tag error during snoop/victimization.\n"); |
| 521 | else if (xec == 0x0) |
| 522 | pr_cont("Tag parity error from victim castout.\n"); |
| 523 | else if (xec == 0x2) |
| 524 | pr_cont("Microcode patch RAM parity error.\n"); |
| 525 | else |
| 526 | ret = false; |
| 527 | |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 528 | return ret; |
| 529 | } |
| 530 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 531 | static bool f15h_mc1_mce(u16 ec, u8 xec) |
Borislav Petkov | 86039cd | 2010-11-08 15:03:35 +0100 | [diff] [blame] | 532 | { |
| 533 | bool ret = true; |
| 534 | |
| 535 | if (!MEM_ERROR(ec)) |
| 536 | return false; |
| 537 | |
| 538 | switch (xec) { |
| 539 | case 0x0 ... 0xa: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 540 | pr_cont("%s.\n", f15h_mc1_mce_desc[xec]); |
Borislav Petkov | 86039cd | 2010-11-08 15:03:35 +0100 | [diff] [blame] | 541 | break; |
| 542 | |
| 543 | case 0xd: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 544 | pr_cont("%s.\n", f15h_mc1_mce_desc[xec-2]); |
Borislav Petkov | 86039cd | 2010-11-08 15:03:35 +0100 | [diff] [blame] | 545 | break; |
| 546 | |
Borislav Petkov | 6c1173a | 2011-11-21 19:45:34 +0100 | [diff] [blame] | 547 | case 0x10: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 548 | pr_cont("%s.\n", f15h_mc1_mce_desc[xec-4]); |
Borislav Petkov | 6c1173a | 2011-11-21 19:45:34 +0100 | [diff] [blame] | 549 | break; |
| 550 | |
Aravind Gopalakrishnan | eba4bfb | 2014-07-14 16:58:19 +0200 | [diff] [blame] | 551 | case 0x11 ... 0x15: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 552 | pr_cont("Decoder %s parity error.\n", f15h_mc1_mce_desc[xec-4]); |
Borislav Petkov | 86039cd | 2010-11-08 15:03:35 +0100 | [diff] [blame] | 553 | break; |
| 554 | |
| 555 | default: |
| 556 | ret = false; |
| 557 | } |
| 558 | return ret; |
| 559 | } |
| 560 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 561 | static void decode_mc1_mce(struct mce *m) |
Borislav Petkov | ab5535e | 2009-07-28 14:06:26 +0200 | [diff] [blame] | 562 | { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 563 | u16 ec = EC(m->status); |
| 564 | u8 xec = XEC(m->status, xec_mask); |
Borislav Petkov | ab5535e | 2009-07-28 14:06:26 +0200 | [diff] [blame] | 565 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 566 | pr_emerg(HW_ERR "MC1 Error: "); |
Borislav Petkov | ab5535e | 2009-07-28 14:06:26 +0200 | [diff] [blame] | 567 | |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 568 | if (TLB_ERROR(ec)) |
| 569 | pr_cont("%s TLB %s.\n", LL_MSG(ec), |
| 570 | (xec ? "multimatch" : "parity error")); |
| 571 | else if (BUS_ERROR(ec)) { |
Borislav Petkov | 525906b | 2010-10-15 15:27:02 +0200 | [diff] [blame] | 572 | bool k8 = (boot_cpu_data.x86 == 0xf && (m->status & BIT_64(58))); |
Borislav Petkov | ab5535e | 2009-07-28 14:06:26 +0200 | [diff] [blame] | 573 | |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 574 | pr_cont("during %s.\n", (k8 ? "system linefill" : "NB data read")); |
Aravind Gopalakrishnan | eba4bfb | 2014-07-14 16:58:19 +0200 | [diff] [blame] | 575 | } else if (INT_ERROR(ec)) { |
| 576 | if (xec <= 0x3f) |
| 577 | pr_cont("Hardware Assert.\n"); |
| 578 | else |
| 579 | goto wrong_mc1_mce; |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 580 | } else if (fam_ops->mc1_mce(ec, xec)) |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 581 | ; |
| 582 | else |
Aravind Gopalakrishnan | eba4bfb | 2014-07-14 16:58:19 +0200 | [diff] [blame] | 583 | goto wrong_mc1_mce; |
| 584 | |
| 585 | return; |
| 586 | |
| 587 | wrong_mc1_mce: |
| 588 | pr_emerg(HW_ERR "Corrupted MC1 MCE info?\n"); |
Borislav Petkov | ab5535e | 2009-07-28 14:06:26 +0200 | [diff] [blame] | 589 | } |
| 590 | |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 591 | static bool k8_mc2_mce(u16 ec, u8 xec) |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 592 | { |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 593 | bool ret = true; |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 594 | |
| 595 | if (xec == 0x1) |
| 596 | pr_cont(" in the write data buffers.\n"); |
| 597 | else if (xec == 0x3) |
| 598 | pr_cont(" in the victim data buffers.\n"); |
| 599 | else if (xec == 0x2 && MEM_ERROR(ec)) |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 600 | pr_cont(": %s error in the L2 cache tags.\n", R4_MSG(ec)); |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 601 | else if (xec == 0x0) { |
| 602 | if (TLB_ERROR(ec)) |
Borislav Petkov | 50872cc | 2014-11-22 13:41:01 +0100 | [diff] [blame] | 603 | pr_cont("%s error in a Page Descriptor Cache or Guest TLB.\n", |
| 604 | TT_MSG(ec)); |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 605 | else if (BUS_ERROR(ec)) |
| 606 | pr_cont(": %s/ECC error in data read from NB: %s.\n", |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 607 | R4_MSG(ec), PP_MSG(ec)); |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 608 | else if (MEM_ERROR(ec)) { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 609 | u8 r4 = R4(ec); |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 610 | |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 611 | if (r4 >= 0x7) |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 612 | pr_cont(": %s error during data copyback.\n", |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 613 | R4_MSG(ec)); |
| 614 | else if (r4 <= 0x1) |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 615 | pr_cont(": %s parity/ECC error during data " |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 616 | "access from L2.\n", R4_MSG(ec)); |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 617 | else |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 618 | ret = false; |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 619 | } else |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 620 | ret = false; |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 621 | } else |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 622 | ret = false; |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 623 | |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 624 | return ret; |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 625 | } |
| 626 | |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 627 | static bool f15h_mc2_mce(u16 ec, u8 xec) |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 628 | { |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 629 | bool ret = true; |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 630 | |
| 631 | if (TLB_ERROR(ec)) { |
| 632 | if (xec == 0x0) |
| 633 | pr_cont("Data parity TLB read error.\n"); |
| 634 | else if (xec == 0x1) |
| 635 | pr_cont("Poison data provided for TLB fill.\n"); |
| 636 | else |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 637 | ret = false; |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 638 | } else if (BUS_ERROR(ec)) { |
| 639 | if (xec > 2) |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 640 | ret = false; |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 641 | |
| 642 | pr_cont("Error during attempted NB data read.\n"); |
| 643 | } else if (MEM_ERROR(ec)) { |
| 644 | switch (xec) { |
| 645 | case 0x4 ... 0xc: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 646 | pr_cont("%s.\n", f15h_mc2_mce_desc[xec - 0x4]); |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 647 | break; |
| 648 | |
| 649 | case 0x10 ... 0x14: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 650 | pr_cont("%s.\n", f15h_mc2_mce_desc[xec - 0x7]); |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 651 | break; |
| 652 | |
| 653 | default: |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 654 | ret = false; |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 655 | } |
Aravind Gopalakrishnan | eba4bfb | 2014-07-14 16:58:19 +0200 | [diff] [blame] | 656 | } else if (INT_ERROR(ec)) { |
| 657 | if (xec <= 0x3f) |
| 658 | pr_cont("Hardware Assert.\n"); |
| 659 | else |
| 660 | ret = false; |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 661 | } |
| 662 | |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 663 | return ret; |
| 664 | } |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 665 | |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 666 | static bool f16h_mc2_mce(u16 ec, u8 xec) |
| 667 | { |
| 668 | u8 r4 = R4(ec); |
| 669 | |
| 670 | if (!MEM_ERROR(ec)) |
| 671 | return false; |
| 672 | |
| 673 | switch (xec) { |
| 674 | case 0x04 ... 0x05: |
| 675 | pr_cont("%cBUFF parity error.\n", (r4 == R4_RD) ? 'I' : 'O'); |
| 676 | break; |
| 677 | |
| 678 | case 0x09 ... 0x0b: |
| 679 | case 0x0d ... 0x0f: |
| 680 | pr_cont("ECC error in L2 tag (%s).\n", |
| 681 | ((r4 == R4_GEN) ? "BankReq" : |
| 682 | ((r4 == R4_SNOOP) ? "Prb" : "Fill"))); |
| 683 | break; |
| 684 | |
| 685 | case 0x10 ... 0x19: |
| 686 | case 0x1b: |
| 687 | pr_cont("ECC error in L2 data array (%s).\n", |
| 688 | (((r4 == R4_RD) && !(xec & 0x3)) ? "Hit" : |
| 689 | ((r4 == R4_GEN) ? "Attr" : |
| 690 | ((r4 == R4_EVICT) ? "Vict" : "Fill")))); |
| 691 | break; |
| 692 | |
| 693 | case 0x1c ... 0x1d: |
| 694 | case 0x1f: |
| 695 | pr_cont("Parity error in L2 attribute bits (%s).\n", |
| 696 | ((r4 == R4_RD) ? "Hit" : |
| 697 | ((r4 == R4_GEN) ? "Attr" : "Fill"))); |
| 698 | break; |
| 699 | |
| 700 | default: |
| 701 | return false; |
| 702 | } |
| 703 | |
| 704 | return true; |
| 705 | } |
| 706 | |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 707 | static void decode_mc2_mce(struct mce *m) |
| 708 | { |
| 709 | u16 ec = EC(m->status); |
| 710 | u8 xec = XEC(m->status, xec_mask); |
| 711 | |
| 712 | pr_emerg(HW_ERR "MC2 Error: "); |
| 713 | |
| 714 | if (!fam_ops->mc2_mce(ec, xec)) |
| 715 | pr_cont(HW_ERR "Corrupted MC2 MCE info?\n"); |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 716 | } |
| 717 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 718 | static void decode_mc3_mce(struct mce *m) |
Borislav Petkov | f9350ef | 2009-07-28 14:17:30 +0200 | [diff] [blame] | 719 | { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 720 | u16 ec = EC(m->status); |
| 721 | u8 xec = XEC(m->status, xec_mask); |
Borislav Petkov | ded5062 | 2010-08-27 17:03:34 +0200 | [diff] [blame] | 722 | |
Borislav Petkov | b18434c | 2010-09-22 11:53:32 +0200 | [diff] [blame] | 723 | if (boot_cpu_data.x86 >= 0x14) { |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 724 | pr_emerg("You shouldn't be seeing MC3 MCE on this cpu family," |
Borislav Petkov | ded5062 | 2010-08-27 17:03:34 +0200 | [diff] [blame] | 725 | " please report on LKML.\n"); |
| 726 | return; |
| 727 | } |
Borislav Petkov | f9350ef | 2009-07-28 14:17:30 +0200 | [diff] [blame] | 728 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 729 | pr_emerg(HW_ERR "MC3 Error"); |
Borislav Petkov | f9350ef | 2009-07-28 14:17:30 +0200 | [diff] [blame] | 730 | |
| 731 | if (xec == 0x0) { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 732 | u8 r4 = R4(ec); |
Borislav Petkov | f9350ef | 2009-07-28 14:17:30 +0200 | [diff] [blame] | 733 | |
Borislav Petkov | ded5062 | 2010-08-27 17:03:34 +0200 | [diff] [blame] | 734 | if (!BUS_ERROR(ec) || (r4 != R4_DRD && r4 != R4_DWR)) |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 735 | goto wrong_mc3_mce; |
Borislav Petkov | f9350ef | 2009-07-28 14:17:30 +0200 | [diff] [blame] | 736 | |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 737 | pr_cont(" during %s.\n", R4_MSG(ec)); |
Borislav Petkov | ded5062 | 2010-08-27 17:03:34 +0200 | [diff] [blame] | 738 | } else |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 739 | goto wrong_mc3_mce; |
Borislav Petkov | ded5062 | 2010-08-27 17:03:34 +0200 | [diff] [blame] | 740 | |
Borislav Petkov | f9350ef | 2009-07-28 14:17:30 +0200 | [diff] [blame] | 741 | return; |
| 742 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 743 | wrong_mc3_mce: |
| 744 | pr_emerg(HW_ERR "Corrupted MC3 MCE info?\n"); |
Borislav Petkov | f9350ef | 2009-07-28 14:17:30 +0200 | [diff] [blame] | 745 | } |
| 746 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 747 | static void decode_mc4_mce(struct mce *m) |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 748 | { |
Borislav Petkov | f3c0891 | 2017-07-25 11:07:03 +0200 | [diff] [blame] | 749 | unsigned int fam = x86_family(m->cpuid); |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 750 | int node_id = amd_get_nb_id(m->extcpu); |
| 751 | u16 ec = EC(m->status); |
| 752 | u8 xec = XEC(m->status, 0x1f); |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 753 | u8 offset = 0; |
| 754 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 755 | pr_emerg(HW_ERR "MC4 Error (node %d): ", node_id); |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 756 | |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 757 | switch (xec) { |
| 758 | case 0x0 ... 0xe: |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 759 | |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 760 | /* special handling for DRAM ECCs */ |
| 761 | if (xec == 0x0 || xec == 0x8) { |
| 762 | /* no ECCs on F11h */ |
Borislav Petkov | f3c0891 | 2017-07-25 11:07:03 +0200 | [diff] [blame] | 763 | if (fam == 0x11) |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 764 | goto wrong_mc4_mce; |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 765 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 766 | pr_cont("%s.\n", mc4_mce_desc[xec]); |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 767 | |
Yazen Ghannam | 5c33220 | 2016-11-17 17:57:29 -0500 | [diff] [blame] | 768 | if (decode_dram_ecc) |
| 769 | decode_dram_ecc(node_id, m); |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 770 | return; |
| 771 | } |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 772 | break; |
| 773 | |
| 774 | case 0xf: |
| 775 | if (TLB_ERROR(ec)) |
| 776 | pr_cont("GART Table Walk data error.\n"); |
| 777 | else if (BUS_ERROR(ec)) |
| 778 | pr_cont("DMA Exclusion Vector Table Walk error.\n"); |
| 779 | else |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 780 | goto wrong_mc4_mce; |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 781 | return; |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 782 | |
Borislav Petkov | 05cd667 | 2010-09-22 15:06:24 +0200 | [diff] [blame] | 783 | case 0x19: |
Borislav Petkov | f3c0891 | 2017-07-25 11:07:03 +0200 | [diff] [blame] | 784 | if (fam == 0x15 || fam == 0x16) |
Borislav Petkov | 05cd667 | 2010-09-22 15:06:24 +0200 | [diff] [blame] | 785 | pr_cont("Compute Unit Data Error.\n"); |
| 786 | else |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 787 | goto wrong_mc4_mce; |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 788 | return; |
Borislav Petkov | 05cd667 | 2010-09-22 15:06:24 +0200 | [diff] [blame] | 789 | |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 790 | case 0x1c ... 0x1f: |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 791 | offset = 13; |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 792 | break; |
| 793 | |
| 794 | default: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 795 | goto wrong_mc4_mce; |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 796 | } |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 797 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 798 | pr_cont("%s.\n", mc4_mce_desc[xec - offset]); |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 799 | return; |
| 800 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 801 | wrong_mc4_mce: |
| 802 | pr_emerg(HW_ERR "Corrupted MC4 MCE info?\n"); |
Borislav Petkov | d93cc22 | 2009-07-28 10:56:15 +0200 | [diff] [blame] | 803 | } |
Borislav Petkov | d93cc22 | 2009-07-28 10:56:15 +0200 | [diff] [blame] | 804 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 805 | static void decode_mc5_mce(struct mce *m) |
Borislav Petkov | 53bd5fe | 2009-07-28 14:20:46 +0200 | [diff] [blame] | 806 | { |
Borislav Petkov | f3c0891 | 2017-07-25 11:07:03 +0200 | [diff] [blame] | 807 | unsigned int fam = x86_family(m->cpuid); |
Aravind Gopalakrishnan | eba4bfb | 2014-07-14 16:58:19 +0200 | [diff] [blame] | 808 | u16 ec = EC(m->status); |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 809 | u8 xec = XEC(m->status, xec_mask); |
Borislav Petkov | 8259a7e | 2010-09-22 15:28:59 +0200 | [diff] [blame] | 810 | |
Borislav Petkov | f3c0891 | 2017-07-25 11:07:03 +0200 | [diff] [blame] | 811 | if (fam == 0xf || fam == 0x11) |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 812 | goto wrong_mc5_mce; |
Borislav Petkov | fe4ea26 | 2010-08-31 18:38:24 +0200 | [diff] [blame] | 813 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 814 | pr_emerg(HW_ERR "MC5 Error: "); |
Borislav Petkov | 8259a7e | 2010-09-22 15:28:59 +0200 | [diff] [blame] | 815 | |
Aravind Gopalakrishnan | eba4bfb | 2014-07-14 16:58:19 +0200 | [diff] [blame] | 816 | if (INT_ERROR(ec)) { |
| 817 | if (xec <= 0x1f) { |
| 818 | pr_cont("Hardware Assert.\n"); |
| 819 | return; |
| 820 | } else |
| 821 | goto wrong_mc5_mce; |
| 822 | } |
| 823 | |
Borislav Petkov | 8259a7e | 2010-09-22 15:28:59 +0200 | [diff] [blame] | 824 | if (xec == 0x0 || xec == 0xc) |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 825 | pr_cont("%s.\n", mc5_mce_desc[xec]); |
Aravind Gopalakrishnan | aad19e5 | 2013-06-05 15:50:03 -0500 | [diff] [blame] | 826 | else if (xec <= 0xd) |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 827 | pr_cont("%s parity error.\n", mc5_mce_desc[xec]); |
Borislav Petkov | 8259a7e | 2010-09-22 15:28:59 +0200 | [diff] [blame] | 828 | else |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 829 | goto wrong_mc5_mce; |
Borislav Petkov | 8259a7e | 2010-09-22 15:28:59 +0200 | [diff] [blame] | 830 | |
| 831 | return; |
Borislav Petkov | fe4ea26 | 2010-08-31 18:38:24 +0200 | [diff] [blame] | 832 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 833 | wrong_mc5_mce: |
| 834 | pr_emerg(HW_ERR "Corrupted MC5 MCE info?\n"); |
Borislav Petkov | 53bd5fe | 2009-07-28 14:20:46 +0200 | [diff] [blame] | 835 | } |
| 836 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 837 | static void decode_mc6_mce(struct mce *m) |
Borislav Petkov | b8f85c4 | 2010-09-22 15:37:58 +0200 | [diff] [blame] | 838 | { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 839 | u8 xec = XEC(m->status, xec_mask); |
Borislav Petkov | b8f85c4 | 2010-09-22 15:37:58 +0200 | [diff] [blame] | 840 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 841 | pr_emerg(HW_ERR "MC6 Error: "); |
Borislav Petkov | b8f85c4 | 2010-09-22 15:37:58 +0200 | [diff] [blame] | 842 | |
Aravind Gopalakrishnan | bc4febe | 2014-11-04 11:41:08 -0600 | [diff] [blame] | 843 | if (xec > 0x5) |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 844 | goto wrong_mc6_mce; |
Borislav Petkov | b8f85c4 | 2010-09-22 15:37:58 +0200 | [diff] [blame] | 845 | |
Aravind Gopalakrishnan | bc4febe | 2014-11-04 11:41:08 -0600 | [diff] [blame] | 846 | pr_cont("%s parity error.\n", mc6_mce_desc[xec]); |
Borislav Petkov | b8f85c4 | 2010-09-22 15:37:58 +0200 | [diff] [blame] | 847 | return; |
| 848 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 849 | wrong_mc6_mce: |
| 850 | pr_emerg(HW_ERR "Corrupted MC6 MCE info?\n"); |
Borislav Petkov | b8f85c4 | 2010-09-22 15:37:58 +0200 | [diff] [blame] | 851 | } |
| 852 | |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 853 | /* Decode errors according to Scalable MCA specification */ |
Borislav Petkov | 4ab1784 | 2017-07-25 10:44:59 +0200 | [diff] [blame] | 854 | static void decode_smca_error(struct mce *m) |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 855 | { |
Borislav Petkov | 1ce9cd7 | 2016-11-02 12:48:01 +0100 | [diff] [blame] | 856 | struct smca_hwid *hwid; |
Yazen Ghannam | 5896820 | 2016-09-12 09:59:34 +0200 | [diff] [blame] | 857 | unsigned int bank_type; |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 858 | const char *ip_name; |
Yazen Ghannam | 5896820 | 2016-09-12 09:59:34 +0200 | [diff] [blame] | 859 | u8 xec = XEC(m->status, xec_mask); |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 860 | |
Yazen Ghannam | 5896820 | 2016-09-12 09:59:34 +0200 | [diff] [blame] | 861 | if (m->bank >= ARRAY_SIZE(smca_banks)) |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 862 | return; |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 863 | |
Borislav Petkov | f3c0891 | 2017-07-25 11:07:03 +0200 | [diff] [blame] | 864 | if (x86_family(m->cpuid) >= 0x17 && m->bank == 4) |
Yazen Ghannam | a884675 | 2016-09-12 09:59:40 +0200 | [diff] [blame] | 865 | pr_emerg(HW_ERR "Bank 4 is reserved on Fam17h.\n"); |
| 866 | |
Borislav Petkov | 1ce9cd7 | 2016-11-02 12:48:01 +0100 | [diff] [blame] | 867 | hwid = smca_banks[m->bank].hwid; |
| 868 | if (!hwid) |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 869 | return; |
Yazen Ghannam | 5896820 | 2016-09-12 09:59:34 +0200 | [diff] [blame] | 870 | |
Borislav Petkov | 1ce9cd7 | 2016-11-02 12:48:01 +0100 | [diff] [blame] | 871 | bank_type = hwid->bank_type; |
Borislav Petkov | c09a8c4 | 2016-11-03 21:12:33 +0100 | [diff] [blame] | 872 | ip_name = smca_get_long_name(bank_type); |
Yazen Ghannam | 5896820 | 2016-09-12 09:59:34 +0200 | [diff] [blame] | 873 | |
| 874 | pr_emerg(HW_ERR "%s Extended Error Code: %d\n", ip_name, xec); |
| 875 | |
| 876 | /* Only print the decode of valid error codes */ |
| 877 | if (xec < smca_mce_descs[bank_type].num_descs && |
Borislav Petkov | 1ce9cd7 | 2016-11-02 12:48:01 +0100 | [diff] [blame] | 878 | (hwid->xec_bitmap & BIT_ULL(xec))) { |
Yazen Ghannam | 5896820 | 2016-09-12 09:59:34 +0200 | [diff] [blame] | 879 | pr_emerg(HW_ERR "%s Error: ", ip_name); |
| 880 | pr_cont("%s.\n", smca_mce_descs[bank_type].descs[xec]); |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 881 | } |
Yazen Ghannam | 5c33220 | 2016-11-17 17:57:29 -0500 | [diff] [blame] | 882 | |
Yazen Ghannam | 5c33220 | 2016-11-17 17:57:29 -0500 | [diff] [blame] | 883 | if (bank_type == SMCA_UMC && xec == 0 && decode_dram_ecc) |
Yazen Ghannam | fbe63ac | 2017-03-20 15:26:51 -0500 | [diff] [blame] | 884 | decode_dram_ecc(cpu_to_node(m->extcpu), m); |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 885 | } |
| 886 | |
Borislav Petkov | 6337583 | 2010-09-06 18:13:39 +0200 | [diff] [blame] | 887 | static inline void amd_decode_err_code(u16 ec) |
Borislav Petkov | d93cc22 | 2009-07-28 10:56:15 +0200 | [diff] [blame] | 888 | { |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 889 | if (INT_ERROR(ec)) { |
| 890 | pr_emerg(HW_ERR "internal: %s\n", UU_MSG(ec)); |
| 891 | return; |
| 892 | } |
Borislav Petkov | fa7ae8c | 2010-09-22 17:42:27 +0200 | [diff] [blame] | 893 | |
| 894 | pr_emerg(HW_ERR "cache level: %s", LL_MSG(ec)); |
| 895 | |
| 896 | if (BUS_ERROR(ec)) |
| 897 | pr_cont(", mem/io: %s", II_MSG(ec)); |
| 898 | else |
| 899 | pr_cont(", tx: %s", TT_MSG(ec)); |
| 900 | |
| 901 | if (MEM_ERROR(ec) || BUS_ERROR(ec)) { |
| 902 | pr_cont(", mem-tx: %s", R4_MSG(ec)); |
| 903 | |
| 904 | if (BUS_ERROR(ec)) |
| 905 | pr_cont(", part-proc: %s (%s)", PP_MSG(ec), TO_MSG(ec)); |
| 906 | } |
| 907 | |
| 908 | pr_cont("\n"); |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 909 | } |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 910 | |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 911 | /* |
| 912 | * Filter out unwanted MCE signatures here. |
| 913 | */ |
| 914 | static bool amd_filter_mce(struct mce *m) |
| 915 | { |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 916 | /* |
| 917 | * NB GART TLB error reporting is disabled by default. |
| 918 | */ |
Borislav Petkov | 3984434 | 2017-07-25 11:09:56 +0200 | [diff] [blame] | 919 | if (m->bank == 4 && XEC(m->status, 0x1f) == 0x5 && !report_gart_errors) |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 920 | return true; |
| 921 | |
| 922 | return false; |
| 923 | } |
| 924 | |
Borislav Petkov | d5c6770 | 2012-09-14 20:25:37 +0200 | [diff] [blame] | 925 | static const char *decode_error_status(struct mce *m) |
| 926 | { |
| 927 | if (m->status & MCI_STATUS_UC) { |
| 928 | if (m->status & MCI_STATUS_PCC) |
| 929 | return "System Fatal error."; |
| 930 | if (m->mcgstatus & MCG_STATUS_RIPV) |
| 931 | return "Uncorrected, software restartable error."; |
| 932 | return "Uncorrected, software containable error."; |
| 933 | } |
| 934 | |
| 935 | if (m->status & MCI_STATUS_DEFERRED) |
Yazen Ghannam | 67d7fd3 | 2017-01-24 16:32:23 -0600 | [diff] [blame] | 936 | return "Deferred error, no action required."; |
Borislav Petkov | d5c6770 | 2012-09-14 20:25:37 +0200 | [diff] [blame] | 937 | |
| 938 | return "Corrected error, no action required."; |
| 939 | } |
| 940 | |
Borislav Petkov | 1fbcd90 | 2017-01-23 19:35:11 +0100 | [diff] [blame] | 941 | static int |
| 942 | amd_decode_mce(struct notifier_block *nb, unsigned long val, void *data) |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 943 | { |
Borislav Petkov | fb25319 | 2009-10-07 13:20:38 +0200 | [diff] [blame] | 944 | struct mce *m = (struct mce *)data; |
Borislav Petkov | f3c0891 | 2017-07-25 11:07:03 +0200 | [diff] [blame] | 945 | unsigned int fam = x86_family(m->cpuid); |
Borislav Petkov | b0b07a2 | 2011-08-24 18:44:22 +0200 | [diff] [blame] | 946 | int ecc; |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 947 | |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 948 | if (amd_filter_mce(m)) |
| 949 | return NOTIFY_STOP; |
| 950 | |
Borislav Petkov | fd0f5fff | 2014-02-17 20:51:52 +0100 | [diff] [blame] | 951 | pr_emerg(HW_ERR "%s\n", decode_error_status(m)); |
| 952 | |
| 953 | pr_emerg(HW_ERR "CPU:%d (%x:%x:%x) MC%d_STATUS[%s|%s|%s|%s|%s", |
| 954 | m->extcpu, |
Borislav Petkov | f3c0891 | 2017-07-25 11:07:03 +0200 | [diff] [blame] | 955 | fam, x86_model(m->cpuid), x86_stepping(m->cpuid), |
Borislav Petkov | fd0f5fff | 2014-02-17 20:51:52 +0100 | [diff] [blame] | 956 | m->bank, |
| 957 | ((m->status & MCI_STATUS_OVER) ? "Over" : "-"), |
Aravind Gopalakrishnan | 99e1dfb | 2015-07-13 06:53:02 -0500 | [diff] [blame] | 958 | ((m->status & MCI_STATUS_UC) ? "UE" : |
| 959 | (m->status & MCI_STATUS_DEFERRED) ? "-" : "CE"), |
Borislav Petkov | fd0f5fff | 2014-02-17 20:51:52 +0100 | [diff] [blame] | 960 | ((m->status & MCI_STATUS_MISCV) ? "MiscV" : "-"), |
| 961 | ((m->status & MCI_STATUS_PCC) ? "PCC" : "-"), |
| 962 | ((m->status & MCI_STATUS_ADDRV) ? "AddrV" : "-")); |
| 963 | |
Borislav Petkov | f3c0891 | 2017-07-25 11:07:03 +0200 | [diff] [blame] | 964 | if (fam >= 0x15) { |
Yazen Ghannam | a6c14dc | 2016-11-18 09:10:22 -0500 | [diff] [blame] | 965 | pr_cont("|%s", (m->status & MCI_STATUS_DEFERRED ? "Deferred" : "-")); |
| 966 | |
| 967 | /* F15h, bank4, bit 43 is part of McaStatSubCache. */ |
Borislav Petkov | f3c0891 | 2017-07-25 11:07:03 +0200 | [diff] [blame] | 968 | if (fam != 0x15 || m->bank != 4) |
Yazen Ghannam | a6c14dc | 2016-11-18 09:10:22 -0500 | [diff] [blame] | 969 | pr_cont("|%s", (m->status & MCI_STATUS_POISON ? "Poison" : "-")); |
| 970 | } |
Borislav Petkov | fd0f5fff | 2014-02-17 20:51:52 +0100 | [diff] [blame] | 971 | |
Yazen Ghannam | a348ed8 | 2016-05-11 14:58:28 +0200 | [diff] [blame] | 972 | if (boot_cpu_has(X86_FEATURE_SMCA)) { |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 973 | u32 low, high; |
| 974 | u32 addr = MSR_AMD64_SMCA_MCx_CONFIG(m->bank); |
| 975 | |
Yazen Ghannam | b300e87 | 2016-09-12 09:59:29 +0200 | [diff] [blame] | 976 | pr_cont("|%s", ((m->status & MCI_STATUS_SYNDV) ? "SyndV" : "-")); |
| 977 | |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 978 | if (!rdmsr_safe(addr, &low, &high) && |
| 979 | (low & MCI_CONFIG_MCAX)) |
| 980 | pr_cont("|%s", ((m->status & MCI_STATUS_TCC) ? "TCC" : "-")); |
| 981 | } |
| 982 | |
Borislav Petkov | fd0f5fff | 2014-02-17 20:51:52 +0100 | [diff] [blame] | 983 | /* do the two bits[14:13] together */ |
| 984 | ecc = (m->status >> 45) & 0x3; |
| 985 | if (ecc) |
| 986 | pr_cont("|%sECC", ((ecc == 2) ? "C" : "U")); |
| 987 | |
| 988 | pr_cont("]: 0x%016llx\n", m->status); |
| 989 | |
| 990 | if (m->status & MCI_STATUS_ADDRV) |
Yazen Ghannam | 75bf2f6 | 2017-02-15 14:56:22 -0600 | [diff] [blame] | 991 | pr_emerg(HW_ERR "Error Addr: 0x%016llx\n", m->addr); |
Borislav Petkov | fd0f5fff | 2014-02-17 20:51:52 +0100 | [diff] [blame] | 992 | |
Yazen Ghannam | a348ed8 | 2016-05-11 14:58:28 +0200 | [diff] [blame] | 993 | if (boot_cpu_has(X86_FEATURE_SMCA)) { |
Yazen Ghannam | 75bf2f6 | 2017-02-15 14:56:22 -0600 | [diff] [blame] | 994 | pr_emerg(HW_ERR "IPID: 0x%016llx", m->ipid); |
| 995 | |
Yazen Ghannam | b300e87 | 2016-09-12 09:59:29 +0200 | [diff] [blame] | 996 | if (m->status & MCI_STATUS_SYNDV) |
| 997 | pr_cont(", Syndrome: 0x%016llx", m->synd); |
| 998 | |
| 999 | pr_cont("\n"); |
| 1000 | |
Borislav Petkov | 4ab1784 | 2017-07-25 10:44:59 +0200 | [diff] [blame] | 1001 | decode_smca_error(m); |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 1002 | goto err_code; |
Yazen Ghannam | 75bf2f6 | 2017-02-15 14:56:22 -0600 | [diff] [blame] | 1003 | } |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 1004 | |
Borislav Petkov | 0bceab6 | 2017-01-23 19:35:12 +0100 | [diff] [blame] | 1005 | if (m->tsc) |
| 1006 | pr_emerg(HW_ERR "TSC: %llu\n", m->tsc); |
| 1007 | |
Borislav Petkov | fd0f5fff | 2014-02-17 20:51:52 +0100 | [diff] [blame] | 1008 | if (!fam_ops) |
| 1009 | goto err_code; |
| 1010 | |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 1011 | switch (m->bank) { |
| 1012 | case 0: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 1013 | decode_mc0_mce(m); |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 1014 | break; |
Borislav Petkov | d93cc22 | 2009-07-28 10:56:15 +0200 | [diff] [blame] | 1015 | |
Borislav Petkov | ab5535e | 2009-07-28 14:06:26 +0200 | [diff] [blame] | 1016 | case 1: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 1017 | decode_mc1_mce(m); |
Borislav Petkov | ab5535e | 2009-07-28 14:06:26 +0200 | [diff] [blame] | 1018 | break; |
| 1019 | |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 1020 | case 2: |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 1021 | decode_mc2_mce(m); |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 1022 | break; |
| 1023 | |
Borislav Petkov | f9350ef | 2009-07-28 14:17:30 +0200 | [diff] [blame] | 1024 | case 3: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 1025 | decode_mc3_mce(m); |
Borislav Petkov | f9350ef | 2009-07-28 14:17:30 +0200 | [diff] [blame] | 1026 | break; |
| 1027 | |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 1028 | case 4: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 1029 | decode_mc4_mce(m); |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 1030 | break; |
| 1031 | |
Borislav Petkov | 53bd5fe | 2009-07-28 14:20:46 +0200 | [diff] [blame] | 1032 | case 5: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 1033 | decode_mc5_mce(m); |
Borislav Petkov | 53bd5fe | 2009-07-28 14:20:46 +0200 | [diff] [blame] | 1034 | break; |
| 1035 | |
Borislav Petkov | b8f85c4 | 2010-09-22 15:37:58 +0200 | [diff] [blame] | 1036 | case 6: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 1037 | decode_mc6_mce(m); |
Borislav Petkov | b8f85c4 | 2010-09-22 15:37:58 +0200 | [diff] [blame] | 1038 | break; |
| 1039 | |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 1040 | default: |
| 1041 | break; |
Borislav Petkov | b69b29d | 2009-07-27 16:21:14 +0200 | [diff] [blame] | 1042 | } |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 1043 | |
Borislav Petkov | fd0f5fff | 2014-02-17 20:51:52 +0100 | [diff] [blame] | 1044 | err_code: |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 1045 | amd_decode_err_code(m->status & 0xffff); |
Borislav Petkov | fb25319 | 2009-10-07 13:20:38 +0200 | [diff] [blame] | 1046 | |
| 1047 | return NOTIFY_STOP; |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 1048 | } |
Ingo Molnar | f436f8b | 2009-10-01 16:14:32 +0200 | [diff] [blame] | 1049 | |
Borislav Petkov | fb25319 | 2009-10-07 13:20:38 +0200 | [diff] [blame] | 1050 | static struct notifier_block amd_mce_dec_nb = { |
| 1051 | .notifier_call = amd_decode_mce, |
Borislav Petkov | 9026cc8 | 2017-01-23 19:35:14 +0100 | [diff] [blame] | 1052 | .priority = MCE_PRIO_EDAC, |
Borislav Petkov | fb25319 | 2009-10-07 13:20:38 +0200 | [diff] [blame] | 1053 | }; |
| 1054 | |
Ingo Molnar | f436f8b | 2009-10-01 16:14:32 +0200 | [diff] [blame] | 1055 | static int __init mce_amd_init(void) |
| 1056 | { |
Borislav Petkov | bad11e0 | 2010-09-22 17:44:51 +0200 | [diff] [blame] | 1057 | struct cpuinfo_x86 *c = &boot_cpu_data; |
| 1058 | |
| 1059 | if (c->x86_vendor != X86_VENDOR_AMD) |
Borislav Petkov | fd0f5fff | 2014-02-17 20:51:52 +0100 | [diff] [blame] | 1060 | return -ENODEV; |
Borislav Petkov | e045c29 | 2010-08-06 18:55:45 +0200 | [diff] [blame] | 1061 | |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 1062 | fam_ops = kzalloc(sizeof(struct amd_decoder_ops), GFP_KERNEL); |
| 1063 | if (!fam_ops) |
| 1064 | return -ENOMEM; |
| 1065 | |
Borislav Petkov | bad11e0 | 2010-09-22 17:44:51 +0200 | [diff] [blame] | 1066 | switch (c->x86) { |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 1067 | case 0xf: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 1068 | fam_ops->mc0_mce = k8_mc0_mce; |
| 1069 | fam_ops->mc1_mce = k8_mc1_mce; |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 1070 | fam_ops->mc2_mce = k8_mc2_mce; |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 1071 | break; |
| 1072 | |
| 1073 | case 0x10: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 1074 | fam_ops->mc0_mce = f10h_mc0_mce; |
| 1075 | fam_ops->mc1_mce = k8_mc1_mce; |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 1076 | fam_ops->mc2_mce = k8_mc2_mce; |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 1077 | break; |
| 1078 | |
Borislav Petkov | f0157b3 | 2010-10-05 19:07:16 +0200 | [diff] [blame] | 1079 | case 0x11: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 1080 | fam_ops->mc0_mce = k8_mc0_mce; |
| 1081 | fam_ops->mc1_mce = k8_mc1_mce; |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 1082 | fam_ops->mc2_mce = k8_mc2_mce; |
Borislav Petkov | f0157b3 | 2010-10-05 19:07:16 +0200 | [diff] [blame] | 1083 | break; |
| 1084 | |
Borislav Petkov | 9be0bb1 | 2010-09-16 15:08:14 +0200 | [diff] [blame] | 1085 | case 0x12: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 1086 | fam_ops->mc0_mce = f12h_mc0_mce; |
| 1087 | fam_ops->mc1_mce = k8_mc1_mce; |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 1088 | fam_ops->mc2_mce = k8_mc2_mce; |
Borislav Petkov | 9be0bb1 | 2010-09-16 15:08:14 +0200 | [diff] [blame] | 1089 | break; |
| 1090 | |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 1091 | case 0x14: |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 1092 | fam_ops->mc0_mce = cat_mc0_mce; |
| 1093 | fam_ops->mc1_mce = cat_mc1_mce; |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 1094 | fam_ops->mc2_mce = k8_mc2_mce; |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 1095 | break; |
| 1096 | |
Borislav Petkov | 2be64bf | 2010-09-17 19:11:47 +0200 | [diff] [blame] | 1097 | case 0x15: |
Aravind Gopalakrishnan | eba4bfb | 2014-07-14 16:58:19 +0200 | [diff] [blame] | 1098 | xec_mask = c->x86_model == 0x60 ? 0x3f : 0x1f; |
| 1099 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 1100 | fam_ops->mc0_mce = f15h_mc0_mce; |
| 1101 | fam_ops->mc1_mce = f15h_mc1_mce; |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 1102 | fam_ops->mc2_mce = f15h_mc2_mce; |
Borislav Petkov | 2be64bf | 2010-09-17 19:11:47 +0200 | [diff] [blame] | 1103 | break; |
| 1104 | |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 1105 | case 0x16: |
| 1106 | xec_mask = 0x1f; |
| 1107 | fam_ops->mc0_mce = cat_mc0_mce; |
| 1108 | fam_ops->mc1_mce = cat_mc1_mce; |
| 1109 | fam_ops->mc2_mce = f16h_mc2_mce; |
| 1110 | break; |
| 1111 | |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 1112 | case 0x17: |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 1113 | xec_mask = 0x3f; |
Yazen Ghannam | a348ed8 | 2016-05-11 14:58:28 +0200 | [diff] [blame] | 1114 | if (!boot_cpu_has(X86_FEATURE_SMCA)) { |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 1115 | printk(KERN_WARNING "Decoding supported only on Scalable MCA processors.\n"); |
| 1116 | goto err_out; |
| 1117 | } |
| 1118 | break; |
| 1119 | |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 1120 | default: |
Borislav Petkov | ec3e82d | 2012-04-04 14:21:02 +0200 | [diff] [blame] | 1121 | printk(KERN_WARNING "Huh? What family is it: 0x%x?!\n", c->x86); |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 1122 | goto err_out; |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 1123 | } |
| 1124 | |
Borislav Petkov | 9530d60 | 2010-09-06 15:05:45 +0200 | [diff] [blame] | 1125 | pr_info("MCE: In-kernel MCE decoding enabled.\n"); |
| 1126 | |
Borislav Petkov | 3653ada | 2011-12-04 15:12:09 +0100 | [diff] [blame] | 1127 | mce_register_decode_chain(&amd_mce_dec_nb); |
Ingo Molnar | f436f8b | 2009-10-01 16:14:32 +0200 | [diff] [blame] | 1128 | |
| 1129 | return 0; |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 1130 | |
| 1131 | err_out: |
| 1132 | kfree(fam_ops); |
| 1133 | fam_ops = NULL; |
| 1134 | return -EINVAL; |
Ingo Molnar | f436f8b | 2009-10-01 16:14:32 +0200 | [diff] [blame] | 1135 | } |
| 1136 | early_initcall(mce_amd_init); |
Borislav Petkov | 0d18b2e | 2009-10-02 15:31:48 +0200 | [diff] [blame] | 1137 | |
| 1138 | #ifdef MODULE |
| 1139 | static void __exit mce_amd_exit(void) |
| 1140 | { |
Borislav Petkov | 3653ada | 2011-12-04 15:12:09 +0100 | [diff] [blame] | 1141 | mce_unregister_decode_chain(&amd_mce_dec_nb); |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 1142 | kfree(fam_ops); |
Borislav Petkov | 0d18b2e | 2009-10-02 15:31:48 +0200 | [diff] [blame] | 1143 | } |
| 1144 | |
| 1145 | MODULE_DESCRIPTION("AMD MCE decoder"); |
| 1146 | MODULE_ALIAS("edac-mce-amd"); |
| 1147 | MODULE_LICENSE("GPL"); |
| 1148 | module_exit(mce_amd_exit); |
| 1149 | #endif |