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