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 | 47ca08a | 2010-09-27 15:30:39 +0200 | [diff] [blame] | 4 | #include "mce_amd.h" |
Doug Thompson | b52401ce | 2009-05-06 17:57:20 +0200 | [diff] [blame] | 5 | |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 6 | static struct amd_decoder_ops *fam_ops; |
| 7 | |
Borislav Petkov | 2be64bf | 2010-09-17 19:11:47 +0200 | [diff] [blame] | 8 | static u8 xec_mask = 0xf; |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 9 | |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 10 | static bool report_gart_errors; |
Borislav Petkov | b0b07a2 | 2011-08-24 18:44:22 +0200 | [diff] [blame] | 11 | static void (*nb_bus_decoder)(int node_id, struct mce *m); |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 12 | |
| 13 | void amd_report_gart_errors(bool v) |
| 14 | { |
| 15 | report_gart_errors = v; |
| 16 | } |
| 17 | EXPORT_SYMBOL_GPL(amd_report_gart_errors); |
| 18 | |
Borislav Petkov | b0b07a2 | 2011-08-24 18:44:22 +0200 | [diff] [blame] | 19 | void amd_register_ecc_decoder(void (*f)(int, struct mce *)) |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 20 | { |
| 21 | nb_bus_decoder = f; |
| 22 | } |
| 23 | EXPORT_SYMBOL_GPL(amd_register_ecc_decoder); |
| 24 | |
Borislav Petkov | b0b07a2 | 2011-08-24 18:44:22 +0200 | [diff] [blame] | 25 | void amd_unregister_ecc_decoder(void (*f)(int, struct mce *)) |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 26 | { |
| 27 | if (nb_bus_decoder) { |
| 28 | WARN_ON(nb_bus_decoder != f); |
| 29 | |
| 30 | nb_bus_decoder = NULL; |
| 31 | } |
| 32 | } |
| 33 | EXPORT_SYMBOL_GPL(amd_unregister_ecc_decoder); |
| 34 | |
Doug Thompson | b52401ce | 2009-05-06 17:57:20 +0200 | [diff] [blame] | 35 | /* |
| 36 | * string representation for the different MCA reported error types, see F3x48 |
| 37 | * or MSR0000_0411. |
| 38 | */ |
Borislav Petkov | 6337583 | 2010-09-06 18:13:39 +0200 | [diff] [blame] | 39 | |
| 40 | /* transaction type */ |
Borislav Petkov | 0f08669 | 2012-12-23 12:40:45 +0100 | [diff] [blame] | 41 | static const char * const tt_msgs[] = { "INSN", "DATA", "GEN", "RESV" }; |
Doug Thompson | b52401ce | 2009-05-06 17:57:20 +0200 | [diff] [blame] | 42 | |
Borislav Petkov | 6337583 | 2010-09-06 18:13:39 +0200 | [diff] [blame] | 43 | /* cache level */ |
Borislav Petkov | 0f08669 | 2012-12-23 12:40:45 +0100 | [diff] [blame] | 44 | static const char * const ll_msgs[] = { "RESV", "L1", "L2", "L3/GEN" }; |
Doug Thompson | b52401ce | 2009-05-06 17:57:20 +0200 | [diff] [blame] | 45 | |
Borislav Petkov | 6337583 | 2010-09-06 18:13:39 +0200 | [diff] [blame] | 46 | /* memory transaction type */ |
Borislav Petkov | 0f08669 | 2012-12-23 12:40:45 +0100 | [diff] [blame] | 47 | static const char * const rrrr_msgs[] = { |
Borislav Petkov | 6337583 | 2010-09-06 18:13:39 +0200 | [diff] [blame] | 48 | "GEN", "RD", "WR", "DRD", "DWR", "IRD", "PRF", "EV", "SNP" |
Doug Thompson | b52401ce | 2009-05-06 17:57:20 +0200 | [diff] [blame] | 49 | }; |
| 50 | |
Borislav Petkov | 6337583 | 2010-09-06 18:13:39 +0200 | [diff] [blame] | 51 | /* participating processor */ |
Borislav Petkov | ebe2aea | 2011-11-29 19:03:25 +0100 | [diff] [blame] | 52 | const char * const pp_msgs[] = { "SRC", "RES", "OBS", "GEN" }; |
Borislav Petkov | b70ef01 | 2009-06-25 19:32:38 +0200 | [diff] [blame] | 53 | EXPORT_SYMBOL_GPL(pp_msgs); |
Doug Thompson | b52401ce | 2009-05-06 17:57:20 +0200 | [diff] [blame] | 54 | |
Borislav Petkov | 6337583 | 2010-09-06 18:13:39 +0200 | [diff] [blame] | 55 | /* request timeout */ |
Borislav Petkov | 0f08669 | 2012-12-23 12:40:45 +0100 | [diff] [blame] | 56 | static const char * const to_msgs[] = { "no timeout", "timed out" }; |
Doug Thompson | b52401ce | 2009-05-06 17:57:20 +0200 | [diff] [blame] | 57 | |
Borislav Petkov | 6337583 | 2010-09-06 18:13:39 +0200 | [diff] [blame] | 58 | /* memory or i/o */ |
Borislav Petkov | 0f08669 | 2012-12-23 12:40:45 +0100 | [diff] [blame] | 59 | static const char * const ii_msgs[] = { "MEM", "RESV", "IO", "GEN" }; |
Doug Thompson | b52401ce | 2009-05-06 17:57:20 +0200 | [diff] [blame] | 60 | |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 61 | /* internal error type */ |
Borislav Petkov | 0f08669 | 2012-12-23 12:40:45 +0100 | [diff] [blame] | 62 | static const char * const uu_msgs[] = { "RESV", "RESV", "HWA", "RESV" }; |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 63 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 64 | static const char * const f15h_mc1_mce_desc[] = { |
Borislav Petkov | 86039cd | 2010-11-08 15:03:35 +0100 | [diff] [blame] | 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 */ |
Borislav Petkov | 6c1173a | 2011-11-21 19:45:34 +0100 | [diff] [blame] | 77 | "Microcode Patch Buffer", /* xec = 010 */ |
Borislav Petkov | 86039cd | 2010-11-08 15:03:35 +0100 | [diff] [blame] | 78 | "uop queue", |
| 79 | "insn buffer", |
| 80 | "predecode buffer", |
Aravind Gopalakrishnan | eba4bfb | 2014-07-14 16:58:19 +0200 | [diff] [blame] | 81 | "fetch address FIFO", |
| 82 | "dispatch uop queue" |
Borislav Petkov | 86039cd | 2010-11-08 15:03:35 +0100 | [diff] [blame] | 83 | }; |
| 84 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 85 | static const char * const f15h_mc2_mce_desc[] = { |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 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", |
| 91 | "WCC Tag ECC error", |
| 92 | "WCC Data ECC error", |
| 93 | "WCB Data parity error", |
Borislav Petkov | b64a99c | 2011-11-23 14:50:44 +0100 | [diff] [blame] | 94 | "VB Data ECC or parity error", |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 95 | "L2 Tag ECC error", /* xec = 0x10 */ |
| 96 | "Hard L2 Tag ECC error", |
| 97 | "Multiple hits on L2 tag", |
| 98 | "XAB parity error", |
| 99 | "PRB address parity error" |
| 100 | }; |
| 101 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 102 | static const char * const mc4_mce_desc[] = { |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 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", |
| 106 | "HT Master abort", |
| 107 | "HT Target abort", |
| 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" |
| 122 | }; |
| 123 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 124 | static const char * const mc5_mce_desc[] = { |
Borislav Petkov | 8259a7e | 2010-09-22 15:28:59 +0200 | [diff] [blame] | 125 | "CPU Watchdog timer expire", |
| 126 | "Wakeup array dest tag", |
| 127 | "AG payload array", |
| 128 | "EX payload array", |
| 129 | "IDRF array", |
| 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", |
Aravind Gopalakrishnan | aad19e5 | 2013-06-05 15:50:03 -0500 | [diff] [blame] | 137 | "DE error occurred", |
| 138 | "Retire status queue" |
Borislav Petkov | 8259a7e | 2010-09-22 15:28:59 +0200 | [diff] [blame] | 139 | }; |
| 140 | |
Aravind Gopalakrishnan | bc4febe | 2014-11-04 11:41:08 -0600 | [diff] [blame] | 141 | static const char * const mc6_mce_desc[] = { |
| 142 | "Hardware Assertion", |
| 143 | "Free List", |
| 144 | "Physical Register File", |
| 145 | "Retire Queue", |
| 146 | "Scheduler table", |
| 147 | "Status Register File", |
| 148 | }; |
| 149 | |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 150 | /* Scalable MCA error strings */ |
| 151 | static const char * const f17h_ls_mce_desc[] = { |
| 152 | "Load queue parity", |
| 153 | "Store queue parity", |
| 154 | "Miss address buffer payload parity", |
| 155 | "L1 TLB parity", |
| 156 | "", /* reserved */ |
| 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", |
| 168 | "L2 TLB parity", |
| 169 | "PDC parity error", |
| 170 | "DC tag error type 3", |
| 171 | "DC tag error type 5", |
| 172 | "L2 fill data error", |
| 173 | }; |
| 174 | |
| 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", |
| 188 | }; |
| 189 | |
| 190 | static const char * const f17h_l2_mce_desc[] = { |
| 191 | "L2M tag multi-way-hit error", |
| 192 | "L2M tag ECC error", |
| 193 | "L2M data ECC error", |
| 194 | "HW assert", |
| 195 | }; |
| 196 | |
| 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", |
| 205 | "uop buffer parity" |
| 206 | }; |
| 207 | |
| 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", |
| 214 | "EX payload parity", |
| 215 | "Checkpoint queue parity", |
| 216 | "Retire dispatch queue parity", |
| 217 | }; |
| 218 | |
| 219 | static const char * const f17h_fp_mce_desc[] = { |
| 220 | "Physical register file parity", |
| 221 | "Freelist parity error", |
| 222 | "Schedule queue parity", |
| 223 | "NSQ parity error", |
| 224 | "Retire queue parity", |
| 225 | "Status register file parity", |
| 226 | }; |
| 227 | |
| 228 | static const char * const f17h_l3_mce_desc[] = { |
| 229 | "Shadow tag macro ECC error", |
| 230 | "Shadow tag macro multi-way-hit error", |
| 231 | "L3M tag ECC 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", |
| 236 | "L3 HW assert", |
| 237 | }; |
| 238 | |
| 239 | static const char * const f17h_cs_mce_desc[] = { |
| 240 | "Illegal request from transport layer", |
| 241 | "Address violation", |
| 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", |
| 249 | }; |
| 250 | |
| 251 | static const char * const f17h_pie_mce_desc[] = { |
| 252 | "HW assert", |
| 253 | "Internal PIE register security violation", |
| 254 | "Error on GMI link", |
| 255 | "Poison data written to internal PIE register", |
| 256 | }; |
| 257 | |
| 258 | static const char * const f17h_umc_mce_desc[] = { |
| 259 | "DRAM ECC error", |
| 260 | "Data poison error on DRAM", |
| 261 | "SDP parity error", |
| 262 | "Advanced peripheral bus error", |
| 263 | "Command/address parity error", |
| 264 | "Write data CRC error", |
| 265 | }; |
| 266 | |
| 267 | static const char * const f17h_pb_mce_desc[] = { |
| 268 | "Parameter Block RAM ECC error", |
| 269 | }; |
| 270 | |
| 271 | static const char * const f17h_psp_mce_desc[] = { |
| 272 | "PSP RAM ECC or parity error", |
| 273 | }; |
| 274 | |
| 275 | static const char * const f17h_smu_mce_desc[] = { |
| 276 | "SMU RAM ECC or parity error", |
| 277 | }; |
| 278 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 279 | static bool f12h_mc0_mce(u16 ec, u8 xec) |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 280 | { |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 281 | bool ret = false; |
| 282 | |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 283 | if (MEM_ERROR(ec)) { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 284 | u8 ll = LL(ec); |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 285 | ret = true; |
| 286 | |
| 287 | if (ll == LL_L2) |
| 288 | pr_cont("during L1 linefill from L2.\n"); |
| 289 | else if (ll == LL_L1) |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 290 | pr_cont("Data/Tag %s error.\n", R4_MSG(ec)); |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 291 | else |
| 292 | ret = false; |
| 293 | } |
| 294 | return ret; |
| 295 | } |
| 296 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 297 | static bool f10h_mc0_mce(u16 ec, u8 xec) |
Borislav Petkov | 9be0bb1 | 2010-09-16 15:08:14 +0200 | [diff] [blame] | 298 | { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 299 | if (R4(ec) == R4_GEN && LL(ec) == LL_L1) { |
Borislav Petkov | 9be0bb1 | 2010-09-16 15:08:14 +0200 | [diff] [blame] | 300 | pr_cont("during data scrub.\n"); |
| 301 | return true; |
| 302 | } |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 303 | return f12h_mc0_mce(ec, xec); |
Borislav Petkov | 9be0bb1 | 2010-09-16 15:08:14 +0200 | [diff] [blame] | 304 | } |
| 305 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 306 | static bool k8_mc0_mce(u16 ec, u8 xec) |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 307 | { |
| 308 | if (BUS_ERROR(ec)) { |
| 309 | pr_cont("during system linefill.\n"); |
| 310 | return true; |
| 311 | } |
| 312 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 313 | return f10h_mc0_mce(ec, xec); |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 314 | } |
| 315 | |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 316 | static bool cat_mc0_mce(u16 ec, u8 xec) |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 317 | { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 318 | u8 r4 = R4(ec); |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 319 | bool ret = true; |
| 320 | |
| 321 | if (MEM_ERROR(ec)) { |
| 322 | |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 323 | if (TT(ec) != TT_DATA || LL(ec) != LL_L1) |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 324 | return false; |
| 325 | |
| 326 | switch (r4) { |
| 327 | case R4_DRD: |
| 328 | case R4_DWR: |
| 329 | pr_cont("Data/Tag parity error due to %s.\n", |
| 330 | (r4 == R4_DRD ? "load/hw prf" : "store")); |
| 331 | break; |
| 332 | case R4_EVICT: |
| 333 | pr_cont("Copyback parity error on a tag miss.\n"); |
| 334 | break; |
| 335 | case R4_SNOOP: |
| 336 | pr_cont("Tag parity error during snoop.\n"); |
| 337 | break; |
| 338 | default: |
| 339 | ret = false; |
| 340 | } |
| 341 | } else if (BUS_ERROR(ec)) { |
| 342 | |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 343 | 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] | 344 | return false; |
| 345 | |
| 346 | pr_cont("System read data error on a "); |
| 347 | |
| 348 | switch (r4) { |
| 349 | case R4_RD: |
| 350 | pr_cont("TLB reload.\n"); |
| 351 | break; |
| 352 | case R4_DWR: |
| 353 | pr_cont("store.\n"); |
| 354 | break; |
| 355 | case R4_DRD: |
| 356 | pr_cont("load.\n"); |
| 357 | break; |
| 358 | default: |
| 359 | ret = false; |
| 360 | } |
| 361 | } else { |
| 362 | ret = false; |
| 363 | } |
| 364 | |
| 365 | return ret; |
| 366 | } |
| 367 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 368 | static bool f15h_mc0_mce(u16 ec, u8 xec) |
Borislav Petkov | 25a4f8b | 2010-09-17 19:22:34 +0200 | [diff] [blame] | 369 | { |
| 370 | bool ret = true; |
| 371 | |
| 372 | if (MEM_ERROR(ec)) { |
| 373 | |
| 374 | switch (xec) { |
| 375 | case 0x0: |
| 376 | pr_cont("Data Array access error.\n"); |
| 377 | break; |
| 378 | |
| 379 | case 0x1: |
| 380 | pr_cont("UC error during a linefill from L2/NB.\n"); |
| 381 | break; |
| 382 | |
| 383 | case 0x2: |
| 384 | case 0x11: |
| 385 | pr_cont("STQ access error.\n"); |
| 386 | break; |
| 387 | |
| 388 | case 0x3: |
| 389 | pr_cont("SCB access error.\n"); |
| 390 | break; |
| 391 | |
| 392 | case 0x10: |
| 393 | pr_cont("Tag error.\n"); |
| 394 | break; |
| 395 | |
| 396 | case 0x12: |
| 397 | pr_cont("LDQ access error.\n"); |
| 398 | break; |
| 399 | |
| 400 | default: |
| 401 | ret = false; |
| 402 | } |
| 403 | } else if (BUS_ERROR(ec)) { |
| 404 | |
| 405 | if (!xec) |
Borislav Petkov | 344f0a0 | 2011-11-15 17:10:58 +0100 | [diff] [blame] | 406 | pr_cont("System Read Data Error.\n"); |
Borislav Petkov | 25a4f8b | 2010-09-17 19:22:34 +0200 | [diff] [blame] | 407 | else |
Borislav Petkov | 344f0a0 | 2011-11-15 17:10:58 +0100 | [diff] [blame] | 408 | pr_cont(" Internal error condition type %d.\n", xec); |
Aravind Gopalakrishnan | eba4bfb | 2014-07-14 16:58:19 +0200 | [diff] [blame] | 409 | } else if (INT_ERROR(ec)) { |
| 410 | if (xec <= 0x1f) |
| 411 | pr_cont("Hardware Assert.\n"); |
| 412 | else |
| 413 | ret = false; |
| 414 | |
Borislav Petkov | 25a4f8b | 2010-09-17 19:22:34 +0200 | [diff] [blame] | 415 | } else |
| 416 | ret = false; |
| 417 | |
| 418 | return ret; |
| 419 | } |
| 420 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 421 | static void decode_mc0_mce(struct mce *m) |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 422 | { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 423 | u16 ec = EC(m->status); |
| 424 | u8 xec = XEC(m->status, xec_mask); |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 425 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 426 | pr_emerg(HW_ERR "MC0 Error: "); |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 427 | |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 428 | /* TLB error signatures are the same across families */ |
| 429 | if (TLB_ERROR(ec)) { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 430 | if (TT(ec) == TT_DATA) { |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 431 | pr_cont("%s TLB %s.\n", LL_MSG(ec), |
Borislav Petkov | 25a4f8b | 2010-09-17 19:22:34 +0200 | [diff] [blame] | 432 | ((xec == 2) ? "locked miss" |
| 433 | : (xec ? "multimatch" : "parity"))); |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 434 | return; |
| 435 | } |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 436 | } else if (fam_ops->mc0_mce(ec, xec)) |
Borislav Petkov | 25a4f8b | 2010-09-17 19:22:34 +0200 | [diff] [blame] | 437 | ; |
| 438 | else |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 439 | pr_emerg(HW_ERR "Corrupted MC0 MCE info?\n"); |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 440 | } |
| 441 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 442 | static bool k8_mc1_mce(u16 ec, u8 xec) |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 443 | { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 444 | u8 ll = LL(ec); |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 445 | bool ret = true; |
| 446 | |
| 447 | if (!MEM_ERROR(ec)) |
| 448 | return false; |
| 449 | |
| 450 | if (ll == 0x2) |
| 451 | pr_cont("during a linefill from L2.\n"); |
| 452 | else if (ll == 0x1) { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 453 | switch (R4(ec)) { |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 454 | case R4_IRD: |
| 455 | pr_cont("Parity error during data load.\n"); |
| 456 | break; |
| 457 | |
| 458 | case R4_EVICT: |
| 459 | pr_cont("Copyback Parity/Victim error.\n"); |
| 460 | break; |
| 461 | |
| 462 | case R4_SNOOP: |
| 463 | pr_cont("Tag Snoop error.\n"); |
| 464 | break; |
| 465 | |
| 466 | default: |
| 467 | ret = false; |
| 468 | break; |
| 469 | } |
| 470 | } else |
| 471 | ret = false; |
| 472 | |
| 473 | return ret; |
| 474 | } |
| 475 | |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 476 | static bool cat_mc1_mce(u16 ec, u8 xec) |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 477 | { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 478 | u8 r4 = R4(ec); |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 479 | bool ret = true; |
| 480 | |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 481 | if (!MEM_ERROR(ec)) |
| 482 | return false; |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 483 | |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 484 | if (TT(ec) != TT_INSTR) |
| 485 | return false; |
| 486 | |
| 487 | if (r4 == R4_IRD) |
| 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"); |
| 491 | else if (xec == 0x0) |
| 492 | pr_cont("Tag parity error from victim castout.\n"); |
| 493 | else if (xec == 0x2) |
| 494 | pr_cont("Microcode patch RAM parity error.\n"); |
| 495 | else |
| 496 | ret = false; |
| 497 | |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 498 | return ret; |
| 499 | } |
| 500 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 501 | static bool f15h_mc1_mce(u16 ec, u8 xec) |
Borislav Petkov | 86039cd | 2010-11-08 15:03:35 +0100 | [diff] [blame] | 502 | { |
| 503 | bool ret = true; |
| 504 | |
| 505 | if (!MEM_ERROR(ec)) |
| 506 | return false; |
| 507 | |
| 508 | switch (xec) { |
| 509 | case 0x0 ... 0xa: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 510 | pr_cont("%s.\n", f15h_mc1_mce_desc[xec]); |
Borislav Petkov | 86039cd | 2010-11-08 15:03:35 +0100 | [diff] [blame] | 511 | break; |
| 512 | |
| 513 | case 0xd: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 514 | pr_cont("%s.\n", f15h_mc1_mce_desc[xec-2]); |
Borislav Petkov | 86039cd | 2010-11-08 15:03:35 +0100 | [diff] [blame] | 515 | break; |
| 516 | |
Borislav Petkov | 6c1173a | 2011-11-21 19:45:34 +0100 | [diff] [blame] | 517 | case 0x10: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 518 | pr_cont("%s.\n", f15h_mc1_mce_desc[xec-4]); |
Borislav Petkov | 6c1173a | 2011-11-21 19:45:34 +0100 | [diff] [blame] | 519 | break; |
| 520 | |
Aravind Gopalakrishnan | eba4bfb | 2014-07-14 16:58:19 +0200 | [diff] [blame] | 521 | case 0x11 ... 0x15: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 522 | 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] | 523 | break; |
| 524 | |
| 525 | default: |
| 526 | ret = false; |
| 527 | } |
| 528 | return ret; |
| 529 | } |
| 530 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 531 | static void decode_mc1_mce(struct mce *m) |
Borislav Petkov | ab5535e | 2009-07-28 14:06:26 +0200 | [diff] [blame] | 532 | { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 533 | u16 ec = EC(m->status); |
| 534 | u8 xec = XEC(m->status, xec_mask); |
Borislav Petkov | ab5535e | 2009-07-28 14:06:26 +0200 | [diff] [blame] | 535 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 536 | pr_emerg(HW_ERR "MC1 Error: "); |
Borislav Petkov | ab5535e | 2009-07-28 14:06:26 +0200 | [diff] [blame] | 537 | |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 538 | if (TLB_ERROR(ec)) |
| 539 | pr_cont("%s TLB %s.\n", LL_MSG(ec), |
| 540 | (xec ? "multimatch" : "parity error")); |
| 541 | else if (BUS_ERROR(ec)) { |
Borislav Petkov | 525906b | 2010-10-15 15:27:02 +0200 | [diff] [blame] | 542 | bool k8 = (boot_cpu_data.x86 == 0xf && (m->status & BIT_64(58))); |
Borislav Petkov | ab5535e | 2009-07-28 14:06:26 +0200 | [diff] [blame] | 543 | |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 544 | pr_cont("during %s.\n", (k8 ? "system linefill" : "NB data read")); |
Aravind Gopalakrishnan | eba4bfb | 2014-07-14 16:58:19 +0200 | [diff] [blame] | 545 | } else if (INT_ERROR(ec)) { |
| 546 | if (xec <= 0x3f) |
| 547 | pr_cont("Hardware Assert.\n"); |
| 548 | else |
| 549 | goto wrong_mc1_mce; |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 550 | } else if (fam_ops->mc1_mce(ec, xec)) |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 551 | ; |
| 552 | else |
Aravind Gopalakrishnan | eba4bfb | 2014-07-14 16:58:19 +0200 | [diff] [blame] | 553 | goto wrong_mc1_mce; |
| 554 | |
| 555 | return; |
| 556 | |
| 557 | wrong_mc1_mce: |
| 558 | pr_emerg(HW_ERR "Corrupted MC1 MCE info?\n"); |
Borislav Petkov | ab5535e | 2009-07-28 14:06:26 +0200 | [diff] [blame] | 559 | } |
| 560 | |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 561 | static bool k8_mc2_mce(u16 ec, u8 xec) |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 562 | { |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 563 | bool ret = true; |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 564 | |
| 565 | if (xec == 0x1) |
| 566 | pr_cont(" in the write data buffers.\n"); |
| 567 | else if (xec == 0x3) |
| 568 | pr_cont(" in the victim data buffers.\n"); |
| 569 | else if (xec == 0x2 && MEM_ERROR(ec)) |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 570 | 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] | 571 | else if (xec == 0x0) { |
| 572 | if (TLB_ERROR(ec)) |
Borislav Petkov | 50872cc | 2014-11-22 13:41:01 +0100 | [diff] [blame] | 573 | pr_cont("%s error in a Page Descriptor Cache or Guest TLB.\n", |
| 574 | TT_MSG(ec)); |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 575 | else if (BUS_ERROR(ec)) |
| 576 | pr_cont(": %s/ECC error in data read from NB: %s.\n", |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 577 | R4_MSG(ec), PP_MSG(ec)); |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 578 | else if (MEM_ERROR(ec)) { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 579 | u8 r4 = R4(ec); |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 580 | |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 581 | if (r4 >= 0x7) |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 582 | pr_cont(": %s error during data copyback.\n", |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 583 | R4_MSG(ec)); |
| 584 | else if (r4 <= 0x1) |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 585 | pr_cont(": %s parity/ECC error during data " |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 586 | "access from L2.\n", R4_MSG(ec)); |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 587 | else |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 588 | ret = false; |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 589 | } else |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 590 | ret = false; |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 591 | } else |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 592 | ret = false; |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 593 | |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 594 | return ret; |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 595 | } |
| 596 | |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 597 | static bool f15h_mc2_mce(u16 ec, u8 xec) |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 598 | { |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 599 | bool ret = true; |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 600 | |
| 601 | if (TLB_ERROR(ec)) { |
| 602 | if (xec == 0x0) |
| 603 | pr_cont("Data parity TLB read error.\n"); |
| 604 | else if (xec == 0x1) |
| 605 | pr_cont("Poison data provided for TLB fill.\n"); |
| 606 | else |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 607 | ret = false; |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 608 | } else if (BUS_ERROR(ec)) { |
| 609 | if (xec > 2) |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 610 | ret = false; |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 611 | |
| 612 | pr_cont("Error during attempted NB data read.\n"); |
| 613 | } else if (MEM_ERROR(ec)) { |
| 614 | switch (xec) { |
| 615 | case 0x4 ... 0xc: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 616 | pr_cont("%s.\n", f15h_mc2_mce_desc[xec - 0x4]); |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 617 | break; |
| 618 | |
| 619 | case 0x10 ... 0x14: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 620 | pr_cont("%s.\n", f15h_mc2_mce_desc[xec - 0x7]); |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 621 | break; |
| 622 | |
| 623 | default: |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 624 | ret = false; |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 625 | } |
Aravind Gopalakrishnan | eba4bfb | 2014-07-14 16:58:19 +0200 | [diff] [blame] | 626 | } else if (INT_ERROR(ec)) { |
| 627 | if (xec <= 0x3f) |
| 628 | pr_cont("Hardware Assert.\n"); |
| 629 | else |
| 630 | ret = false; |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 631 | } |
| 632 | |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 633 | return ret; |
| 634 | } |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 635 | |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 636 | static bool f16h_mc2_mce(u16 ec, u8 xec) |
| 637 | { |
| 638 | u8 r4 = R4(ec); |
| 639 | |
| 640 | if (!MEM_ERROR(ec)) |
| 641 | return false; |
| 642 | |
| 643 | switch (xec) { |
| 644 | case 0x04 ... 0x05: |
| 645 | pr_cont("%cBUFF parity error.\n", (r4 == R4_RD) ? 'I' : 'O'); |
| 646 | break; |
| 647 | |
| 648 | case 0x09 ... 0x0b: |
| 649 | case 0x0d ... 0x0f: |
| 650 | pr_cont("ECC error in L2 tag (%s).\n", |
| 651 | ((r4 == R4_GEN) ? "BankReq" : |
| 652 | ((r4 == R4_SNOOP) ? "Prb" : "Fill"))); |
| 653 | break; |
| 654 | |
| 655 | case 0x10 ... 0x19: |
| 656 | case 0x1b: |
| 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")))); |
| 661 | break; |
| 662 | |
| 663 | case 0x1c ... 0x1d: |
| 664 | case 0x1f: |
| 665 | pr_cont("Parity error in L2 attribute bits (%s).\n", |
| 666 | ((r4 == R4_RD) ? "Hit" : |
| 667 | ((r4 == R4_GEN) ? "Attr" : "Fill"))); |
| 668 | break; |
| 669 | |
| 670 | default: |
| 671 | return false; |
| 672 | } |
| 673 | |
| 674 | return true; |
| 675 | } |
| 676 | |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 677 | static void decode_mc2_mce(struct mce *m) |
| 678 | { |
| 679 | u16 ec = EC(m->status); |
| 680 | u8 xec = XEC(m->status, xec_mask); |
| 681 | |
| 682 | pr_emerg(HW_ERR "MC2 Error: "); |
| 683 | |
| 684 | if (!fam_ops->mc2_mce(ec, xec)) |
| 685 | pr_cont(HW_ERR "Corrupted MC2 MCE info?\n"); |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 686 | } |
| 687 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 688 | static void decode_mc3_mce(struct mce *m) |
Borislav Petkov | f9350ef | 2009-07-28 14:17:30 +0200 | [diff] [blame] | 689 | { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 690 | u16 ec = EC(m->status); |
| 691 | u8 xec = XEC(m->status, xec_mask); |
Borislav Petkov | ded5062 | 2010-08-27 17:03:34 +0200 | [diff] [blame] | 692 | |
Borislav Petkov | b18434c | 2010-09-22 11:53:32 +0200 | [diff] [blame] | 693 | if (boot_cpu_data.x86 >= 0x14) { |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 694 | 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] | 695 | " please report on LKML.\n"); |
| 696 | return; |
| 697 | } |
Borislav Petkov | f9350ef | 2009-07-28 14:17:30 +0200 | [diff] [blame] | 698 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 699 | pr_emerg(HW_ERR "MC3 Error"); |
Borislav Petkov | f9350ef | 2009-07-28 14:17:30 +0200 | [diff] [blame] | 700 | |
| 701 | if (xec == 0x0) { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 702 | u8 r4 = R4(ec); |
Borislav Petkov | f9350ef | 2009-07-28 14:17:30 +0200 | [diff] [blame] | 703 | |
Borislav Petkov | ded5062 | 2010-08-27 17:03:34 +0200 | [diff] [blame] | 704 | if (!BUS_ERROR(ec) || (r4 != R4_DRD && r4 != R4_DWR)) |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 705 | goto wrong_mc3_mce; |
Borislav Petkov | f9350ef | 2009-07-28 14:17:30 +0200 | [diff] [blame] | 706 | |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 707 | pr_cont(" during %s.\n", R4_MSG(ec)); |
Borislav Petkov | ded5062 | 2010-08-27 17:03:34 +0200 | [diff] [blame] | 708 | } else |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 709 | goto wrong_mc3_mce; |
Borislav Petkov | ded5062 | 2010-08-27 17:03:34 +0200 | [diff] [blame] | 710 | |
Borislav Petkov | f9350ef | 2009-07-28 14:17:30 +0200 | [diff] [blame] | 711 | return; |
| 712 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 713 | wrong_mc3_mce: |
| 714 | pr_emerg(HW_ERR "Corrupted MC3 MCE info?\n"); |
Borislav Petkov | f9350ef | 2009-07-28 14:17:30 +0200 | [diff] [blame] | 715 | } |
| 716 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 717 | static void decode_mc4_mce(struct mce *m) |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 718 | { |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 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); |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 723 | u8 offset = 0; |
| 724 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 725 | pr_emerg(HW_ERR "MC4 Error (node %d): ", node_id); |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 726 | |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 727 | switch (xec) { |
| 728 | case 0x0 ... 0xe: |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 729 | |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 730 | /* special handling for DRAM ECCs */ |
| 731 | if (xec == 0x0 || xec == 0x8) { |
| 732 | /* no ECCs on F11h */ |
| 733 | if (c->x86 == 0x11) |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 734 | goto wrong_mc4_mce; |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 735 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 736 | pr_cont("%s.\n", mc4_mce_desc[xec]); |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 737 | |
| 738 | if (nb_bus_decoder) |
| 739 | nb_bus_decoder(node_id, m); |
| 740 | return; |
| 741 | } |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 742 | break; |
| 743 | |
| 744 | case 0xf: |
| 745 | if (TLB_ERROR(ec)) |
| 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"); |
| 749 | else |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 750 | goto wrong_mc4_mce; |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 751 | return; |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 752 | |
Borislav Petkov | 05cd667 | 2010-09-22 15:06:24 +0200 | [diff] [blame] | 753 | case 0x19: |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 754 | if (boot_cpu_data.x86 == 0x15 || boot_cpu_data.x86 == 0x16) |
Borislav Petkov | 05cd667 | 2010-09-22 15:06:24 +0200 | [diff] [blame] | 755 | pr_cont("Compute Unit Data Error.\n"); |
| 756 | else |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 757 | goto wrong_mc4_mce; |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 758 | return; |
Borislav Petkov | 05cd667 | 2010-09-22 15:06:24 +0200 | [diff] [blame] | 759 | |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 760 | case 0x1c ... 0x1f: |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 761 | offset = 13; |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 762 | break; |
| 763 | |
| 764 | default: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 765 | goto wrong_mc4_mce; |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 766 | } |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 767 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 768 | pr_cont("%s.\n", mc4_mce_desc[xec - offset]); |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 769 | return; |
| 770 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 771 | wrong_mc4_mce: |
| 772 | pr_emerg(HW_ERR "Corrupted MC4 MCE info?\n"); |
Borislav Petkov | d93cc22 | 2009-07-28 10:56:15 +0200 | [diff] [blame] | 773 | } |
Borislav Petkov | d93cc22 | 2009-07-28 10:56:15 +0200 | [diff] [blame] | 774 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 775 | static void decode_mc5_mce(struct mce *m) |
Borislav Petkov | 53bd5fe | 2009-07-28 14:20:46 +0200 | [diff] [blame] | 776 | { |
Borislav Petkov | 8259a7e | 2010-09-22 15:28:59 +0200 | [diff] [blame] | 777 | struct cpuinfo_x86 *c = &boot_cpu_data; |
Aravind Gopalakrishnan | eba4bfb | 2014-07-14 16:58:19 +0200 | [diff] [blame] | 778 | u16 ec = EC(m->status); |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 779 | u8 xec = XEC(m->status, xec_mask); |
Borislav Petkov | 8259a7e | 2010-09-22 15:28:59 +0200 | [diff] [blame] | 780 | |
| 781 | if (c->x86 == 0xf || c->x86 == 0x11) |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 782 | goto wrong_mc5_mce; |
Borislav Petkov | fe4ea26 | 2010-08-31 18:38:24 +0200 | [diff] [blame] | 783 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 784 | pr_emerg(HW_ERR "MC5 Error: "); |
Borislav Petkov | 8259a7e | 2010-09-22 15:28:59 +0200 | [diff] [blame] | 785 | |
Aravind Gopalakrishnan | eba4bfb | 2014-07-14 16:58:19 +0200 | [diff] [blame] | 786 | if (INT_ERROR(ec)) { |
| 787 | if (xec <= 0x1f) { |
| 788 | pr_cont("Hardware Assert.\n"); |
| 789 | return; |
| 790 | } else |
| 791 | goto wrong_mc5_mce; |
| 792 | } |
| 793 | |
Borislav Petkov | 8259a7e | 2010-09-22 15:28:59 +0200 | [diff] [blame] | 794 | if (xec == 0x0 || xec == 0xc) |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 795 | pr_cont("%s.\n", mc5_mce_desc[xec]); |
Aravind Gopalakrishnan | aad19e5 | 2013-06-05 15:50:03 -0500 | [diff] [blame] | 796 | else if (xec <= 0xd) |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 797 | pr_cont("%s parity error.\n", mc5_mce_desc[xec]); |
Borislav Petkov | 8259a7e | 2010-09-22 15:28:59 +0200 | [diff] [blame] | 798 | else |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 799 | goto wrong_mc5_mce; |
Borislav Petkov | 8259a7e | 2010-09-22 15:28:59 +0200 | [diff] [blame] | 800 | |
| 801 | return; |
Borislav Petkov | fe4ea26 | 2010-08-31 18:38:24 +0200 | [diff] [blame] | 802 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 803 | wrong_mc5_mce: |
| 804 | pr_emerg(HW_ERR "Corrupted MC5 MCE info?\n"); |
Borislav Petkov | 53bd5fe | 2009-07-28 14:20:46 +0200 | [diff] [blame] | 805 | } |
| 806 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 807 | static void decode_mc6_mce(struct mce *m) |
Borislav Petkov | b8f85c4 | 2010-09-22 15:37:58 +0200 | [diff] [blame] | 808 | { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 809 | u8 xec = XEC(m->status, xec_mask); |
Borislav Petkov | b8f85c4 | 2010-09-22 15:37:58 +0200 | [diff] [blame] | 810 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 811 | pr_emerg(HW_ERR "MC6 Error: "); |
Borislav Petkov | b8f85c4 | 2010-09-22 15:37:58 +0200 | [diff] [blame] | 812 | |
Aravind Gopalakrishnan | bc4febe | 2014-11-04 11:41:08 -0600 | [diff] [blame] | 813 | if (xec > 0x5) |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 814 | goto wrong_mc6_mce; |
Borislav Petkov | b8f85c4 | 2010-09-22 15:37:58 +0200 | [diff] [blame] | 815 | |
Aravind Gopalakrishnan | bc4febe | 2014-11-04 11:41:08 -0600 | [diff] [blame] | 816 | pr_cont("%s parity error.\n", mc6_mce_desc[xec]); |
Borislav Petkov | b8f85c4 | 2010-09-22 15:37:58 +0200 | [diff] [blame] | 817 | return; |
| 818 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 819 | wrong_mc6_mce: |
| 820 | pr_emerg(HW_ERR "Corrupted MC6 MCE info?\n"); |
Borislav Petkov | b8f85c4 | 2010-09-22 15:37:58 +0200 | [diff] [blame] | 821 | } |
| 822 | |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 823 | static void decode_f17h_core_errors(const char *ip_name, u8 xec, |
| 824 | unsigned int mca_type) |
| 825 | { |
| 826 | const char * const *error_desc_array; |
| 827 | size_t len; |
| 828 | |
| 829 | pr_emerg(HW_ERR "%s Error: ", ip_name); |
| 830 | |
| 831 | switch (mca_type) { |
| 832 | case SMCA_LS: |
| 833 | error_desc_array = f17h_ls_mce_desc; |
| 834 | len = ARRAY_SIZE(f17h_ls_mce_desc) - 1; |
| 835 | |
| 836 | if (xec == 0x4) { |
| 837 | pr_cont("Unrecognized LS MCA error code.\n"); |
| 838 | return; |
| 839 | } |
| 840 | break; |
| 841 | |
| 842 | case SMCA_IF: |
| 843 | error_desc_array = f17h_if_mce_desc; |
| 844 | len = ARRAY_SIZE(f17h_if_mce_desc) - 1; |
| 845 | break; |
| 846 | |
| 847 | case SMCA_L2_CACHE: |
| 848 | error_desc_array = f17h_l2_mce_desc; |
| 849 | len = ARRAY_SIZE(f17h_l2_mce_desc) - 1; |
| 850 | break; |
| 851 | |
| 852 | case SMCA_DE: |
| 853 | error_desc_array = f17h_de_mce_desc; |
| 854 | len = ARRAY_SIZE(f17h_de_mce_desc) - 1; |
| 855 | break; |
| 856 | |
| 857 | case SMCA_EX: |
| 858 | error_desc_array = f17h_ex_mce_desc; |
| 859 | len = ARRAY_SIZE(f17h_ex_mce_desc) - 1; |
| 860 | break; |
| 861 | |
| 862 | case SMCA_FP: |
| 863 | error_desc_array = f17h_fp_mce_desc; |
| 864 | len = ARRAY_SIZE(f17h_fp_mce_desc) - 1; |
| 865 | break; |
| 866 | |
| 867 | case SMCA_L3_CACHE: |
| 868 | error_desc_array = f17h_l3_mce_desc; |
| 869 | len = ARRAY_SIZE(f17h_l3_mce_desc) - 1; |
| 870 | break; |
| 871 | |
| 872 | default: |
| 873 | pr_cont("Corrupted MCA core error info.\n"); |
| 874 | return; |
| 875 | } |
| 876 | |
| 877 | if (xec > len) { |
| 878 | pr_cont("Unrecognized %s MCA bank error code.\n", |
| 879 | amd_core_mcablock_names[mca_type]); |
| 880 | return; |
| 881 | } |
| 882 | |
| 883 | pr_cont("%s.\n", error_desc_array[xec]); |
| 884 | } |
| 885 | |
| 886 | static void decode_df_errors(u8 xec, unsigned int mca_type) |
| 887 | { |
| 888 | const char * const *error_desc_array; |
| 889 | size_t len; |
| 890 | |
| 891 | pr_emerg(HW_ERR "Data Fabric Error: "); |
| 892 | |
| 893 | switch (mca_type) { |
| 894 | case SMCA_CS: |
| 895 | error_desc_array = f17h_cs_mce_desc; |
| 896 | len = ARRAY_SIZE(f17h_cs_mce_desc) - 1; |
| 897 | break; |
| 898 | |
| 899 | case SMCA_PIE: |
| 900 | error_desc_array = f17h_pie_mce_desc; |
| 901 | len = ARRAY_SIZE(f17h_pie_mce_desc) - 1; |
| 902 | break; |
| 903 | |
| 904 | default: |
| 905 | pr_cont("Corrupted MCA Data Fabric info.\n"); |
| 906 | return; |
| 907 | } |
| 908 | |
| 909 | if (xec > len) { |
| 910 | pr_cont("Unrecognized %s MCA bank error code.\n", |
| 911 | amd_df_mcablock_names[mca_type]); |
| 912 | return; |
| 913 | } |
| 914 | |
| 915 | pr_cont("%s.\n", error_desc_array[xec]); |
| 916 | } |
| 917 | |
| 918 | /* Decode errors according to Scalable MCA specification */ |
| 919 | static void decode_smca_errors(struct mce *m) |
| 920 | { |
| 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; |
| 925 | const char *ip_name; |
| 926 | u32 low, high; |
| 927 | size_t len; |
| 928 | |
| 929 | if (rdmsr_safe(addr, &low, &high)) { |
| 930 | pr_emerg("Invalid IP block specified, error information is unreliable.\n"); |
| 931 | return; |
| 932 | } |
| 933 | |
| 934 | hwid = high & MCI_IPID_HWID; |
| 935 | mca_type = (high & MCI_IPID_MCATYPE) >> 16; |
| 936 | |
| 937 | pr_emerg(HW_ERR "MC%d IPID value: 0x%08x%08x\n", m->bank, high, low); |
| 938 | |
| 939 | /* |
| 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. |
| 942 | */ |
| 943 | for (i = 0; i < ARRAY_SIZE(amd_hwids); i++) |
| 944 | if (amd_hwids[i].hwid == hwid) |
| 945 | break; |
| 946 | |
| 947 | switch (i) { |
| 948 | case SMCA_F17H_CORE: |
| 949 | ip_name = (mca_type == SMCA_L3_CACHE) ? |
| 950 | "L3 Cache" : "F17h Core"; |
| 951 | return decode_f17h_core_errors(ip_name, xec, mca_type); |
| 952 | break; |
| 953 | |
| 954 | case SMCA_DF: |
| 955 | return decode_df_errors(xec, mca_type); |
| 956 | break; |
| 957 | |
| 958 | case SMCA_UMC: |
| 959 | error_desc_array = f17h_umc_mce_desc; |
| 960 | len = ARRAY_SIZE(f17h_umc_mce_desc) - 1; |
| 961 | break; |
| 962 | |
| 963 | case SMCA_PB: |
| 964 | error_desc_array = f17h_pb_mce_desc; |
| 965 | len = ARRAY_SIZE(f17h_pb_mce_desc) - 1; |
| 966 | break; |
| 967 | |
| 968 | case SMCA_PSP: |
| 969 | error_desc_array = f17h_psp_mce_desc; |
| 970 | len = ARRAY_SIZE(f17h_psp_mce_desc) - 1; |
| 971 | break; |
| 972 | |
| 973 | case SMCA_SMU: |
| 974 | error_desc_array = f17h_smu_mce_desc; |
| 975 | len = ARRAY_SIZE(f17h_smu_mce_desc) - 1; |
| 976 | break; |
| 977 | |
| 978 | default: |
| 979 | pr_emerg(HW_ERR "HWID:%d does not match any existing IPs.\n", hwid); |
| 980 | return; |
| 981 | } |
| 982 | |
| 983 | ip_name = amd_hwids[i].name; |
| 984 | pr_emerg(HW_ERR "%s Error: ", ip_name); |
| 985 | |
| 986 | if (xec > len) { |
| 987 | pr_cont("Unrecognized %s MCA bank error code.\n", ip_name); |
| 988 | return; |
| 989 | } |
| 990 | |
| 991 | pr_cont("%s.\n", error_desc_array[xec]); |
| 992 | } |
| 993 | |
Borislav Petkov | 6337583 | 2010-09-06 18:13:39 +0200 | [diff] [blame] | 994 | static inline void amd_decode_err_code(u16 ec) |
Borislav Petkov | d93cc22 | 2009-07-28 10:56:15 +0200 | [diff] [blame] | 995 | { |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 996 | if (INT_ERROR(ec)) { |
| 997 | pr_emerg(HW_ERR "internal: %s\n", UU_MSG(ec)); |
| 998 | return; |
| 999 | } |
Borislav Petkov | fa7ae8c | 2010-09-22 17:42:27 +0200 | [diff] [blame] | 1000 | |
| 1001 | pr_emerg(HW_ERR "cache level: %s", LL_MSG(ec)); |
| 1002 | |
| 1003 | if (BUS_ERROR(ec)) |
| 1004 | pr_cont(", mem/io: %s", II_MSG(ec)); |
| 1005 | else |
| 1006 | pr_cont(", tx: %s", TT_MSG(ec)); |
| 1007 | |
| 1008 | if (MEM_ERROR(ec) || BUS_ERROR(ec)) { |
| 1009 | pr_cont(", mem-tx: %s", R4_MSG(ec)); |
| 1010 | |
| 1011 | if (BUS_ERROR(ec)) |
| 1012 | pr_cont(", part-proc: %s (%s)", PP_MSG(ec), TO_MSG(ec)); |
| 1013 | } |
| 1014 | |
| 1015 | pr_cont("\n"); |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 1016 | } |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 1017 | |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 1018 | /* |
| 1019 | * Filter out unwanted MCE signatures here. |
| 1020 | */ |
| 1021 | static bool amd_filter_mce(struct mce *m) |
| 1022 | { |
| 1023 | u8 xec = (m->status >> 16) & 0x1f; |
| 1024 | |
| 1025 | /* |
| 1026 | * NB GART TLB error reporting is disabled by default. |
| 1027 | */ |
| 1028 | if (m->bank == 4 && xec == 0x5 && !report_gart_errors) |
| 1029 | return true; |
| 1030 | |
| 1031 | return false; |
| 1032 | } |
| 1033 | |
Borislav Petkov | d5c6770 | 2012-09-14 20:25:37 +0200 | [diff] [blame] | 1034 | static const char *decode_error_status(struct mce *m) |
| 1035 | { |
| 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."; |
| 1042 | } |
| 1043 | |
| 1044 | if (m->status & MCI_STATUS_DEFERRED) |
| 1045 | return "Deferred error."; |
| 1046 | |
| 1047 | return "Corrected error, no action required."; |
| 1048 | } |
| 1049 | |
Borislav Petkov | 9cdeb40 | 2010-09-02 18:33:24 +0200 | [diff] [blame] | 1050 | int amd_decode_mce(struct notifier_block *nb, unsigned long val, void *data) |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 1051 | { |
Borislav Petkov | fb25319 | 2009-10-07 13:20:38 +0200 | [diff] [blame] | 1052 | struct mce *m = (struct mce *)data; |
Borislav Petkov | f89f838 | 2012-09-13 15:14:22 +0200 | [diff] [blame] | 1053 | struct cpuinfo_x86 *c = &cpu_data(m->extcpu); |
Borislav Petkov | b0b07a2 | 2011-08-24 18:44:22 +0200 | [diff] [blame] | 1054 | int ecc; |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 1055 | |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 1056 | if (amd_filter_mce(m)) |
| 1057 | return NOTIFY_STOP; |
| 1058 | |
Borislav Petkov | fd0f5fff | 2014-02-17 20:51:52 +0100 | [diff] [blame] | 1059 | pr_emerg(HW_ERR "%s\n", decode_error_status(m)); |
| 1060 | |
| 1061 | pr_emerg(HW_ERR "CPU:%d (%x:%x:%x) MC%d_STATUS[%s|%s|%s|%s|%s", |
| 1062 | m->extcpu, |
| 1063 | c->x86, c->x86_model, c->x86_mask, |
| 1064 | m->bank, |
| 1065 | ((m->status & MCI_STATUS_OVER) ? "Over" : "-"), |
Aravind Gopalakrishnan | 99e1dfb | 2015-07-13 06:53:02 -0500 | [diff] [blame] | 1066 | ((m->status & MCI_STATUS_UC) ? "UE" : |
| 1067 | (m->status & MCI_STATUS_DEFERRED) ? "-" : "CE"), |
Borislav Petkov | fd0f5fff | 2014-02-17 20:51:52 +0100 | [diff] [blame] | 1068 | ((m->status & MCI_STATUS_MISCV) ? "MiscV" : "-"), |
| 1069 | ((m->status & MCI_STATUS_PCC) ? "PCC" : "-"), |
| 1070 | ((m->status & MCI_STATUS_ADDRV) ? "AddrV" : "-")); |
| 1071 | |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 1072 | if (c->x86 >= 0x15) |
Borislav Petkov | fd0f5fff | 2014-02-17 20:51:52 +0100 | [diff] [blame] | 1073 | pr_cont("|%s|%s", |
| 1074 | ((m->status & MCI_STATUS_DEFERRED) ? "Deferred" : "-"), |
| 1075 | ((m->status & MCI_STATUS_POISON) ? "Poison" : "-")); |
| 1076 | |
Yazen Ghannam | a348ed8 | 2016-05-11 14:58:28 +0200 | [diff] [blame] | 1077 | if (boot_cpu_has(X86_FEATURE_SMCA)) { |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 1078 | u32 low, high; |
| 1079 | u32 addr = MSR_AMD64_SMCA_MCx_CONFIG(m->bank); |
| 1080 | |
| 1081 | if (!rdmsr_safe(addr, &low, &high) && |
| 1082 | (low & MCI_CONFIG_MCAX)) |
| 1083 | pr_cont("|%s", ((m->status & MCI_STATUS_TCC) ? "TCC" : "-")); |
| 1084 | } |
| 1085 | |
Borislav Petkov | fd0f5fff | 2014-02-17 20:51:52 +0100 | [diff] [blame] | 1086 | /* do the two bits[14:13] together */ |
| 1087 | ecc = (m->status >> 45) & 0x3; |
| 1088 | if (ecc) |
| 1089 | pr_cont("|%sECC", ((ecc == 2) ? "C" : "U")); |
| 1090 | |
| 1091 | pr_cont("]: 0x%016llx\n", m->status); |
| 1092 | |
| 1093 | if (m->status & MCI_STATUS_ADDRV) |
Borislav Petkov | 50872cc | 2014-11-22 13:41:01 +0100 | [diff] [blame] | 1094 | pr_emerg(HW_ERR "MC%d Error Address: 0x%016llx\n", m->bank, m->addr); |
Borislav Petkov | fd0f5fff | 2014-02-17 20:51:52 +0100 | [diff] [blame] | 1095 | |
Yazen Ghannam | a348ed8 | 2016-05-11 14:58:28 +0200 | [diff] [blame] | 1096 | if (boot_cpu_has(X86_FEATURE_SMCA)) { |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 1097 | decode_smca_errors(m); |
| 1098 | goto err_code; |
| 1099 | } |
| 1100 | |
Borislav Petkov | fd0f5fff | 2014-02-17 20:51:52 +0100 | [diff] [blame] | 1101 | if (!fam_ops) |
| 1102 | goto err_code; |
| 1103 | |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 1104 | switch (m->bank) { |
| 1105 | case 0: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 1106 | decode_mc0_mce(m); |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 1107 | break; |
Borislav Petkov | d93cc22 | 2009-07-28 10:56:15 +0200 | [diff] [blame] | 1108 | |
Borislav Petkov | ab5535e | 2009-07-28 14:06:26 +0200 | [diff] [blame] | 1109 | case 1: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 1110 | decode_mc1_mce(m); |
Borislav Petkov | ab5535e | 2009-07-28 14:06:26 +0200 | [diff] [blame] | 1111 | break; |
| 1112 | |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 1113 | case 2: |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 1114 | decode_mc2_mce(m); |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 1115 | break; |
| 1116 | |
Borislav Petkov | f9350ef | 2009-07-28 14:17:30 +0200 | [diff] [blame] | 1117 | case 3: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 1118 | decode_mc3_mce(m); |
Borislav Petkov | f9350ef | 2009-07-28 14:17:30 +0200 | [diff] [blame] | 1119 | break; |
| 1120 | |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 1121 | case 4: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 1122 | decode_mc4_mce(m); |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 1123 | break; |
| 1124 | |
Borislav Petkov | 53bd5fe | 2009-07-28 14:20:46 +0200 | [diff] [blame] | 1125 | case 5: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 1126 | decode_mc5_mce(m); |
Borislav Petkov | 53bd5fe | 2009-07-28 14:20:46 +0200 | [diff] [blame] | 1127 | break; |
| 1128 | |
Borislav Petkov | b8f85c4 | 2010-09-22 15:37:58 +0200 | [diff] [blame] | 1129 | case 6: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 1130 | decode_mc6_mce(m); |
Borislav Petkov | b8f85c4 | 2010-09-22 15:37:58 +0200 | [diff] [blame] | 1131 | break; |
| 1132 | |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 1133 | default: |
| 1134 | break; |
Borislav Petkov | b69b29d | 2009-07-27 16:21:14 +0200 | [diff] [blame] | 1135 | } |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 1136 | |
Borislav Petkov | fd0f5fff | 2014-02-17 20:51:52 +0100 | [diff] [blame] | 1137 | err_code: |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 1138 | amd_decode_err_code(m->status & 0xffff); |
Borislav Petkov | fb25319 | 2009-10-07 13:20:38 +0200 | [diff] [blame] | 1139 | |
| 1140 | return NOTIFY_STOP; |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 1141 | } |
Borislav Petkov | 9cdeb40 | 2010-09-02 18:33:24 +0200 | [diff] [blame] | 1142 | EXPORT_SYMBOL_GPL(amd_decode_mce); |
Ingo Molnar | f436f8b | 2009-10-01 16:14:32 +0200 | [diff] [blame] | 1143 | |
Borislav Petkov | fb25319 | 2009-10-07 13:20:38 +0200 | [diff] [blame] | 1144 | static struct notifier_block amd_mce_dec_nb = { |
| 1145 | .notifier_call = amd_decode_mce, |
| 1146 | }; |
| 1147 | |
Ingo Molnar | f436f8b | 2009-10-01 16:14:32 +0200 | [diff] [blame] | 1148 | static int __init mce_amd_init(void) |
| 1149 | { |
Borislav Petkov | bad11e0 | 2010-09-22 17:44:51 +0200 | [diff] [blame] | 1150 | struct cpuinfo_x86 *c = &boot_cpu_data; |
| 1151 | |
| 1152 | if (c->x86_vendor != X86_VENDOR_AMD) |
Borislav Petkov | fd0f5fff | 2014-02-17 20:51:52 +0100 | [diff] [blame] | 1153 | return -ENODEV; |
Borislav Petkov | e045c29 | 2010-08-06 18:55:45 +0200 | [diff] [blame] | 1154 | |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 1155 | fam_ops = kzalloc(sizeof(struct amd_decoder_ops), GFP_KERNEL); |
| 1156 | if (!fam_ops) |
| 1157 | return -ENOMEM; |
| 1158 | |
Borislav Petkov | bad11e0 | 2010-09-22 17:44:51 +0200 | [diff] [blame] | 1159 | switch (c->x86) { |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 1160 | case 0xf: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 1161 | fam_ops->mc0_mce = k8_mc0_mce; |
| 1162 | fam_ops->mc1_mce = k8_mc1_mce; |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 1163 | fam_ops->mc2_mce = k8_mc2_mce; |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 1164 | break; |
| 1165 | |
| 1166 | case 0x10: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 1167 | fam_ops->mc0_mce = f10h_mc0_mce; |
| 1168 | fam_ops->mc1_mce = k8_mc1_mce; |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 1169 | fam_ops->mc2_mce = k8_mc2_mce; |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 1170 | break; |
| 1171 | |
Borislav Petkov | f0157b3 | 2010-10-05 19:07:16 +0200 | [diff] [blame] | 1172 | case 0x11: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 1173 | fam_ops->mc0_mce = k8_mc0_mce; |
| 1174 | fam_ops->mc1_mce = k8_mc1_mce; |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 1175 | fam_ops->mc2_mce = k8_mc2_mce; |
Borislav Petkov | f0157b3 | 2010-10-05 19:07:16 +0200 | [diff] [blame] | 1176 | break; |
| 1177 | |
Borislav Petkov | 9be0bb1 | 2010-09-16 15:08:14 +0200 | [diff] [blame] | 1178 | case 0x12: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 1179 | fam_ops->mc0_mce = f12h_mc0_mce; |
| 1180 | fam_ops->mc1_mce = k8_mc1_mce; |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 1181 | fam_ops->mc2_mce = k8_mc2_mce; |
Borislav Petkov | 9be0bb1 | 2010-09-16 15:08:14 +0200 | [diff] [blame] | 1182 | break; |
| 1183 | |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 1184 | case 0x14: |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 1185 | fam_ops->mc0_mce = cat_mc0_mce; |
| 1186 | fam_ops->mc1_mce = cat_mc1_mce; |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 1187 | fam_ops->mc2_mce = k8_mc2_mce; |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 1188 | break; |
| 1189 | |
Borislav Petkov | 2be64bf | 2010-09-17 19:11:47 +0200 | [diff] [blame] | 1190 | case 0x15: |
Aravind Gopalakrishnan | eba4bfb | 2014-07-14 16:58:19 +0200 | [diff] [blame] | 1191 | xec_mask = c->x86_model == 0x60 ? 0x3f : 0x1f; |
| 1192 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 1193 | fam_ops->mc0_mce = f15h_mc0_mce; |
| 1194 | fam_ops->mc1_mce = f15h_mc1_mce; |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 1195 | fam_ops->mc2_mce = f15h_mc2_mce; |
Borislav Petkov | 2be64bf | 2010-09-17 19:11:47 +0200 | [diff] [blame] | 1196 | break; |
| 1197 | |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 1198 | case 0x16: |
| 1199 | xec_mask = 0x1f; |
| 1200 | fam_ops->mc0_mce = cat_mc0_mce; |
| 1201 | fam_ops->mc1_mce = cat_mc1_mce; |
| 1202 | fam_ops->mc2_mce = f16h_mc2_mce; |
| 1203 | break; |
| 1204 | |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 1205 | case 0x17: |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 1206 | xec_mask = 0x3f; |
Yazen Ghannam | a348ed8 | 2016-05-11 14:58:28 +0200 | [diff] [blame] | 1207 | if (!boot_cpu_has(X86_FEATURE_SMCA)) { |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 1208 | printk(KERN_WARNING "Decoding supported only on Scalable MCA processors.\n"); |
| 1209 | goto err_out; |
| 1210 | } |
| 1211 | break; |
| 1212 | |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 1213 | default: |
Borislav Petkov | ec3e82d | 2012-04-04 14:21:02 +0200 | [diff] [blame] | 1214 | 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] | 1215 | goto err_out; |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 1216 | } |
| 1217 | |
Borislav Petkov | 9530d60 | 2010-09-06 15:05:45 +0200 | [diff] [blame] | 1218 | pr_info("MCE: In-kernel MCE decoding enabled.\n"); |
| 1219 | |
Borislav Petkov | 3653ada | 2011-12-04 15:12:09 +0100 | [diff] [blame] | 1220 | mce_register_decode_chain(&amd_mce_dec_nb); |
Ingo Molnar | f436f8b | 2009-10-01 16:14:32 +0200 | [diff] [blame] | 1221 | |
| 1222 | return 0; |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 1223 | |
| 1224 | err_out: |
| 1225 | kfree(fam_ops); |
| 1226 | fam_ops = NULL; |
| 1227 | return -EINVAL; |
Ingo Molnar | f436f8b | 2009-10-01 16:14:32 +0200 | [diff] [blame] | 1228 | } |
| 1229 | early_initcall(mce_amd_init); |
Borislav Petkov | 0d18b2e | 2009-10-02 15:31:48 +0200 | [diff] [blame] | 1230 | |
| 1231 | #ifdef MODULE |
| 1232 | static void __exit mce_amd_exit(void) |
| 1233 | { |
Borislav Petkov | 3653ada | 2011-12-04 15:12:09 +0100 | [diff] [blame] | 1234 | mce_unregister_decode_chain(&amd_mce_dec_nb); |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 1235 | kfree(fam_ops); |
Borislav Petkov | 0d18b2e | 2009-10-02 15:31:48 +0200 | [diff] [blame] | 1236 | } |
| 1237 | |
| 1238 | MODULE_DESCRIPTION("AMD MCE decoder"); |
| 1239 | MODULE_ALIAS("edac-mce-amd"); |
| 1240 | MODULE_LICENSE("GPL"); |
| 1241 | module_exit(mce_amd_exit); |
| 1242 | #endif |