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[] = { |
Yazen Ghannam | e03447e | 2019-02-01 22:55:53 +0000 | [diff] [blame] | 154 | "Load queue parity error", |
| 155 | "Store queue parity error", |
| 156 | "Miss address buffer payload parity error", |
| 157 | "Level 1 TLB parity error", |
Yazen Ghannam | 8a5dd2c | 2019-02-01 22:55:52 +0000 | [diff] [blame] | 158 | "DC Tag error type 5", |
Yazen Ghannam | e03447e | 2019-02-01 22:55:53 +0000 | [diff] [blame] | 159 | "DC Tag error type 6", |
| 160 | "DC Tag error type 1", |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 161 | "Internal error type 1", |
| 162 | "Internal error type 2", |
Yazen Ghannam | e03447e | 2019-02-01 22:55:53 +0000 | [diff] [blame] | 163 | "System Read Data Error Thread 0", |
| 164 | "System Read Data Error Thread 1", |
| 165 | "DC Tag error type 2", |
| 166 | "DC Data error type 1 and poison consumption", |
| 167 | "DC Data error type 2", |
| 168 | "DC Data error type 3", |
| 169 | "DC Tag error type 4", |
| 170 | "Level 2 TLB parity error", |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 171 | "PDC parity error", |
Yazen Ghannam | e03447e | 2019-02-01 22:55:53 +0000 | [diff] [blame] | 172 | "DC Tag error type 3", |
| 173 | "DC Tag error type 5", |
| 174 | "L2 Fill Data error", |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 175 | }; |
| 176 | |
Yazen Ghannam | 856095b | 2016-09-12 09:59:33 +0200 | [diff] [blame] | 177 | static const char * const smca_if_mce_desc[] = { |
Yazen Ghannam | e03447e | 2019-02-01 22:55:53 +0000 | [diff] [blame] | 178 | "Op Cache Microtag Probe Port Parity Error", |
| 179 | "IC Microtag or Full Tag Multi-hit Error", |
| 180 | "IC Full Tag Parity Error", |
| 181 | "IC Data Array Parity Error", |
| 182 | "Decoupling Queue PhysAddr Parity Error", |
| 183 | "L0 ITLB Parity Error", |
| 184 | "L1 ITLB Parity Error", |
| 185 | "L2 ITLB Parity Error", |
| 186 | "BPQ Thread 0 Snoop Parity Error", |
| 187 | "BPQ Thread 1 Snoop Parity Error", |
| 188 | "L1 BTB Multi-Match Error", |
| 189 | "L2 BTB Multi-Match Error", |
| 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[] = { |
Yazen Ghannam | e03447e | 2019-02-01 22:55:53 +0000 | [diff] [blame] | 195 | "L2M Tag Multiple-Way-Hit error", |
| 196 | "L2M Tag or State Array ECC Error", |
| 197 | "L2M Data Array ECC Error", |
| 198 | "Hardware Assert Error", |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 199 | }; |
| 200 | |
Yazen Ghannam | 856095b | 2016-09-12 09:59:33 +0200 | [diff] [blame] | 201 | static const char * const smca_de_mce_desc[] = { |
Yazen Ghannam | e03447e | 2019-02-01 22:55:53 +0000 | [diff] [blame] | 202 | "Micro-op cache tag parity error", |
| 203 | "Micro-op cache data parity error", |
| 204 | "Instruction buffer parity error", |
| 205 | "Micro-op queue parity error", |
| 206 | "Instruction dispatch queue parity error", |
| 207 | "Fetch address FIFO parity error", |
| 208 | "Patch RAM data parity error", |
| 209 | "Patch RAM sequencer parity error", |
| 210 | "Micro-op buffer parity error" |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 211 | }; |
| 212 | |
Yazen Ghannam | 856095b | 2016-09-12 09:59:33 +0200 | [diff] [blame] | 213 | static const char * const smca_ex_mce_desc[] = { |
Yazen Ghannam | e03447e | 2019-02-01 22:55:53 +0000 | [diff] [blame] | 214 | "Watchdog Timeout error", |
| 215 | "Physical register file parity error", |
| 216 | "Flag register file parity error", |
| 217 | "Immediate displacement register file parity error", |
| 218 | "Address generator payload parity error", |
| 219 | "EX payload parity error", |
| 220 | "Checkpoint queue parity error", |
| 221 | "Retire dispatch queue parity error", |
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", |
Yazen Ghannam | 8a5dd2c | 2019-02-01 22:55:52 +0000 | [diff] [blame] | 225 | "Hardware Assertion error", |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 226 | }; |
| 227 | |
Yazen Ghannam | 856095b | 2016-09-12 09:59:33 +0200 | [diff] [blame] | 228 | static const char * const smca_fp_mce_desc[] = { |
Yazen Ghannam | e03447e | 2019-02-01 22:55:53 +0000 | [diff] [blame] | 229 | "Physical register file (PRF) parity error", |
| 230 | "Freelist (FL) parity error", |
| 231 | "Schedule queue parity error", |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 232 | "NSQ parity error", |
Yazen Ghannam | e03447e | 2019-02-01 22:55:53 +0000 | [diff] [blame] | 233 | "Retire queue (RQ) parity error", |
| 234 | "Status register file (SRF) parity error", |
Yazen Ghannam | c019b95 | 2016-09-12 09:59:32 +0200 | [diff] [blame] | 235 | "Hardware assertion", |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 236 | }; |
| 237 | |
Yazen Ghannam | 856095b | 2016-09-12 09:59:33 +0200 | [diff] [blame] | 238 | static const char * const smca_l3_mce_desc[] = { |
Yazen Ghannam | e03447e | 2019-02-01 22:55:53 +0000 | [diff] [blame] | 239 | "Shadow Tag Macro ECC Error", |
| 240 | "Shadow Tag Macro Multi-way-hit Error", |
| 241 | "L3M Tag ECC Error", |
| 242 | "L3M Tag Multi-way-hit Error", |
| 243 | "L3M Data ECC Error", |
| 244 | "SDP Parity Error or SystemReadDataError from XI", |
| 245 | "L3 Victim Queue Parity Error", |
| 246 | "L3 Hardware Assertion", |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 247 | }; |
| 248 | |
Yazen Ghannam | 856095b | 2016-09-12 09:59:33 +0200 | [diff] [blame] | 249 | static const char * const smca_cs_mce_desc[] = { |
Yazen Ghannam | e03447e | 2019-02-01 22:55:53 +0000 | [diff] [blame] | 250 | "Illegal Request", |
| 251 | "Address Violation", |
| 252 | "Security Violation", |
| 253 | "Illegal Response", |
| 254 | "Unexpected Response", |
| 255 | "Request or Probe Parity Error", |
| 256 | "Read Response Parity Error", |
| 257 | "Atomic Request Parity Error", |
| 258 | "Probe Filter ECC Error", |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 259 | }; |
| 260 | |
Yazen Ghannam | 3ad7e74 | 2019-02-01 22:55:52 +0000 | [diff] [blame] | 261 | static const char * const smca_cs2_mce_desc[] = { |
| 262 | "Illegal Request", |
| 263 | "Address Violation", |
| 264 | "Security Violation", |
| 265 | "Illegal Response", |
| 266 | "Unexpected Response", |
| 267 | "Request or Probe Parity Error", |
| 268 | "Read Response Parity Error", |
| 269 | "Atomic Request Parity Error", |
| 270 | "SDP read response had no match in the CS queue", |
| 271 | "Probe Filter Protocol Error", |
| 272 | "Probe Filter ECC Error", |
| 273 | "SDP read response had an unexpected RETRY error", |
| 274 | "Counter overflow error", |
| 275 | "Counter underflow error", |
| 276 | }; |
| 277 | |
Yazen Ghannam | 856095b | 2016-09-12 09:59:33 +0200 | [diff] [blame] | 278 | static const char * const smca_pie_mce_desc[] = { |
Yazen Ghannam | e03447e | 2019-02-01 22:55:53 +0000 | [diff] [blame] | 279 | "Hardware Assert", |
| 280 | "Register security violation", |
| 281 | "Link Error", |
| 282 | "Poison data consumption", |
Yazen Ghannam | 8a5dd2c | 2019-02-01 22:55:52 +0000 | [diff] [blame] | 283 | "A deferred error was detected in the DF" |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 284 | }; |
| 285 | |
Yazen Ghannam | 856095b | 2016-09-12 09:59:33 +0200 | [diff] [blame] | 286 | static const char * const smca_umc_mce_desc[] = { |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 287 | "DRAM ECC error", |
Yazen Ghannam | e03447e | 2019-02-01 22:55:53 +0000 | [diff] [blame] | 288 | "Data poison error", |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 289 | "SDP parity error", |
| 290 | "Advanced peripheral bus error", |
Yazen Ghannam | e03447e | 2019-02-01 22:55:53 +0000 | [diff] [blame] | 291 | "Address/Command parity error", |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 292 | "Write data CRC error", |
Yazen Ghannam | 8a5dd2c | 2019-02-01 22:55:52 +0000 | [diff] [blame] | 293 | "DCQ SRAM ECC error", |
| 294 | "AES SRAM ECC error", |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 295 | }; |
| 296 | |
Yazen Ghannam | 856095b | 2016-09-12 09:59:33 +0200 | [diff] [blame] | 297 | static const char * const smca_pb_mce_desc[] = { |
Yazen Ghannam | e03447e | 2019-02-01 22:55:53 +0000 | [diff] [blame] | 298 | "An ECC error in the Parameter Block RAM array", |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 299 | }; |
| 300 | |
Yazen Ghannam | 856095b | 2016-09-12 09:59:33 +0200 | [diff] [blame] | 301 | static const char * const smca_psp_mce_desc[] = { |
Yazen Ghannam | e03447e | 2019-02-01 22:55:53 +0000 | [diff] [blame] | 302 | "An ECC or parity error in a PSP RAM instance", |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 303 | }; |
| 304 | |
Yazen Ghannam | 3ad7e74 | 2019-02-01 22:55:52 +0000 | [diff] [blame] | 305 | static const char * const smca_psp2_mce_desc[] = { |
| 306 | "High SRAM ECC or parity error", |
| 307 | "Low SRAM ECC or parity error", |
| 308 | "Instruction Cache Bank 0 ECC or parity error", |
| 309 | "Instruction Cache Bank 1 ECC or parity error", |
| 310 | "Instruction Tag Ram 0 parity error", |
| 311 | "Instruction Tag Ram 1 parity error", |
| 312 | "Data Cache Bank 0 ECC or parity error", |
| 313 | "Data Cache Bank 1 ECC or parity error", |
| 314 | "Data Cache Bank 2 ECC or parity error", |
| 315 | "Data Cache Bank 3 ECC or parity error", |
| 316 | "Data Tag Bank 0 parity error", |
| 317 | "Data Tag Bank 1 parity error", |
| 318 | "Data Tag Bank 2 parity error", |
| 319 | "Data Tag Bank 3 parity error", |
| 320 | "Dirty Data Ram parity error", |
| 321 | "TLB Bank 0 parity error", |
| 322 | "TLB Bank 1 parity error", |
| 323 | "System Hub Read Buffer ECC or parity error", |
| 324 | }; |
| 325 | |
Yazen Ghannam | 856095b | 2016-09-12 09:59:33 +0200 | [diff] [blame] | 326 | static const char * const smca_smu_mce_desc[] = { |
Yazen Ghannam | e03447e | 2019-02-01 22:55:53 +0000 | [diff] [blame] | 327 | "An ECC or parity error in an SMU RAM instance", |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 328 | }; |
| 329 | |
Yazen Ghannam | 3ad7e74 | 2019-02-01 22:55:52 +0000 | [diff] [blame] | 330 | static const char * const smca_smu2_mce_desc[] = { |
| 331 | "High SRAM ECC or parity error", |
| 332 | "Low SRAM ECC or parity error", |
| 333 | "Data Cache Bank A ECC or parity error", |
| 334 | "Data Cache Bank B ECC or parity error", |
| 335 | "Data Tag Cache Bank A ECC or parity error", |
| 336 | "Data Tag Cache Bank B ECC or parity error", |
| 337 | "Instruction Cache Bank A ECC or parity error", |
| 338 | "Instruction Cache Bank B ECC or parity error", |
| 339 | "Instruction Tag Cache Bank A ECC or parity error", |
| 340 | "Instruction Tag Cache Bank B ECC or parity error", |
| 341 | "System Hub Read Buffer ECC or parity error", |
| 342 | }; |
| 343 | |
Yazen Ghannam | cbfa447 | 2019-02-01 22:55:51 +0000 | [diff] [blame] | 344 | static const char * const smca_mp5_mce_desc[] = { |
| 345 | "High SRAM ECC or parity error", |
| 346 | "Low SRAM ECC or parity error", |
| 347 | "Data Cache Bank A ECC or parity error", |
| 348 | "Data Cache Bank B ECC or parity error", |
| 349 | "Data Tag Cache Bank A ECC or parity error", |
| 350 | "Data Tag Cache Bank B ECC or parity error", |
| 351 | "Instruction Cache Bank A ECC or parity error", |
| 352 | "Instruction Cache Bank B ECC or parity error", |
| 353 | "Instruction Tag Cache Bank A ECC or parity error", |
| 354 | "Instruction Tag Cache Bank B ECC or parity error", |
| 355 | }; |
| 356 | |
| 357 | static const char * const smca_nbio_mce_desc[] = { |
| 358 | "ECC or Parity error", |
| 359 | "PCIE error", |
| 360 | "SDP ErrEvent error", |
| 361 | "SDP Egress Poison Error", |
| 362 | "IOHC Internal Poison Error", |
| 363 | }; |
| 364 | |
| 365 | static const char * const smca_pcie_mce_desc[] = { |
| 366 | "CCIX PER Message logging", |
| 367 | "CCIX Read Response with Status: Non-Data Error", |
| 368 | "CCIX Write Response with Status: Non-Data Error", |
| 369 | "CCIX Read Response with Status: Data Error", |
| 370 | "CCIX Non-okay write response with data error", |
| 371 | }; |
| 372 | |
Yazen Ghannam | 5896820 | 2016-09-12 09:59:34 +0200 | [diff] [blame] | 373 | struct smca_mce_desc { |
| 374 | const char * const *descs; |
| 375 | unsigned int num_descs; |
| 376 | }; |
| 377 | |
| 378 | static struct smca_mce_desc smca_mce_descs[] = { |
| 379 | [SMCA_LS] = { smca_ls_mce_desc, ARRAY_SIZE(smca_ls_mce_desc) }, |
| 380 | [SMCA_IF] = { smca_if_mce_desc, ARRAY_SIZE(smca_if_mce_desc) }, |
| 381 | [SMCA_L2_CACHE] = { smca_l2_mce_desc, ARRAY_SIZE(smca_l2_mce_desc) }, |
| 382 | [SMCA_DE] = { smca_de_mce_desc, ARRAY_SIZE(smca_de_mce_desc) }, |
| 383 | [SMCA_EX] = { smca_ex_mce_desc, ARRAY_SIZE(smca_ex_mce_desc) }, |
| 384 | [SMCA_FP] = { smca_fp_mce_desc, ARRAY_SIZE(smca_fp_mce_desc) }, |
| 385 | [SMCA_L3_CACHE] = { smca_l3_mce_desc, ARRAY_SIZE(smca_l3_mce_desc) }, |
| 386 | [SMCA_CS] = { smca_cs_mce_desc, ARRAY_SIZE(smca_cs_mce_desc) }, |
Yazen Ghannam | 3ad7e74 | 2019-02-01 22:55:52 +0000 | [diff] [blame] | 387 | [SMCA_CS_V2] = { smca_cs2_mce_desc, ARRAY_SIZE(smca_cs2_mce_desc) }, |
Yazen Ghannam | 5896820 | 2016-09-12 09:59:34 +0200 | [diff] [blame] | 388 | [SMCA_PIE] = { smca_pie_mce_desc, ARRAY_SIZE(smca_pie_mce_desc) }, |
| 389 | [SMCA_UMC] = { smca_umc_mce_desc, ARRAY_SIZE(smca_umc_mce_desc) }, |
| 390 | [SMCA_PB] = { smca_pb_mce_desc, ARRAY_SIZE(smca_pb_mce_desc) }, |
| 391 | [SMCA_PSP] = { smca_psp_mce_desc, ARRAY_SIZE(smca_psp_mce_desc) }, |
Yazen Ghannam | 3ad7e74 | 2019-02-01 22:55:52 +0000 | [diff] [blame] | 392 | [SMCA_PSP_V2] = { smca_psp2_mce_desc, ARRAY_SIZE(smca_psp2_mce_desc) }, |
Yazen Ghannam | 5896820 | 2016-09-12 09:59:34 +0200 | [diff] [blame] | 393 | [SMCA_SMU] = { smca_smu_mce_desc, ARRAY_SIZE(smca_smu_mce_desc) }, |
Yazen Ghannam | 3ad7e74 | 2019-02-01 22:55:52 +0000 | [diff] [blame] | 394 | [SMCA_SMU_V2] = { smca_smu2_mce_desc, ARRAY_SIZE(smca_smu2_mce_desc) }, |
Yazen Ghannam | cbfa447 | 2019-02-01 22:55:51 +0000 | [diff] [blame] | 395 | [SMCA_MP5] = { smca_mp5_mce_desc, ARRAY_SIZE(smca_mp5_mce_desc) }, |
| 396 | [SMCA_NBIO] = { smca_nbio_mce_desc, ARRAY_SIZE(smca_nbio_mce_desc) }, |
| 397 | [SMCA_PCIE] = { smca_pcie_mce_desc, ARRAY_SIZE(smca_pcie_mce_desc) }, |
Yazen Ghannam | 5896820 | 2016-09-12 09:59:34 +0200 | [diff] [blame] | 398 | }; |
| 399 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 400 | static bool f12h_mc0_mce(u16 ec, u8 xec) |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 401 | { |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 402 | bool ret = false; |
| 403 | |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 404 | if (MEM_ERROR(ec)) { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 405 | u8 ll = LL(ec); |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 406 | ret = true; |
| 407 | |
| 408 | if (ll == LL_L2) |
| 409 | pr_cont("during L1 linefill from L2.\n"); |
| 410 | else if (ll == LL_L1) |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 411 | pr_cont("Data/Tag %s error.\n", R4_MSG(ec)); |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 412 | else |
| 413 | ret = false; |
| 414 | } |
| 415 | return ret; |
| 416 | } |
| 417 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 418 | static bool f10h_mc0_mce(u16 ec, u8 xec) |
Borislav Petkov | 9be0bb1 | 2010-09-16 15:08:14 +0200 | [diff] [blame] | 419 | { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 420 | if (R4(ec) == R4_GEN && LL(ec) == LL_L1) { |
Borislav Petkov | 9be0bb1 | 2010-09-16 15:08:14 +0200 | [diff] [blame] | 421 | pr_cont("during data scrub.\n"); |
| 422 | return true; |
| 423 | } |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 424 | return f12h_mc0_mce(ec, xec); |
Borislav Petkov | 9be0bb1 | 2010-09-16 15:08:14 +0200 | [diff] [blame] | 425 | } |
| 426 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 427 | static bool k8_mc0_mce(u16 ec, u8 xec) |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 428 | { |
| 429 | if (BUS_ERROR(ec)) { |
| 430 | pr_cont("during system linefill.\n"); |
| 431 | return true; |
| 432 | } |
| 433 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 434 | return f10h_mc0_mce(ec, xec); |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 435 | } |
| 436 | |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 437 | static bool cat_mc0_mce(u16 ec, u8 xec) |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 438 | { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 439 | u8 r4 = R4(ec); |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 440 | bool ret = true; |
| 441 | |
| 442 | if (MEM_ERROR(ec)) { |
| 443 | |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 444 | if (TT(ec) != TT_DATA || LL(ec) != LL_L1) |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 445 | return false; |
| 446 | |
| 447 | switch (r4) { |
| 448 | case R4_DRD: |
| 449 | case R4_DWR: |
| 450 | pr_cont("Data/Tag parity error due to %s.\n", |
| 451 | (r4 == R4_DRD ? "load/hw prf" : "store")); |
| 452 | break; |
| 453 | case R4_EVICT: |
| 454 | pr_cont("Copyback parity error on a tag miss.\n"); |
| 455 | break; |
| 456 | case R4_SNOOP: |
| 457 | pr_cont("Tag parity error during snoop.\n"); |
| 458 | break; |
| 459 | default: |
| 460 | ret = false; |
| 461 | } |
| 462 | } else if (BUS_ERROR(ec)) { |
| 463 | |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 464 | 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] | 465 | return false; |
| 466 | |
| 467 | pr_cont("System read data error on a "); |
| 468 | |
| 469 | switch (r4) { |
| 470 | case R4_RD: |
| 471 | pr_cont("TLB reload.\n"); |
| 472 | break; |
| 473 | case R4_DWR: |
| 474 | pr_cont("store.\n"); |
| 475 | break; |
| 476 | case R4_DRD: |
| 477 | pr_cont("load.\n"); |
| 478 | break; |
| 479 | default: |
| 480 | ret = false; |
| 481 | } |
| 482 | } else { |
| 483 | ret = false; |
| 484 | } |
| 485 | |
| 486 | return ret; |
| 487 | } |
| 488 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 489 | static bool f15h_mc0_mce(u16 ec, u8 xec) |
Borislav Petkov | 25a4f8b | 2010-09-17 19:22:34 +0200 | [diff] [blame] | 490 | { |
| 491 | bool ret = true; |
| 492 | |
| 493 | if (MEM_ERROR(ec)) { |
| 494 | |
| 495 | switch (xec) { |
| 496 | case 0x0: |
| 497 | pr_cont("Data Array access error.\n"); |
| 498 | break; |
| 499 | |
| 500 | case 0x1: |
| 501 | pr_cont("UC error during a linefill from L2/NB.\n"); |
| 502 | break; |
| 503 | |
| 504 | case 0x2: |
| 505 | case 0x11: |
| 506 | pr_cont("STQ access error.\n"); |
| 507 | break; |
| 508 | |
| 509 | case 0x3: |
| 510 | pr_cont("SCB access error.\n"); |
| 511 | break; |
| 512 | |
| 513 | case 0x10: |
| 514 | pr_cont("Tag error.\n"); |
| 515 | break; |
| 516 | |
| 517 | case 0x12: |
| 518 | pr_cont("LDQ access error.\n"); |
| 519 | break; |
| 520 | |
| 521 | default: |
| 522 | ret = false; |
| 523 | } |
| 524 | } else if (BUS_ERROR(ec)) { |
| 525 | |
| 526 | if (!xec) |
Borislav Petkov | 344f0a0 | 2011-11-15 17:10:58 +0100 | [diff] [blame] | 527 | pr_cont("System Read Data Error.\n"); |
Borislav Petkov | 25a4f8b | 2010-09-17 19:22:34 +0200 | [diff] [blame] | 528 | else |
Borislav Petkov | 344f0a0 | 2011-11-15 17:10:58 +0100 | [diff] [blame] | 529 | pr_cont(" Internal error condition type %d.\n", xec); |
Aravind Gopalakrishnan | eba4bfb | 2014-07-14 16:58:19 +0200 | [diff] [blame] | 530 | } else if (INT_ERROR(ec)) { |
| 531 | if (xec <= 0x1f) |
| 532 | pr_cont("Hardware Assert.\n"); |
| 533 | else |
| 534 | ret = false; |
| 535 | |
Borislav Petkov | 25a4f8b | 2010-09-17 19:22:34 +0200 | [diff] [blame] | 536 | } else |
| 537 | ret = false; |
| 538 | |
| 539 | return ret; |
| 540 | } |
| 541 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 542 | static void decode_mc0_mce(struct mce *m) |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 543 | { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 544 | u16 ec = EC(m->status); |
| 545 | u8 xec = XEC(m->status, xec_mask); |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 546 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 547 | pr_emerg(HW_ERR "MC0 Error: "); |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 548 | |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 549 | /* TLB error signatures are the same across families */ |
| 550 | if (TLB_ERROR(ec)) { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 551 | if (TT(ec) == TT_DATA) { |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 552 | pr_cont("%s TLB %s.\n", LL_MSG(ec), |
Borislav Petkov | 25a4f8b | 2010-09-17 19:22:34 +0200 | [diff] [blame] | 553 | ((xec == 2) ? "locked miss" |
| 554 | : (xec ? "multimatch" : "parity"))); |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 555 | return; |
| 556 | } |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 557 | } else if (fam_ops->mc0_mce(ec, xec)) |
Borislav Petkov | 25a4f8b | 2010-09-17 19:22:34 +0200 | [diff] [blame] | 558 | ; |
| 559 | else |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 560 | pr_emerg(HW_ERR "Corrupted MC0 MCE info?\n"); |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 561 | } |
| 562 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 563 | static bool k8_mc1_mce(u16 ec, u8 xec) |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 564 | { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 565 | u8 ll = LL(ec); |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 566 | bool ret = true; |
| 567 | |
| 568 | if (!MEM_ERROR(ec)) |
| 569 | return false; |
| 570 | |
| 571 | if (ll == 0x2) |
| 572 | pr_cont("during a linefill from L2.\n"); |
| 573 | else if (ll == 0x1) { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 574 | switch (R4(ec)) { |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 575 | case R4_IRD: |
| 576 | pr_cont("Parity error during data load.\n"); |
| 577 | break; |
| 578 | |
| 579 | case R4_EVICT: |
| 580 | pr_cont("Copyback Parity/Victim error.\n"); |
| 581 | break; |
| 582 | |
| 583 | case R4_SNOOP: |
| 584 | pr_cont("Tag Snoop error.\n"); |
| 585 | break; |
| 586 | |
| 587 | default: |
| 588 | ret = false; |
| 589 | break; |
| 590 | } |
| 591 | } else |
| 592 | ret = false; |
| 593 | |
| 594 | return ret; |
| 595 | } |
| 596 | |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 597 | static bool cat_mc1_mce(u16 ec, u8 xec) |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 598 | { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 599 | u8 r4 = R4(ec); |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 600 | bool ret = true; |
| 601 | |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 602 | if (!MEM_ERROR(ec)) |
| 603 | return false; |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 604 | |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 605 | if (TT(ec) != TT_INSTR) |
| 606 | return false; |
| 607 | |
| 608 | if (r4 == R4_IRD) |
| 609 | pr_cont("Data/tag array parity error for a tag hit.\n"); |
| 610 | else if (r4 == R4_SNOOP) |
| 611 | pr_cont("Tag error during snoop/victimization.\n"); |
| 612 | else if (xec == 0x0) |
| 613 | pr_cont("Tag parity error from victim castout.\n"); |
| 614 | else if (xec == 0x2) |
| 615 | pr_cont("Microcode patch RAM parity error.\n"); |
| 616 | else |
| 617 | ret = false; |
| 618 | |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 619 | return ret; |
| 620 | } |
| 621 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 622 | static bool f15h_mc1_mce(u16 ec, u8 xec) |
Borislav Petkov | 86039cd | 2010-11-08 15:03:35 +0100 | [diff] [blame] | 623 | { |
| 624 | bool ret = true; |
| 625 | |
| 626 | if (!MEM_ERROR(ec)) |
| 627 | return false; |
| 628 | |
| 629 | switch (xec) { |
| 630 | case 0x0 ... 0xa: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 631 | pr_cont("%s.\n", f15h_mc1_mce_desc[xec]); |
Borislav Petkov | 86039cd | 2010-11-08 15:03:35 +0100 | [diff] [blame] | 632 | break; |
| 633 | |
| 634 | case 0xd: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 635 | pr_cont("%s.\n", f15h_mc1_mce_desc[xec-2]); |
Borislav Petkov | 86039cd | 2010-11-08 15:03:35 +0100 | [diff] [blame] | 636 | break; |
| 637 | |
Borislav Petkov | 6c1173a | 2011-11-21 19:45:34 +0100 | [diff] [blame] | 638 | case 0x10: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 639 | pr_cont("%s.\n", f15h_mc1_mce_desc[xec-4]); |
Borislav Petkov | 6c1173a | 2011-11-21 19:45:34 +0100 | [diff] [blame] | 640 | break; |
| 641 | |
Aravind Gopalakrishnan | eba4bfb | 2014-07-14 16:58:19 +0200 | [diff] [blame] | 642 | case 0x11 ... 0x15: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 643 | 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] | 644 | break; |
| 645 | |
| 646 | default: |
| 647 | ret = false; |
| 648 | } |
| 649 | return ret; |
| 650 | } |
| 651 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 652 | static void decode_mc1_mce(struct mce *m) |
Borislav Petkov | ab5535e | 2009-07-28 14:06:26 +0200 | [diff] [blame] | 653 | { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 654 | u16 ec = EC(m->status); |
| 655 | u8 xec = XEC(m->status, xec_mask); |
Borislav Petkov | ab5535e | 2009-07-28 14:06:26 +0200 | [diff] [blame] | 656 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 657 | pr_emerg(HW_ERR "MC1 Error: "); |
Borislav Petkov | ab5535e | 2009-07-28 14:06:26 +0200 | [diff] [blame] | 658 | |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 659 | if (TLB_ERROR(ec)) |
| 660 | pr_cont("%s TLB %s.\n", LL_MSG(ec), |
| 661 | (xec ? "multimatch" : "parity error")); |
| 662 | else if (BUS_ERROR(ec)) { |
Borislav Petkov | 525906b | 2010-10-15 15:27:02 +0200 | [diff] [blame] | 663 | bool k8 = (boot_cpu_data.x86 == 0xf && (m->status & BIT_64(58))); |
Borislav Petkov | ab5535e | 2009-07-28 14:06:26 +0200 | [diff] [blame] | 664 | |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 665 | pr_cont("during %s.\n", (k8 ? "system linefill" : "NB data read")); |
Aravind Gopalakrishnan | eba4bfb | 2014-07-14 16:58:19 +0200 | [diff] [blame] | 666 | } else if (INT_ERROR(ec)) { |
| 667 | if (xec <= 0x3f) |
| 668 | pr_cont("Hardware Assert.\n"); |
| 669 | else |
| 670 | goto wrong_mc1_mce; |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 671 | } else if (fam_ops->mc1_mce(ec, xec)) |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 672 | ; |
| 673 | else |
Aravind Gopalakrishnan | eba4bfb | 2014-07-14 16:58:19 +0200 | [diff] [blame] | 674 | goto wrong_mc1_mce; |
| 675 | |
| 676 | return; |
| 677 | |
| 678 | wrong_mc1_mce: |
| 679 | pr_emerg(HW_ERR "Corrupted MC1 MCE info?\n"); |
Borislav Petkov | ab5535e | 2009-07-28 14:06:26 +0200 | [diff] [blame] | 680 | } |
| 681 | |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 682 | static bool k8_mc2_mce(u16 ec, u8 xec) |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 683 | { |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 684 | bool ret = true; |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 685 | |
| 686 | if (xec == 0x1) |
| 687 | pr_cont(" in the write data buffers.\n"); |
| 688 | else if (xec == 0x3) |
| 689 | pr_cont(" in the victim data buffers.\n"); |
| 690 | else if (xec == 0x2 && MEM_ERROR(ec)) |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 691 | 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] | 692 | else if (xec == 0x0) { |
| 693 | if (TLB_ERROR(ec)) |
Borislav Petkov | 50872cc | 2014-11-22 13:41:01 +0100 | [diff] [blame] | 694 | pr_cont("%s error in a Page Descriptor Cache or Guest TLB.\n", |
| 695 | TT_MSG(ec)); |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 696 | else if (BUS_ERROR(ec)) |
| 697 | pr_cont(": %s/ECC error in data read from NB: %s.\n", |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 698 | R4_MSG(ec), PP_MSG(ec)); |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 699 | else if (MEM_ERROR(ec)) { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 700 | u8 r4 = R4(ec); |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 701 | |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 702 | if (r4 >= 0x7) |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 703 | pr_cont(": %s error during data copyback.\n", |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 704 | R4_MSG(ec)); |
| 705 | else if (r4 <= 0x1) |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 706 | pr_cont(": %s parity/ECC error during data " |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 707 | "access from L2.\n", R4_MSG(ec)); |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 708 | else |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 709 | ret = false; |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 710 | } else |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 711 | ret = false; |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 712 | } else |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 713 | ret = false; |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 714 | |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 715 | return ret; |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 716 | } |
| 717 | |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 718 | static bool f15h_mc2_mce(u16 ec, u8 xec) |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 719 | { |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 720 | bool ret = true; |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 721 | |
| 722 | if (TLB_ERROR(ec)) { |
| 723 | if (xec == 0x0) |
| 724 | pr_cont("Data parity TLB read error.\n"); |
| 725 | else if (xec == 0x1) |
| 726 | pr_cont("Poison data provided for TLB fill.\n"); |
| 727 | else |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 728 | ret = false; |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 729 | } else if (BUS_ERROR(ec)) { |
| 730 | if (xec > 2) |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 731 | ret = false; |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 732 | |
| 733 | pr_cont("Error during attempted NB data read.\n"); |
| 734 | } else if (MEM_ERROR(ec)) { |
| 735 | switch (xec) { |
| 736 | case 0x4 ... 0xc: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 737 | pr_cont("%s.\n", f15h_mc2_mce_desc[xec - 0x4]); |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 738 | break; |
| 739 | |
| 740 | case 0x10 ... 0x14: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 741 | pr_cont("%s.\n", f15h_mc2_mce_desc[xec - 0x7]); |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 742 | break; |
| 743 | |
| 744 | default: |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 745 | ret = false; |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 746 | } |
Aravind Gopalakrishnan | eba4bfb | 2014-07-14 16:58:19 +0200 | [diff] [blame] | 747 | } else if (INT_ERROR(ec)) { |
| 748 | if (xec <= 0x3f) |
| 749 | pr_cont("Hardware Assert.\n"); |
| 750 | else |
| 751 | ret = false; |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 752 | } |
| 753 | |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 754 | return ret; |
| 755 | } |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 756 | |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 757 | static bool f16h_mc2_mce(u16 ec, u8 xec) |
| 758 | { |
| 759 | u8 r4 = R4(ec); |
| 760 | |
| 761 | if (!MEM_ERROR(ec)) |
| 762 | return false; |
| 763 | |
| 764 | switch (xec) { |
| 765 | case 0x04 ... 0x05: |
| 766 | pr_cont("%cBUFF parity error.\n", (r4 == R4_RD) ? 'I' : 'O'); |
| 767 | break; |
| 768 | |
| 769 | case 0x09 ... 0x0b: |
| 770 | case 0x0d ... 0x0f: |
| 771 | pr_cont("ECC error in L2 tag (%s).\n", |
| 772 | ((r4 == R4_GEN) ? "BankReq" : |
| 773 | ((r4 == R4_SNOOP) ? "Prb" : "Fill"))); |
| 774 | break; |
| 775 | |
| 776 | case 0x10 ... 0x19: |
| 777 | case 0x1b: |
| 778 | pr_cont("ECC error in L2 data array (%s).\n", |
| 779 | (((r4 == R4_RD) && !(xec & 0x3)) ? "Hit" : |
| 780 | ((r4 == R4_GEN) ? "Attr" : |
| 781 | ((r4 == R4_EVICT) ? "Vict" : "Fill")))); |
| 782 | break; |
| 783 | |
| 784 | case 0x1c ... 0x1d: |
| 785 | case 0x1f: |
| 786 | pr_cont("Parity error in L2 attribute bits (%s).\n", |
| 787 | ((r4 == R4_RD) ? "Hit" : |
| 788 | ((r4 == R4_GEN) ? "Attr" : "Fill"))); |
| 789 | break; |
| 790 | |
| 791 | default: |
| 792 | return false; |
| 793 | } |
| 794 | |
| 795 | return true; |
| 796 | } |
| 797 | |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 798 | static void decode_mc2_mce(struct mce *m) |
| 799 | { |
| 800 | u16 ec = EC(m->status); |
| 801 | u8 xec = XEC(m->status, xec_mask); |
| 802 | |
| 803 | pr_emerg(HW_ERR "MC2 Error: "); |
| 804 | |
| 805 | if (!fam_ops->mc2_mce(ec, xec)) |
| 806 | pr_cont(HW_ERR "Corrupted MC2 MCE info?\n"); |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 807 | } |
| 808 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 809 | static void decode_mc3_mce(struct mce *m) |
Borislav Petkov | f9350ef | 2009-07-28 14:17:30 +0200 | [diff] [blame] | 810 | { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 811 | u16 ec = EC(m->status); |
| 812 | u8 xec = XEC(m->status, xec_mask); |
Borislav Petkov | ded5062 | 2010-08-27 17:03:34 +0200 | [diff] [blame] | 813 | |
Borislav Petkov | b18434c | 2010-09-22 11:53:32 +0200 | [diff] [blame] | 814 | if (boot_cpu_data.x86 >= 0x14) { |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 815 | 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] | 816 | " please report on LKML.\n"); |
| 817 | return; |
| 818 | } |
Borislav Petkov | f9350ef | 2009-07-28 14:17:30 +0200 | [diff] [blame] | 819 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 820 | pr_emerg(HW_ERR "MC3 Error"); |
Borislav Petkov | f9350ef | 2009-07-28 14:17:30 +0200 | [diff] [blame] | 821 | |
| 822 | if (xec == 0x0) { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 823 | u8 r4 = R4(ec); |
Borislav Petkov | f9350ef | 2009-07-28 14:17:30 +0200 | [diff] [blame] | 824 | |
Borislav Petkov | ded5062 | 2010-08-27 17:03:34 +0200 | [diff] [blame] | 825 | if (!BUS_ERROR(ec) || (r4 != R4_DRD && r4 != R4_DWR)) |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 826 | goto wrong_mc3_mce; |
Borislav Petkov | f9350ef | 2009-07-28 14:17:30 +0200 | [diff] [blame] | 827 | |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 828 | pr_cont(" during %s.\n", R4_MSG(ec)); |
Borislav Petkov | ded5062 | 2010-08-27 17:03:34 +0200 | [diff] [blame] | 829 | } else |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 830 | goto wrong_mc3_mce; |
Borislav Petkov | ded5062 | 2010-08-27 17:03:34 +0200 | [diff] [blame] | 831 | |
Borislav Petkov | f9350ef | 2009-07-28 14:17:30 +0200 | [diff] [blame] | 832 | return; |
| 833 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 834 | wrong_mc3_mce: |
| 835 | pr_emerg(HW_ERR "Corrupted MC3 MCE info?\n"); |
Borislav Petkov | f9350ef | 2009-07-28 14:17:30 +0200 | [diff] [blame] | 836 | } |
| 837 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 838 | static void decode_mc4_mce(struct mce *m) |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 839 | { |
Borislav Petkov | f3c0891 | 2017-07-25 11:07:03 +0200 | [diff] [blame] | 840 | unsigned int fam = x86_family(m->cpuid); |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 841 | int node_id = amd_get_nb_id(m->extcpu); |
| 842 | u16 ec = EC(m->status); |
| 843 | u8 xec = XEC(m->status, 0x1f); |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 844 | u8 offset = 0; |
| 845 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 846 | pr_emerg(HW_ERR "MC4 Error (node %d): ", node_id); |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 847 | |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 848 | switch (xec) { |
| 849 | case 0x0 ... 0xe: |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 850 | |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 851 | /* special handling for DRAM ECCs */ |
| 852 | if (xec == 0x0 || xec == 0x8) { |
| 853 | /* no ECCs on F11h */ |
Borislav Petkov | f3c0891 | 2017-07-25 11:07:03 +0200 | [diff] [blame] | 854 | if (fam == 0x11) |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 855 | goto wrong_mc4_mce; |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 856 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 857 | pr_cont("%s.\n", mc4_mce_desc[xec]); |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 858 | |
Yazen Ghannam | 5c33220 | 2016-11-17 17:57:29 -0500 | [diff] [blame] | 859 | if (decode_dram_ecc) |
| 860 | decode_dram_ecc(node_id, m); |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 861 | return; |
| 862 | } |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 863 | break; |
| 864 | |
| 865 | case 0xf: |
| 866 | if (TLB_ERROR(ec)) |
| 867 | pr_cont("GART Table Walk data error.\n"); |
| 868 | else if (BUS_ERROR(ec)) |
| 869 | pr_cont("DMA Exclusion Vector Table Walk error.\n"); |
| 870 | else |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 871 | goto wrong_mc4_mce; |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 872 | return; |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 873 | |
Borislav Petkov | 05cd667 | 2010-09-22 15:06:24 +0200 | [diff] [blame] | 874 | case 0x19: |
Borislav Petkov | f3c0891 | 2017-07-25 11:07:03 +0200 | [diff] [blame] | 875 | if (fam == 0x15 || fam == 0x16) |
Borislav Petkov | 05cd667 | 2010-09-22 15:06:24 +0200 | [diff] [blame] | 876 | pr_cont("Compute Unit Data Error.\n"); |
| 877 | else |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 878 | goto wrong_mc4_mce; |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 879 | return; |
Borislav Petkov | 05cd667 | 2010-09-22 15:06:24 +0200 | [diff] [blame] | 880 | |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 881 | case 0x1c ... 0x1f: |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 882 | offset = 13; |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 883 | break; |
| 884 | |
| 885 | default: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 886 | goto wrong_mc4_mce; |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 887 | } |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 888 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 889 | pr_cont("%s.\n", mc4_mce_desc[xec - offset]); |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 890 | return; |
| 891 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 892 | wrong_mc4_mce: |
| 893 | pr_emerg(HW_ERR "Corrupted MC4 MCE info?\n"); |
Borislav Petkov | d93cc22 | 2009-07-28 10:56:15 +0200 | [diff] [blame] | 894 | } |
Borislav Petkov | d93cc22 | 2009-07-28 10:56:15 +0200 | [diff] [blame] | 895 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 896 | static void decode_mc5_mce(struct mce *m) |
Borislav Petkov | 53bd5fe | 2009-07-28 14:20:46 +0200 | [diff] [blame] | 897 | { |
Borislav Petkov | f3c0891 | 2017-07-25 11:07:03 +0200 | [diff] [blame] | 898 | unsigned int fam = x86_family(m->cpuid); |
Aravind Gopalakrishnan | eba4bfb | 2014-07-14 16:58:19 +0200 | [diff] [blame] | 899 | u16 ec = EC(m->status); |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 900 | u8 xec = XEC(m->status, xec_mask); |
Borislav Petkov | 8259a7e | 2010-09-22 15:28:59 +0200 | [diff] [blame] | 901 | |
Borislav Petkov | f3c0891 | 2017-07-25 11:07:03 +0200 | [diff] [blame] | 902 | if (fam == 0xf || fam == 0x11) |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 903 | goto wrong_mc5_mce; |
Borislav Petkov | fe4ea26 | 2010-08-31 18:38:24 +0200 | [diff] [blame] | 904 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 905 | pr_emerg(HW_ERR "MC5 Error: "); |
Borislav Petkov | 8259a7e | 2010-09-22 15:28:59 +0200 | [diff] [blame] | 906 | |
Aravind Gopalakrishnan | eba4bfb | 2014-07-14 16:58:19 +0200 | [diff] [blame] | 907 | if (INT_ERROR(ec)) { |
| 908 | if (xec <= 0x1f) { |
| 909 | pr_cont("Hardware Assert.\n"); |
| 910 | return; |
| 911 | } else |
| 912 | goto wrong_mc5_mce; |
| 913 | } |
| 914 | |
Borislav Petkov | 8259a7e | 2010-09-22 15:28:59 +0200 | [diff] [blame] | 915 | if (xec == 0x0 || xec == 0xc) |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 916 | pr_cont("%s.\n", mc5_mce_desc[xec]); |
Aravind Gopalakrishnan | aad19e5 | 2013-06-05 15:50:03 -0500 | [diff] [blame] | 917 | else if (xec <= 0xd) |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 918 | pr_cont("%s parity error.\n", mc5_mce_desc[xec]); |
Borislav Petkov | 8259a7e | 2010-09-22 15:28:59 +0200 | [diff] [blame] | 919 | else |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 920 | goto wrong_mc5_mce; |
Borislav Petkov | 8259a7e | 2010-09-22 15:28:59 +0200 | [diff] [blame] | 921 | |
| 922 | return; |
Borislav Petkov | fe4ea26 | 2010-08-31 18:38:24 +0200 | [diff] [blame] | 923 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 924 | wrong_mc5_mce: |
| 925 | pr_emerg(HW_ERR "Corrupted MC5 MCE info?\n"); |
Borislav Petkov | 53bd5fe | 2009-07-28 14:20:46 +0200 | [diff] [blame] | 926 | } |
| 927 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 928 | static void decode_mc6_mce(struct mce *m) |
Borislav Petkov | b8f85c4 | 2010-09-22 15:37:58 +0200 | [diff] [blame] | 929 | { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 930 | u8 xec = XEC(m->status, xec_mask); |
Borislav Petkov | b8f85c4 | 2010-09-22 15:37:58 +0200 | [diff] [blame] | 931 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 932 | pr_emerg(HW_ERR "MC6 Error: "); |
Borislav Petkov | b8f85c4 | 2010-09-22 15:37:58 +0200 | [diff] [blame] | 933 | |
Aravind Gopalakrishnan | bc4febe | 2014-11-04 11:41:08 -0600 | [diff] [blame] | 934 | if (xec > 0x5) |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 935 | goto wrong_mc6_mce; |
Borislav Petkov | b8f85c4 | 2010-09-22 15:37:58 +0200 | [diff] [blame] | 936 | |
Aravind Gopalakrishnan | bc4febe | 2014-11-04 11:41:08 -0600 | [diff] [blame] | 937 | pr_cont("%s parity error.\n", mc6_mce_desc[xec]); |
Borislav Petkov | b8f85c4 | 2010-09-22 15:37:58 +0200 | [diff] [blame] | 938 | return; |
| 939 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 940 | wrong_mc6_mce: |
| 941 | pr_emerg(HW_ERR "Corrupted MC6 MCE info?\n"); |
Borislav Petkov | b8f85c4 | 2010-09-22 15:37:58 +0200 | [diff] [blame] | 942 | } |
| 943 | |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 944 | /* Decode errors according to Scalable MCA specification */ |
Borislav Petkov | 4ab1784 | 2017-07-25 10:44:59 +0200 | [diff] [blame] | 945 | static void decode_smca_error(struct mce *m) |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 946 | { |
Borislav Petkov | 1ce9cd7 | 2016-11-02 12:48:01 +0100 | [diff] [blame] | 947 | struct smca_hwid *hwid; |
Yazen Ghannam | 68627a6 | 2018-02-21 11:18:58 +0100 | [diff] [blame] | 948 | enum smca_bank_types bank_type; |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 949 | const char *ip_name; |
Yazen Ghannam | 5896820 | 2016-09-12 09:59:34 +0200 | [diff] [blame] | 950 | u8 xec = XEC(m->status, xec_mask); |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 951 | |
Yazen Ghannam | 5896820 | 2016-09-12 09:59:34 +0200 | [diff] [blame] | 952 | if (m->bank >= ARRAY_SIZE(smca_banks)) |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 953 | return; |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 954 | |
Borislav Petkov | 1ce9cd7 | 2016-11-02 12:48:01 +0100 | [diff] [blame] | 955 | hwid = smca_banks[m->bank].hwid; |
| 956 | if (!hwid) |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 957 | return; |
Yazen Ghannam | 5896820 | 2016-09-12 09:59:34 +0200 | [diff] [blame] | 958 | |
Borislav Petkov | 1ce9cd7 | 2016-11-02 12:48:01 +0100 | [diff] [blame] | 959 | bank_type = hwid->bank_type; |
Yazen Ghannam | 68627a6 | 2018-02-21 11:18:58 +0100 | [diff] [blame] | 960 | |
| 961 | if (bank_type == SMCA_RESERVED) { |
| 962 | pr_emerg(HW_ERR "Bank %d is reserved.\n", m->bank); |
| 963 | return; |
| 964 | } |
| 965 | |
Borislav Petkov | c09a8c4 | 2016-11-03 21:12:33 +0100 | [diff] [blame] | 966 | ip_name = smca_get_long_name(bank_type); |
Yazen Ghannam | 5896820 | 2016-09-12 09:59:34 +0200 | [diff] [blame] | 967 | |
Yazen Ghannam | 1c1522d | 2019-02-01 22:55:54 +0000 | [diff] [blame] | 968 | pr_emerg(HW_ERR "%s Ext. Error Code: %d", ip_name, xec); |
Yazen Ghannam | 5896820 | 2016-09-12 09:59:34 +0200 | [diff] [blame] | 969 | |
| 970 | /* Only print the decode of valid error codes */ |
| 971 | if (xec < smca_mce_descs[bank_type].num_descs && |
Borislav Petkov | 1ce9cd7 | 2016-11-02 12:48:01 +0100 | [diff] [blame] | 972 | (hwid->xec_bitmap & BIT_ULL(xec))) { |
Yazen Ghannam | 1c1522d | 2019-02-01 22:55:54 +0000 | [diff] [blame] | 973 | pr_cont(", %s.\n", smca_mce_descs[bank_type].descs[xec]); |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 974 | } |
Yazen Ghannam | 5c33220 | 2016-11-17 17:57:29 -0500 | [diff] [blame] | 975 | |
Yazen Ghannam | 5c33220 | 2016-11-17 17:57:29 -0500 | [diff] [blame] | 976 | if (bank_type == SMCA_UMC && xec == 0 && decode_dram_ecc) |
Yazen Ghannam | fbe63ac | 2017-03-20 15:26:51 -0500 | [diff] [blame] | 977 | decode_dram_ecc(cpu_to_node(m->extcpu), m); |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 978 | } |
| 979 | |
Borislav Petkov | 6337583 | 2010-09-06 18:13:39 +0200 | [diff] [blame] | 980 | static inline void amd_decode_err_code(u16 ec) |
Borislav Petkov | d93cc22 | 2009-07-28 10:56:15 +0200 | [diff] [blame] | 981 | { |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 982 | if (INT_ERROR(ec)) { |
| 983 | pr_emerg(HW_ERR "internal: %s\n", UU_MSG(ec)); |
| 984 | return; |
| 985 | } |
Borislav Petkov | fa7ae8c | 2010-09-22 17:42:27 +0200 | [diff] [blame] | 986 | |
| 987 | pr_emerg(HW_ERR "cache level: %s", LL_MSG(ec)); |
| 988 | |
| 989 | if (BUS_ERROR(ec)) |
| 990 | pr_cont(", mem/io: %s", II_MSG(ec)); |
| 991 | else |
| 992 | pr_cont(", tx: %s", TT_MSG(ec)); |
| 993 | |
| 994 | if (MEM_ERROR(ec) || BUS_ERROR(ec)) { |
| 995 | pr_cont(", mem-tx: %s", R4_MSG(ec)); |
| 996 | |
| 997 | if (BUS_ERROR(ec)) |
| 998 | pr_cont(", part-proc: %s (%s)", PP_MSG(ec), TO_MSG(ec)); |
| 999 | } |
| 1000 | |
| 1001 | pr_cont("\n"); |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 1002 | } |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 1003 | |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 1004 | /* |
| 1005 | * Filter out unwanted MCE signatures here. |
| 1006 | */ |
| 1007 | static bool amd_filter_mce(struct mce *m) |
| 1008 | { |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 1009 | /* |
| 1010 | * NB GART TLB error reporting is disabled by default. |
| 1011 | */ |
Borislav Petkov | 3984434 | 2017-07-25 11:09:56 +0200 | [diff] [blame] | 1012 | if (m->bank == 4 && XEC(m->status, 0x1f) == 0x5 && !report_gart_errors) |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 1013 | return true; |
| 1014 | |
| 1015 | return false; |
| 1016 | } |
| 1017 | |
Borislav Petkov | d5c6770 | 2012-09-14 20:25:37 +0200 | [diff] [blame] | 1018 | static const char *decode_error_status(struct mce *m) |
| 1019 | { |
| 1020 | if (m->status & MCI_STATUS_UC) { |
| 1021 | if (m->status & MCI_STATUS_PCC) |
| 1022 | return "System Fatal error."; |
| 1023 | if (m->mcgstatus & MCG_STATUS_RIPV) |
| 1024 | return "Uncorrected, software restartable error."; |
| 1025 | return "Uncorrected, software containable error."; |
| 1026 | } |
| 1027 | |
| 1028 | if (m->status & MCI_STATUS_DEFERRED) |
Yazen Ghannam | 67d7fd3 | 2017-01-24 16:32:23 -0600 | [diff] [blame] | 1029 | return "Deferred error, no action required."; |
Borislav Petkov | d5c6770 | 2012-09-14 20:25:37 +0200 | [diff] [blame] | 1030 | |
| 1031 | return "Corrected error, no action required."; |
| 1032 | } |
| 1033 | |
Borislav Petkov | 1fbcd90 | 2017-01-23 19:35:11 +0100 | [diff] [blame] | 1034 | static int |
| 1035 | amd_decode_mce(struct notifier_block *nb, unsigned long val, void *data) |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 1036 | { |
Borislav Petkov | fb25319 | 2009-10-07 13:20:38 +0200 | [diff] [blame] | 1037 | struct mce *m = (struct mce *)data; |
Borislav Petkov | f3c0891 | 2017-07-25 11:07:03 +0200 | [diff] [blame] | 1038 | unsigned int fam = x86_family(m->cpuid); |
Borislav Petkov | b0b07a2 | 2011-08-24 18:44:22 +0200 | [diff] [blame] | 1039 | int ecc; |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 1040 | |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 1041 | if (amd_filter_mce(m)) |
| 1042 | return NOTIFY_STOP; |
| 1043 | |
Borislav Petkov | fd0f5fff | 2014-02-17 20:51:52 +0100 | [diff] [blame] | 1044 | pr_emerg(HW_ERR "%s\n", decode_error_status(m)); |
| 1045 | |
| 1046 | pr_emerg(HW_ERR "CPU:%d (%x:%x:%x) MC%d_STATUS[%s|%s|%s|%s|%s", |
| 1047 | m->extcpu, |
Borislav Petkov | f3c0891 | 2017-07-25 11:07:03 +0200 | [diff] [blame] | 1048 | fam, x86_model(m->cpuid), x86_stepping(m->cpuid), |
Borislav Petkov | fd0f5fff | 2014-02-17 20:51:52 +0100 | [diff] [blame] | 1049 | m->bank, |
| 1050 | ((m->status & MCI_STATUS_OVER) ? "Over" : "-"), |
Aravind Gopalakrishnan | 99e1dfb | 2015-07-13 06:53:02 -0500 | [diff] [blame] | 1051 | ((m->status & MCI_STATUS_UC) ? "UE" : |
| 1052 | (m->status & MCI_STATUS_DEFERRED) ? "-" : "CE"), |
Borislav Petkov | fd0f5fff | 2014-02-17 20:51:52 +0100 | [diff] [blame] | 1053 | ((m->status & MCI_STATUS_MISCV) ? "MiscV" : "-"), |
Yazen Ghannam | a0bcd3c | 2019-02-12 21:24:29 +0000 | [diff] [blame^] | 1054 | ((m->status & MCI_STATUS_ADDRV) ? "AddrV" : "-"), |
| 1055 | ((m->status & MCI_STATUS_PCC) ? "PCC" : "-")); |
| 1056 | |
| 1057 | if (boot_cpu_has(X86_FEATURE_SMCA)) { |
| 1058 | u32 low, high; |
| 1059 | u32 addr = MSR_AMD64_SMCA_MCx_CONFIG(m->bank); |
| 1060 | |
| 1061 | if (!rdmsr_safe(addr, &low, &high) && |
| 1062 | (low & MCI_CONFIG_MCAX)) |
| 1063 | pr_cont("|%s", ((m->status & MCI_STATUS_TCC) ? "TCC" : "-")); |
| 1064 | |
| 1065 | pr_cont("|%s", ((m->status & MCI_STATUS_SYNDV) ? "SyndV" : "-")); |
| 1066 | } |
| 1067 | |
| 1068 | /* do the two bits[14:13] together */ |
| 1069 | ecc = (m->status >> 45) & 0x3; |
| 1070 | if (ecc) |
| 1071 | pr_cont("|%sECC", ((ecc == 2) ? "C" : "U")); |
Borislav Petkov | fd0f5fff | 2014-02-17 20:51:52 +0100 | [diff] [blame] | 1072 | |
Borislav Petkov | f3c0891 | 2017-07-25 11:07:03 +0200 | [diff] [blame] | 1073 | if (fam >= 0x15) { |
Yazen Ghannam | a6c14dc | 2016-11-18 09:10:22 -0500 | [diff] [blame] | 1074 | pr_cont("|%s", (m->status & MCI_STATUS_DEFERRED ? "Deferred" : "-")); |
| 1075 | |
| 1076 | /* F15h, bank4, bit 43 is part of McaStatSubCache. */ |
Borislav Petkov | f3c0891 | 2017-07-25 11:07:03 +0200 | [diff] [blame] | 1077 | if (fam != 0x15 || m->bank != 4) |
Yazen Ghannam | a6c14dc | 2016-11-18 09:10:22 -0500 | [diff] [blame] | 1078 | pr_cont("|%s", (m->status & MCI_STATUS_POISON ? "Poison" : "-")); |
| 1079 | } |
Borislav Petkov | fd0f5fff | 2014-02-17 20:51:52 +0100 | [diff] [blame] | 1080 | |
Yazen Ghannam | 3f4da37 | 2019-02-12 21:24:28 +0000 | [diff] [blame] | 1081 | if (fam >= 0x17) |
| 1082 | pr_cont("|%s", (m->status & MCI_STATUS_SCRUB ? "Scrub" : "-")); |
| 1083 | |
Borislav Petkov | fd0f5fff | 2014-02-17 20:51:52 +0100 | [diff] [blame] | 1084 | pr_cont("]: 0x%016llx\n", m->status); |
| 1085 | |
| 1086 | if (m->status & MCI_STATUS_ADDRV) |
Yazen Ghannam | 75bf2f6 | 2017-02-15 14:56:22 -0600 | [diff] [blame] | 1087 | pr_emerg(HW_ERR "Error Addr: 0x%016llx\n", m->addr); |
Borislav Petkov | fd0f5fff | 2014-02-17 20:51:52 +0100 | [diff] [blame] | 1088 | |
Yazen Ghannam | a348ed8 | 2016-05-11 14:58:28 +0200 | [diff] [blame] | 1089 | if (boot_cpu_has(X86_FEATURE_SMCA)) { |
Yazen Ghannam | 75bf2f6 | 2017-02-15 14:56:22 -0600 | [diff] [blame] | 1090 | pr_emerg(HW_ERR "IPID: 0x%016llx", m->ipid); |
| 1091 | |
Yazen Ghannam | b300e87 | 2016-09-12 09:59:29 +0200 | [diff] [blame] | 1092 | if (m->status & MCI_STATUS_SYNDV) |
| 1093 | pr_cont(", Syndrome: 0x%016llx", m->synd); |
| 1094 | |
| 1095 | pr_cont("\n"); |
| 1096 | |
Borislav Petkov | 4ab1784 | 2017-07-25 10:44:59 +0200 | [diff] [blame] | 1097 | decode_smca_error(m); |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 1098 | goto err_code; |
Yazen Ghannam | 75bf2f6 | 2017-02-15 14:56:22 -0600 | [diff] [blame] | 1099 | } |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 1100 | |
Borislav Petkov | 0bceab6 | 2017-01-23 19:35:12 +0100 | [diff] [blame] | 1101 | if (m->tsc) |
| 1102 | pr_emerg(HW_ERR "TSC: %llu\n", m->tsc); |
| 1103 | |
Borislav Petkov | fd0f5fff | 2014-02-17 20:51:52 +0100 | [diff] [blame] | 1104 | if (!fam_ops) |
| 1105 | goto err_code; |
| 1106 | |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 1107 | switch (m->bank) { |
| 1108 | case 0: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 1109 | decode_mc0_mce(m); |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 1110 | break; |
Borislav Petkov | d93cc22 | 2009-07-28 10:56:15 +0200 | [diff] [blame] | 1111 | |
Borislav Petkov | ab5535e | 2009-07-28 14:06:26 +0200 | [diff] [blame] | 1112 | case 1: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 1113 | decode_mc1_mce(m); |
Borislav Petkov | ab5535e | 2009-07-28 14:06:26 +0200 | [diff] [blame] | 1114 | break; |
| 1115 | |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 1116 | case 2: |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 1117 | decode_mc2_mce(m); |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 1118 | break; |
| 1119 | |
Borislav Petkov | f9350ef | 2009-07-28 14:17:30 +0200 | [diff] [blame] | 1120 | case 3: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 1121 | decode_mc3_mce(m); |
Borislav Petkov | f9350ef | 2009-07-28 14:17:30 +0200 | [diff] [blame] | 1122 | break; |
| 1123 | |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 1124 | case 4: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 1125 | decode_mc4_mce(m); |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 1126 | break; |
| 1127 | |
Borislav Petkov | 53bd5fe | 2009-07-28 14:20:46 +0200 | [diff] [blame] | 1128 | case 5: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 1129 | decode_mc5_mce(m); |
Borislav Petkov | 53bd5fe | 2009-07-28 14:20:46 +0200 | [diff] [blame] | 1130 | break; |
| 1131 | |
Borislav Petkov | b8f85c4 | 2010-09-22 15:37:58 +0200 | [diff] [blame] | 1132 | case 6: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 1133 | decode_mc6_mce(m); |
Borislav Petkov | b8f85c4 | 2010-09-22 15:37:58 +0200 | [diff] [blame] | 1134 | break; |
| 1135 | |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 1136 | default: |
| 1137 | break; |
Borislav Petkov | b69b29d | 2009-07-27 16:21:14 +0200 | [diff] [blame] | 1138 | } |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 1139 | |
Borislav Petkov | fd0f5fff | 2014-02-17 20:51:52 +0100 | [diff] [blame] | 1140 | err_code: |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 1141 | amd_decode_err_code(m->status & 0xffff); |
Borislav Petkov | fb25319 | 2009-10-07 13:20:38 +0200 | [diff] [blame] | 1142 | |
| 1143 | return NOTIFY_STOP; |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 1144 | } |
Ingo Molnar | f436f8b | 2009-10-01 16:14:32 +0200 | [diff] [blame] | 1145 | |
Borislav Petkov | fb25319 | 2009-10-07 13:20:38 +0200 | [diff] [blame] | 1146 | static struct notifier_block amd_mce_dec_nb = { |
| 1147 | .notifier_call = amd_decode_mce, |
Borislav Petkov | 9026cc8 | 2017-01-23 19:35:14 +0100 | [diff] [blame] | 1148 | .priority = MCE_PRIO_EDAC, |
Borislav Petkov | fb25319 | 2009-10-07 13:20:38 +0200 | [diff] [blame] | 1149 | }; |
| 1150 | |
Ingo Molnar | f436f8b | 2009-10-01 16:14:32 +0200 | [diff] [blame] | 1151 | static int __init mce_amd_init(void) |
| 1152 | { |
Borislav Petkov | bad11e0 | 2010-09-22 17:44:51 +0200 | [diff] [blame] | 1153 | struct cpuinfo_x86 *c = &boot_cpu_data; |
| 1154 | |
Pu Wen | c4a3e94 | 2018-09-27 16:31:28 +0200 | [diff] [blame] | 1155 | if (c->x86_vendor != X86_VENDOR_AMD && |
| 1156 | c->x86_vendor != X86_VENDOR_HYGON) |
Borislav Petkov | fd0f5fff | 2014-02-17 20:51:52 +0100 | [diff] [blame] | 1157 | return -ENODEV; |
Borislav Petkov | e045c29 | 2010-08-06 18:55:45 +0200 | [diff] [blame] | 1158 | |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 1159 | fam_ops = kzalloc(sizeof(struct amd_decoder_ops), GFP_KERNEL); |
| 1160 | if (!fam_ops) |
| 1161 | return -ENOMEM; |
| 1162 | |
Borislav Petkov | bad11e0 | 2010-09-22 17:44:51 +0200 | [diff] [blame] | 1163 | switch (c->x86) { |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 1164 | case 0xf: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 1165 | fam_ops->mc0_mce = k8_mc0_mce; |
| 1166 | fam_ops->mc1_mce = k8_mc1_mce; |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 1167 | fam_ops->mc2_mce = k8_mc2_mce; |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 1168 | break; |
| 1169 | |
| 1170 | case 0x10: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 1171 | fam_ops->mc0_mce = f10h_mc0_mce; |
| 1172 | fam_ops->mc1_mce = k8_mc1_mce; |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 1173 | fam_ops->mc2_mce = k8_mc2_mce; |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 1174 | break; |
| 1175 | |
Borislav Petkov | f0157b3 | 2010-10-05 19:07:16 +0200 | [diff] [blame] | 1176 | case 0x11: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 1177 | fam_ops->mc0_mce = k8_mc0_mce; |
| 1178 | fam_ops->mc1_mce = k8_mc1_mce; |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 1179 | fam_ops->mc2_mce = k8_mc2_mce; |
Borislav Petkov | f0157b3 | 2010-10-05 19:07:16 +0200 | [diff] [blame] | 1180 | break; |
| 1181 | |
Borislav Petkov | 9be0bb1 | 2010-09-16 15:08:14 +0200 | [diff] [blame] | 1182 | case 0x12: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 1183 | fam_ops->mc0_mce = f12h_mc0_mce; |
| 1184 | fam_ops->mc1_mce = k8_mc1_mce; |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 1185 | fam_ops->mc2_mce = k8_mc2_mce; |
Borislav Petkov | 9be0bb1 | 2010-09-16 15:08:14 +0200 | [diff] [blame] | 1186 | break; |
| 1187 | |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 1188 | case 0x14: |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 1189 | fam_ops->mc0_mce = cat_mc0_mce; |
| 1190 | fam_ops->mc1_mce = cat_mc1_mce; |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 1191 | fam_ops->mc2_mce = k8_mc2_mce; |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 1192 | break; |
| 1193 | |
Borislav Petkov | 2be64bf | 2010-09-17 19:11:47 +0200 | [diff] [blame] | 1194 | case 0x15: |
Aravind Gopalakrishnan | eba4bfb | 2014-07-14 16:58:19 +0200 | [diff] [blame] | 1195 | xec_mask = c->x86_model == 0x60 ? 0x3f : 0x1f; |
| 1196 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 1197 | fam_ops->mc0_mce = f15h_mc0_mce; |
| 1198 | fam_ops->mc1_mce = f15h_mc1_mce; |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 1199 | fam_ops->mc2_mce = f15h_mc2_mce; |
Borislav Petkov | 2be64bf | 2010-09-17 19:11:47 +0200 | [diff] [blame] | 1200 | break; |
| 1201 | |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 1202 | case 0x16: |
| 1203 | xec_mask = 0x1f; |
| 1204 | fam_ops->mc0_mce = cat_mc0_mce; |
| 1205 | fam_ops->mc1_mce = cat_mc1_mce; |
| 1206 | fam_ops->mc2_mce = f16h_mc2_mce; |
| 1207 | break; |
| 1208 | |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 1209 | case 0x17: |
Pu Wen | c4a3e94 | 2018-09-27 16:31:28 +0200 | [diff] [blame] | 1210 | case 0x18: |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 1211 | xec_mask = 0x3f; |
Yazen Ghannam | a348ed8 | 2016-05-11 14:58:28 +0200 | [diff] [blame] | 1212 | if (!boot_cpu_has(X86_FEATURE_SMCA)) { |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 1213 | printk(KERN_WARNING "Decoding supported only on Scalable MCA processors.\n"); |
| 1214 | goto err_out; |
| 1215 | } |
| 1216 | break; |
| 1217 | |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 1218 | default: |
Borislav Petkov | ec3e82d | 2012-04-04 14:21:02 +0200 | [diff] [blame] | 1219 | 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] | 1220 | goto err_out; |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 1221 | } |
| 1222 | |
Borislav Petkov | 9530d60 | 2010-09-06 15:05:45 +0200 | [diff] [blame] | 1223 | pr_info("MCE: In-kernel MCE decoding enabled.\n"); |
| 1224 | |
Borislav Petkov | 3653ada | 2011-12-04 15:12:09 +0100 | [diff] [blame] | 1225 | mce_register_decode_chain(&amd_mce_dec_nb); |
Ingo Molnar | f436f8b | 2009-10-01 16:14:32 +0200 | [diff] [blame] | 1226 | |
| 1227 | return 0; |
Aravind Gopalakrishnan | be0aec2 | 2016-03-07 14:02:18 +0100 | [diff] [blame] | 1228 | |
| 1229 | err_out: |
| 1230 | kfree(fam_ops); |
| 1231 | fam_ops = NULL; |
| 1232 | return -EINVAL; |
Ingo Molnar | f436f8b | 2009-10-01 16:14:32 +0200 | [diff] [blame] | 1233 | } |
| 1234 | early_initcall(mce_amd_init); |
Borislav Petkov | 0d18b2e | 2009-10-02 15:31:48 +0200 | [diff] [blame] | 1235 | |
| 1236 | #ifdef MODULE |
| 1237 | static void __exit mce_amd_exit(void) |
| 1238 | { |
Borislav Petkov | 3653ada | 2011-12-04 15:12:09 +0100 | [diff] [blame] | 1239 | mce_unregister_decode_chain(&amd_mce_dec_nb); |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 1240 | kfree(fam_ops); |
Borislav Petkov | 0d18b2e | 2009-10-02 15:31:48 +0200 | [diff] [blame] | 1241 | } |
| 1242 | |
| 1243 | MODULE_DESCRIPTION("AMD MCE decoder"); |
| 1244 | MODULE_ALIAS("edac-mce-amd"); |
| 1245 | MODULE_LICENSE("GPL"); |
| 1246 | module_exit(mce_amd_exit); |
| 1247 | #endif |