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