Borislav Petkov | b70ef01 | 2009-06-25 19:32:38 +0200 | [diff] [blame] | 1 | #include <linux/module.h> |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 2 | #include <linux/slab.h> |
| 3 | |
Borislav Petkov | 47ca08a | 2010-09-27 15:30:39 +0200 | [diff] [blame] | 4 | #include "mce_amd.h" |
Doug Thompson | b52401ce | 2009-05-06 17:57:20 +0200 | [diff] [blame] | 5 | |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 6 | static struct amd_decoder_ops *fam_ops; |
| 7 | |
Borislav Petkov | 2be64bf | 2010-09-17 19:11:47 +0200 | [diff] [blame] | 8 | static u8 xec_mask = 0xf; |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 9 | |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 10 | static bool report_gart_errors; |
Borislav Petkov | b0b07a2 | 2011-08-24 18:44:22 +0200 | [diff] [blame] | 11 | static void (*nb_bus_decoder)(int node_id, struct mce *m); |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 12 | |
| 13 | void amd_report_gart_errors(bool v) |
| 14 | { |
| 15 | report_gart_errors = v; |
| 16 | } |
| 17 | EXPORT_SYMBOL_GPL(amd_report_gart_errors); |
| 18 | |
Borislav Petkov | b0b07a2 | 2011-08-24 18:44:22 +0200 | [diff] [blame] | 19 | void amd_register_ecc_decoder(void (*f)(int, struct mce *)) |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 20 | { |
| 21 | nb_bus_decoder = f; |
| 22 | } |
| 23 | EXPORT_SYMBOL_GPL(amd_register_ecc_decoder); |
| 24 | |
Borislav Petkov | b0b07a2 | 2011-08-24 18:44:22 +0200 | [diff] [blame] | 25 | void amd_unregister_ecc_decoder(void (*f)(int, struct mce *)) |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 26 | { |
| 27 | if (nb_bus_decoder) { |
| 28 | WARN_ON(nb_bus_decoder != f); |
| 29 | |
| 30 | nb_bus_decoder = NULL; |
| 31 | } |
| 32 | } |
| 33 | EXPORT_SYMBOL_GPL(amd_unregister_ecc_decoder); |
| 34 | |
Doug Thompson | b52401ce | 2009-05-06 17:57:20 +0200 | [diff] [blame] | 35 | /* |
| 36 | * string representation for the different MCA reported error types, see F3x48 |
| 37 | * or MSR0000_0411. |
| 38 | */ |
Borislav Petkov | 6337583 | 2010-09-06 18:13:39 +0200 | [diff] [blame] | 39 | |
| 40 | /* transaction type */ |
Borislav Petkov | 0f08669 | 2012-12-23 12:40:45 +0100 | [diff] [blame] | 41 | static const char * const tt_msgs[] = { "INSN", "DATA", "GEN", "RESV" }; |
Doug Thompson | b52401ce | 2009-05-06 17:57:20 +0200 | [diff] [blame] | 42 | |
Borislav Petkov | 6337583 | 2010-09-06 18:13:39 +0200 | [diff] [blame] | 43 | /* cache level */ |
Borislav Petkov | 0f08669 | 2012-12-23 12:40:45 +0100 | [diff] [blame] | 44 | static const char * const ll_msgs[] = { "RESV", "L1", "L2", "L3/GEN" }; |
Doug Thompson | b52401ce | 2009-05-06 17:57:20 +0200 | [diff] [blame] | 45 | |
Borislav Petkov | 6337583 | 2010-09-06 18:13:39 +0200 | [diff] [blame] | 46 | /* memory transaction type */ |
Borislav Petkov | 0f08669 | 2012-12-23 12:40:45 +0100 | [diff] [blame] | 47 | static const char * const rrrr_msgs[] = { |
Borislav Petkov | 6337583 | 2010-09-06 18:13:39 +0200 | [diff] [blame] | 48 | "GEN", "RD", "WR", "DRD", "DWR", "IRD", "PRF", "EV", "SNP" |
Doug Thompson | b52401ce | 2009-05-06 17:57:20 +0200 | [diff] [blame] | 49 | }; |
| 50 | |
Borislav Petkov | 6337583 | 2010-09-06 18:13:39 +0200 | [diff] [blame] | 51 | /* participating processor */ |
Borislav Petkov | ebe2aea | 2011-11-29 19:03:25 +0100 | [diff] [blame] | 52 | const char * const pp_msgs[] = { "SRC", "RES", "OBS", "GEN" }; |
Borislav Petkov | b70ef01 | 2009-06-25 19:32:38 +0200 | [diff] [blame] | 53 | EXPORT_SYMBOL_GPL(pp_msgs); |
Doug Thompson | b52401ce | 2009-05-06 17:57:20 +0200 | [diff] [blame] | 54 | |
Borislav Petkov | 6337583 | 2010-09-06 18:13:39 +0200 | [diff] [blame] | 55 | /* request timeout */ |
Borislav Petkov | 0f08669 | 2012-12-23 12:40:45 +0100 | [diff] [blame] | 56 | static const char * const to_msgs[] = { "no timeout", "timed out" }; |
Doug Thompson | b52401ce | 2009-05-06 17:57:20 +0200 | [diff] [blame] | 57 | |
Borislav Petkov | 6337583 | 2010-09-06 18:13:39 +0200 | [diff] [blame] | 58 | /* memory or i/o */ |
Borislav Petkov | 0f08669 | 2012-12-23 12:40:45 +0100 | [diff] [blame] | 59 | static const char * const ii_msgs[] = { "MEM", "RESV", "IO", "GEN" }; |
Doug Thompson | b52401ce | 2009-05-06 17:57:20 +0200 | [diff] [blame] | 60 | |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 61 | /* internal error type */ |
Borislav Petkov | 0f08669 | 2012-12-23 12:40:45 +0100 | [diff] [blame] | 62 | static const char * const uu_msgs[] = { "RESV", "RESV", "HWA", "RESV" }; |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 63 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 64 | static const char * const f15h_mc1_mce_desc[] = { |
Borislav Petkov | 86039cd | 2010-11-08 15:03:35 +0100 | [diff] [blame] | 65 | "UC during a demand linefill from L2", |
| 66 | "Parity error during data load from IC", |
| 67 | "Parity error for IC valid bit", |
| 68 | "Main tag parity error", |
| 69 | "Parity error in prediction queue", |
| 70 | "PFB data/address parity error", |
| 71 | "Parity error in the branch status reg", |
| 72 | "PFB promotion address error", |
| 73 | "Tag error during probe/victimization", |
| 74 | "Parity error for IC probe tag valid bit", |
| 75 | "PFB non-cacheable bit parity error", |
| 76 | "PFB valid bit parity error", /* xec = 0xd */ |
Borislav Petkov | 6c1173a | 2011-11-21 19:45:34 +0100 | [diff] [blame] | 77 | "Microcode Patch Buffer", /* xec = 010 */ |
Borislav Petkov | 86039cd | 2010-11-08 15:03:35 +0100 | [diff] [blame] | 78 | "uop queue", |
| 79 | "insn buffer", |
| 80 | "predecode buffer", |
Aravind Gopalakrishnan | eba4bfb | 2014-07-14 16:58:19 +0200 | [diff] [blame] | 81 | "fetch address FIFO", |
| 82 | "dispatch uop queue" |
Borislav Petkov | 86039cd | 2010-11-08 15:03:35 +0100 | [diff] [blame] | 83 | }; |
| 84 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 85 | static const char * const f15h_mc2_mce_desc[] = { |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 86 | "Fill ECC error on data fills", /* xec = 0x4 */ |
| 87 | "Fill parity error on insn fills", |
| 88 | "Prefetcher request FIFO parity error", |
| 89 | "PRQ address parity error", |
| 90 | "PRQ data parity error", |
| 91 | "WCC Tag ECC error", |
| 92 | "WCC Data ECC error", |
| 93 | "WCB Data parity error", |
Borislav Petkov | b64a99c | 2011-11-23 14:50:44 +0100 | [diff] [blame] | 94 | "VB Data ECC or parity error", |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 95 | "L2 Tag ECC error", /* xec = 0x10 */ |
| 96 | "Hard L2 Tag ECC error", |
| 97 | "Multiple hits on L2 tag", |
| 98 | "XAB parity error", |
| 99 | "PRB address parity error" |
| 100 | }; |
| 101 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 102 | static const char * const mc4_mce_desc[] = { |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 103 | "DRAM ECC error detected on the NB", |
| 104 | "CRC error detected on HT link", |
| 105 | "Link-defined sync error packets detected on HT link", |
| 106 | "HT Master abort", |
| 107 | "HT Target abort", |
| 108 | "Invalid GART PTE entry during GART table walk", |
| 109 | "Unsupported atomic RMW received from an IO link", |
| 110 | "Watchdog timeout due to lack of progress", |
| 111 | "DRAM ECC error detected on the NB", |
| 112 | "SVM DMA Exclusion Vector error", |
| 113 | "HT data error detected on link", |
| 114 | "Protocol error (link, L3, probe filter)", |
| 115 | "NB internal arrays parity error", |
| 116 | "DRAM addr/ctl signals parity error", |
| 117 | "IO link transmission error", |
| 118 | "L3 data cache ECC error", /* xec = 0x1c */ |
| 119 | "L3 cache tag error", |
| 120 | "L3 LRU parity bits error", |
| 121 | "ECC Error in the Probe Filter directory" |
| 122 | }; |
| 123 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 124 | static const char * const mc5_mce_desc[] = { |
Borislav Petkov | 8259a7e | 2010-09-22 15:28:59 +0200 | [diff] [blame] | 125 | "CPU Watchdog timer expire", |
| 126 | "Wakeup array dest tag", |
| 127 | "AG payload array", |
| 128 | "EX payload array", |
| 129 | "IDRF array", |
| 130 | "Retire dispatch queue", |
| 131 | "Mapper checkpoint array", |
| 132 | "Physical register file EX0 port", |
| 133 | "Physical register file EX1 port", |
| 134 | "Physical register file AG0 port", |
| 135 | "Physical register file AG1 port", |
| 136 | "Flag register file", |
Aravind Gopalakrishnan | aad19e5 | 2013-06-05 15:50:03 -0500 | [diff] [blame] | 137 | "DE error occurred", |
| 138 | "Retire status queue" |
Borislav Petkov | 8259a7e | 2010-09-22 15:28:59 +0200 | [diff] [blame] | 139 | }; |
| 140 | |
Aravind Gopalakrishnan | bc4febe | 2014-11-04 11:41:08 -0600 | [diff] [blame] | 141 | static const char * const mc6_mce_desc[] = { |
| 142 | "Hardware Assertion", |
| 143 | "Free List", |
| 144 | "Physical Register File", |
| 145 | "Retire Queue", |
| 146 | "Scheduler table", |
| 147 | "Status Register File", |
| 148 | }; |
| 149 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 150 | static bool f12h_mc0_mce(u16 ec, u8 xec) |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 151 | { |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 152 | bool ret = false; |
| 153 | |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 154 | if (MEM_ERROR(ec)) { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 155 | u8 ll = LL(ec); |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 156 | ret = true; |
| 157 | |
| 158 | if (ll == LL_L2) |
| 159 | pr_cont("during L1 linefill from L2.\n"); |
| 160 | else if (ll == LL_L1) |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 161 | pr_cont("Data/Tag %s error.\n", R4_MSG(ec)); |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 162 | else |
| 163 | ret = false; |
| 164 | } |
| 165 | return ret; |
| 166 | } |
| 167 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 168 | static bool f10h_mc0_mce(u16 ec, u8 xec) |
Borislav Petkov | 9be0bb1 | 2010-09-16 15:08:14 +0200 | [diff] [blame] | 169 | { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 170 | if (R4(ec) == R4_GEN && LL(ec) == LL_L1) { |
Borislav Petkov | 9be0bb1 | 2010-09-16 15:08:14 +0200 | [diff] [blame] | 171 | pr_cont("during data scrub.\n"); |
| 172 | return true; |
| 173 | } |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 174 | return f12h_mc0_mce(ec, xec); |
Borislav Petkov | 9be0bb1 | 2010-09-16 15:08:14 +0200 | [diff] [blame] | 175 | } |
| 176 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 177 | static bool k8_mc0_mce(u16 ec, u8 xec) |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 178 | { |
| 179 | if (BUS_ERROR(ec)) { |
| 180 | pr_cont("during system linefill.\n"); |
| 181 | return true; |
| 182 | } |
| 183 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 184 | return f10h_mc0_mce(ec, xec); |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 185 | } |
| 186 | |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 187 | static bool cat_mc0_mce(u16 ec, u8 xec) |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 188 | { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 189 | u8 r4 = R4(ec); |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 190 | bool ret = true; |
| 191 | |
| 192 | if (MEM_ERROR(ec)) { |
| 193 | |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 194 | if (TT(ec) != TT_DATA || LL(ec) != LL_L1) |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 195 | return false; |
| 196 | |
| 197 | switch (r4) { |
| 198 | case R4_DRD: |
| 199 | case R4_DWR: |
| 200 | pr_cont("Data/Tag parity error due to %s.\n", |
| 201 | (r4 == R4_DRD ? "load/hw prf" : "store")); |
| 202 | break; |
| 203 | case R4_EVICT: |
| 204 | pr_cont("Copyback parity error on a tag miss.\n"); |
| 205 | break; |
| 206 | case R4_SNOOP: |
| 207 | pr_cont("Tag parity error during snoop.\n"); |
| 208 | break; |
| 209 | default: |
| 210 | ret = false; |
| 211 | } |
| 212 | } else if (BUS_ERROR(ec)) { |
| 213 | |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 214 | 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] | 215 | return false; |
| 216 | |
| 217 | pr_cont("System read data error on a "); |
| 218 | |
| 219 | switch (r4) { |
| 220 | case R4_RD: |
| 221 | pr_cont("TLB reload.\n"); |
| 222 | break; |
| 223 | case R4_DWR: |
| 224 | pr_cont("store.\n"); |
| 225 | break; |
| 226 | case R4_DRD: |
| 227 | pr_cont("load.\n"); |
| 228 | break; |
| 229 | default: |
| 230 | ret = false; |
| 231 | } |
| 232 | } else { |
| 233 | ret = false; |
| 234 | } |
| 235 | |
| 236 | return ret; |
| 237 | } |
| 238 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 239 | static bool f15h_mc0_mce(u16 ec, u8 xec) |
Borislav Petkov | 25a4f8b | 2010-09-17 19:22:34 +0200 | [diff] [blame] | 240 | { |
| 241 | bool ret = true; |
| 242 | |
| 243 | if (MEM_ERROR(ec)) { |
| 244 | |
| 245 | switch (xec) { |
| 246 | case 0x0: |
| 247 | pr_cont("Data Array access error.\n"); |
| 248 | break; |
| 249 | |
| 250 | case 0x1: |
| 251 | pr_cont("UC error during a linefill from L2/NB.\n"); |
| 252 | break; |
| 253 | |
| 254 | case 0x2: |
| 255 | case 0x11: |
| 256 | pr_cont("STQ access error.\n"); |
| 257 | break; |
| 258 | |
| 259 | case 0x3: |
| 260 | pr_cont("SCB access error.\n"); |
| 261 | break; |
| 262 | |
| 263 | case 0x10: |
| 264 | pr_cont("Tag error.\n"); |
| 265 | break; |
| 266 | |
| 267 | case 0x12: |
| 268 | pr_cont("LDQ access error.\n"); |
| 269 | break; |
| 270 | |
| 271 | default: |
| 272 | ret = false; |
| 273 | } |
| 274 | } else if (BUS_ERROR(ec)) { |
| 275 | |
| 276 | if (!xec) |
Borislav Petkov | 344f0a0 | 2011-11-15 17:10:58 +0100 | [diff] [blame] | 277 | pr_cont("System Read Data Error.\n"); |
Borislav Petkov | 25a4f8b | 2010-09-17 19:22:34 +0200 | [diff] [blame] | 278 | else |
Borislav Petkov | 344f0a0 | 2011-11-15 17:10:58 +0100 | [diff] [blame] | 279 | pr_cont(" Internal error condition type %d.\n", xec); |
Aravind Gopalakrishnan | eba4bfb | 2014-07-14 16:58:19 +0200 | [diff] [blame] | 280 | } else if (INT_ERROR(ec)) { |
| 281 | if (xec <= 0x1f) |
| 282 | pr_cont("Hardware Assert.\n"); |
| 283 | else |
| 284 | ret = false; |
| 285 | |
Borislav Petkov | 25a4f8b | 2010-09-17 19:22:34 +0200 | [diff] [blame] | 286 | } else |
| 287 | ret = false; |
| 288 | |
| 289 | return ret; |
| 290 | } |
| 291 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 292 | static void decode_mc0_mce(struct mce *m) |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 293 | { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 294 | u16 ec = EC(m->status); |
| 295 | u8 xec = XEC(m->status, xec_mask); |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 296 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 297 | pr_emerg(HW_ERR "MC0 Error: "); |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 298 | |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 299 | /* TLB error signatures are the same across families */ |
| 300 | if (TLB_ERROR(ec)) { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 301 | if (TT(ec) == TT_DATA) { |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 302 | pr_cont("%s TLB %s.\n", LL_MSG(ec), |
Borislav Petkov | 25a4f8b | 2010-09-17 19:22:34 +0200 | [diff] [blame] | 303 | ((xec == 2) ? "locked miss" |
| 304 | : (xec ? "multimatch" : "parity"))); |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 305 | return; |
| 306 | } |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 307 | } else if (fam_ops->mc0_mce(ec, xec)) |
Borislav Petkov | 25a4f8b | 2010-09-17 19:22:34 +0200 | [diff] [blame] | 308 | ; |
| 309 | else |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 310 | pr_emerg(HW_ERR "Corrupted MC0 MCE info?\n"); |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 311 | } |
| 312 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 313 | static bool k8_mc1_mce(u16 ec, u8 xec) |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 314 | { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 315 | u8 ll = LL(ec); |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 316 | bool ret = true; |
| 317 | |
| 318 | if (!MEM_ERROR(ec)) |
| 319 | return false; |
| 320 | |
| 321 | if (ll == 0x2) |
| 322 | pr_cont("during a linefill from L2.\n"); |
| 323 | else if (ll == 0x1) { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 324 | switch (R4(ec)) { |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 325 | case R4_IRD: |
| 326 | pr_cont("Parity error during data load.\n"); |
| 327 | break; |
| 328 | |
| 329 | case R4_EVICT: |
| 330 | pr_cont("Copyback Parity/Victim error.\n"); |
| 331 | break; |
| 332 | |
| 333 | case R4_SNOOP: |
| 334 | pr_cont("Tag Snoop error.\n"); |
| 335 | break; |
| 336 | |
| 337 | default: |
| 338 | ret = false; |
| 339 | break; |
| 340 | } |
| 341 | } else |
| 342 | ret = false; |
| 343 | |
| 344 | return ret; |
| 345 | } |
| 346 | |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 347 | static bool cat_mc1_mce(u16 ec, u8 xec) |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 348 | { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 349 | u8 r4 = R4(ec); |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 350 | bool ret = true; |
| 351 | |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 352 | if (!MEM_ERROR(ec)) |
| 353 | return false; |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 354 | |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 355 | if (TT(ec) != TT_INSTR) |
| 356 | return false; |
| 357 | |
| 358 | if (r4 == R4_IRD) |
| 359 | pr_cont("Data/tag array parity error for a tag hit.\n"); |
| 360 | else if (r4 == R4_SNOOP) |
| 361 | pr_cont("Tag error during snoop/victimization.\n"); |
| 362 | else if (xec == 0x0) |
| 363 | pr_cont("Tag parity error from victim castout.\n"); |
| 364 | else if (xec == 0x2) |
| 365 | pr_cont("Microcode patch RAM parity error.\n"); |
| 366 | else |
| 367 | ret = false; |
| 368 | |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 369 | return ret; |
| 370 | } |
| 371 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 372 | static bool f15h_mc1_mce(u16 ec, u8 xec) |
Borislav Petkov | 86039cd | 2010-11-08 15:03:35 +0100 | [diff] [blame] | 373 | { |
| 374 | bool ret = true; |
| 375 | |
| 376 | if (!MEM_ERROR(ec)) |
| 377 | return false; |
| 378 | |
| 379 | switch (xec) { |
| 380 | case 0x0 ... 0xa: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 381 | pr_cont("%s.\n", f15h_mc1_mce_desc[xec]); |
Borislav Petkov | 86039cd | 2010-11-08 15:03:35 +0100 | [diff] [blame] | 382 | break; |
| 383 | |
| 384 | case 0xd: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 385 | pr_cont("%s.\n", f15h_mc1_mce_desc[xec-2]); |
Borislav Petkov | 86039cd | 2010-11-08 15:03:35 +0100 | [diff] [blame] | 386 | break; |
| 387 | |
Borislav Petkov | 6c1173a | 2011-11-21 19:45:34 +0100 | [diff] [blame] | 388 | case 0x10: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 389 | pr_cont("%s.\n", f15h_mc1_mce_desc[xec-4]); |
Borislav Petkov | 6c1173a | 2011-11-21 19:45:34 +0100 | [diff] [blame] | 390 | break; |
| 391 | |
Aravind Gopalakrishnan | eba4bfb | 2014-07-14 16:58:19 +0200 | [diff] [blame] | 392 | case 0x11 ... 0x15: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 393 | 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] | 394 | break; |
| 395 | |
| 396 | default: |
| 397 | ret = false; |
| 398 | } |
| 399 | return ret; |
| 400 | } |
| 401 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 402 | static void decode_mc1_mce(struct mce *m) |
Borislav Petkov | ab5535e | 2009-07-28 14:06:26 +0200 | [diff] [blame] | 403 | { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 404 | u16 ec = EC(m->status); |
| 405 | u8 xec = XEC(m->status, xec_mask); |
Borislav Petkov | ab5535e | 2009-07-28 14:06:26 +0200 | [diff] [blame] | 406 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 407 | pr_emerg(HW_ERR "MC1 Error: "); |
Borislav Petkov | ab5535e | 2009-07-28 14:06:26 +0200 | [diff] [blame] | 408 | |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 409 | if (TLB_ERROR(ec)) |
| 410 | pr_cont("%s TLB %s.\n", LL_MSG(ec), |
| 411 | (xec ? "multimatch" : "parity error")); |
| 412 | else if (BUS_ERROR(ec)) { |
Borislav Petkov | 525906b | 2010-10-15 15:27:02 +0200 | [diff] [blame] | 413 | bool k8 = (boot_cpu_data.x86 == 0xf && (m->status & BIT_64(58))); |
Borislav Petkov | ab5535e | 2009-07-28 14:06:26 +0200 | [diff] [blame] | 414 | |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 415 | pr_cont("during %s.\n", (k8 ? "system linefill" : "NB data read")); |
Aravind Gopalakrishnan | eba4bfb | 2014-07-14 16:58:19 +0200 | [diff] [blame] | 416 | } else if (INT_ERROR(ec)) { |
| 417 | if (xec <= 0x3f) |
| 418 | pr_cont("Hardware Assert.\n"); |
| 419 | else |
| 420 | goto wrong_mc1_mce; |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 421 | } else if (fam_ops->mc1_mce(ec, xec)) |
Borislav Petkov | dd53bce | 2010-08-26 19:05:49 +0200 | [diff] [blame] | 422 | ; |
| 423 | else |
Aravind Gopalakrishnan | eba4bfb | 2014-07-14 16:58:19 +0200 | [diff] [blame] | 424 | goto wrong_mc1_mce; |
| 425 | |
| 426 | return; |
| 427 | |
| 428 | wrong_mc1_mce: |
| 429 | pr_emerg(HW_ERR "Corrupted MC1 MCE info?\n"); |
Borislav Petkov | ab5535e | 2009-07-28 14:06:26 +0200 | [diff] [blame] | 430 | } |
| 431 | |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 432 | static bool k8_mc2_mce(u16 ec, u8 xec) |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 433 | { |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 434 | bool ret = true; |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 435 | |
| 436 | if (xec == 0x1) |
| 437 | pr_cont(" in the write data buffers.\n"); |
| 438 | else if (xec == 0x3) |
| 439 | pr_cont(" in the victim data buffers.\n"); |
| 440 | else if (xec == 0x2 && MEM_ERROR(ec)) |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 441 | 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] | 442 | else if (xec == 0x0) { |
| 443 | if (TLB_ERROR(ec)) |
Borislav Petkov | 50872cc | 2014-11-22 13:41:01 +0100 | [diff] [blame] | 444 | pr_cont("%s error in a Page Descriptor Cache or Guest TLB.\n", |
| 445 | TT_MSG(ec)); |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 446 | else if (BUS_ERROR(ec)) |
| 447 | pr_cont(": %s/ECC error in data read from NB: %s.\n", |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 448 | R4_MSG(ec), PP_MSG(ec)); |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 449 | else if (MEM_ERROR(ec)) { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 450 | u8 r4 = R4(ec); |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 451 | |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 452 | if (r4 >= 0x7) |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 453 | pr_cont(": %s error during data copyback.\n", |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 454 | R4_MSG(ec)); |
| 455 | else if (r4 <= 0x1) |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 456 | pr_cont(": %s parity/ECC error during data " |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 457 | "access from L2.\n", R4_MSG(ec)); |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 458 | else |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 459 | ret = false; |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 460 | } else |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 461 | ret = false; |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 462 | } else |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 463 | ret = false; |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 464 | |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 465 | return ret; |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 466 | } |
| 467 | |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 468 | static bool f15h_mc2_mce(u16 ec, u8 xec) |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 469 | { |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 470 | bool ret = true; |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 471 | |
| 472 | if (TLB_ERROR(ec)) { |
| 473 | if (xec == 0x0) |
| 474 | pr_cont("Data parity TLB read error.\n"); |
| 475 | else if (xec == 0x1) |
| 476 | pr_cont("Poison data provided for TLB fill.\n"); |
| 477 | else |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 478 | ret = false; |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 479 | } else if (BUS_ERROR(ec)) { |
| 480 | if (xec > 2) |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 481 | ret = false; |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 482 | |
| 483 | pr_cont("Error during attempted NB data read.\n"); |
| 484 | } else if (MEM_ERROR(ec)) { |
| 485 | switch (xec) { |
| 486 | case 0x4 ... 0xc: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 487 | pr_cont("%s.\n", f15h_mc2_mce_desc[xec - 0x4]); |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 488 | break; |
| 489 | |
| 490 | case 0x10 ... 0x14: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 491 | pr_cont("%s.\n", f15h_mc2_mce_desc[xec - 0x7]); |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 492 | break; |
| 493 | |
| 494 | default: |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 495 | ret = false; |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 496 | } |
Aravind Gopalakrishnan | eba4bfb | 2014-07-14 16:58:19 +0200 | [diff] [blame] | 497 | } else if (INT_ERROR(ec)) { |
| 498 | if (xec <= 0x3f) |
| 499 | pr_cont("Hardware Assert.\n"); |
| 500 | else |
| 501 | ret = false; |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 502 | } |
| 503 | |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 504 | return ret; |
| 505 | } |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 506 | |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 507 | static bool f16h_mc2_mce(u16 ec, u8 xec) |
| 508 | { |
| 509 | u8 r4 = R4(ec); |
| 510 | |
| 511 | if (!MEM_ERROR(ec)) |
| 512 | return false; |
| 513 | |
| 514 | switch (xec) { |
| 515 | case 0x04 ... 0x05: |
| 516 | pr_cont("%cBUFF parity error.\n", (r4 == R4_RD) ? 'I' : 'O'); |
| 517 | break; |
| 518 | |
| 519 | case 0x09 ... 0x0b: |
| 520 | case 0x0d ... 0x0f: |
| 521 | pr_cont("ECC error in L2 tag (%s).\n", |
| 522 | ((r4 == R4_GEN) ? "BankReq" : |
| 523 | ((r4 == R4_SNOOP) ? "Prb" : "Fill"))); |
| 524 | break; |
| 525 | |
| 526 | case 0x10 ... 0x19: |
| 527 | case 0x1b: |
| 528 | pr_cont("ECC error in L2 data array (%s).\n", |
| 529 | (((r4 == R4_RD) && !(xec & 0x3)) ? "Hit" : |
| 530 | ((r4 == R4_GEN) ? "Attr" : |
| 531 | ((r4 == R4_EVICT) ? "Vict" : "Fill")))); |
| 532 | break; |
| 533 | |
| 534 | case 0x1c ... 0x1d: |
| 535 | case 0x1f: |
| 536 | pr_cont("Parity error in L2 attribute bits (%s).\n", |
| 537 | ((r4 == R4_RD) ? "Hit" : |
| 538 | ((r4 == R4_GEN) ? "Attr" : "Fill"))); |
| 539 | break; |
| 540 | |
| 541 | default: |
| 542 | return false; |
| 543 | } |
| 544 | |
| 545 | return true; |
| 546 | } |
| 547 | |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 548 | static void decode_mc2_mce(struct mce *m) |
| 549 | { |
| 550 | u16 ec = EC(m->status); |
| 551 | u8 xec = XEC(m->status, xec_mask); |
| 552 | |
| 553 | pr_emerg(HW_ERR "MC2 Error: "); |
| 554 | |
| 555 | if (!fam_ops->mc2_mce(ec, xec)) |
| 556 | pr_cont(HW_ERR "Corrupted MC2 MCE info?\n"); |
Borislav Petkov | 70fdb49 | 2010-09-21 20:45:10 +0200 | [diff] [blame] | 557 | } |
| 558 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 559 | static void decode_mc3_mce(struct mce *m) |
Borislav Petkov | f9350ef | 2009-07-28 14:17:30 +0200 | [diff] [blame] | 560 | { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 561 | u16 ec = EC(m->status); |
| 562 | u8 xec = XEC(m->status, xec_mask); |
Borislav Petkov | ded5062 | 2010-08-27 17:03:34 +0200 | [diff] [blame] | 563 | |
Borislav Petkov | b18434c | 2010-09-22 11:53:32 +0200 | [diff] [blame] | 564 | if (boot_cpu_data.x86 >= 0x14) { |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 565 | 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] | 566 | " please report on LKML.\n"); |
| 567 | return; |
| 568 | } |
Borislav Petkov | f9350ef | 2009-07-28 14:17:30 +0200 | [diff] [blame] | 569 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 570 | pr_emerg(HW_ERR "MC3 Error"); |
Borislav Petkov | f9350ef | 2009-07-28 14:17:30 +0200 | [diff] [blame] | 571 | |
| 572 | if (xec == 0x0) { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 573 | u8 r4 = R4(ec); |
Borislav Petkov | f9350ef | 2009-07-28 14:17:30 +0200 | [diff] [blame] | 574 | |
Borislav Petkov | ded5062 | 2010-08-27 17:03:34 +0200 | [diff] [blame] | 575 | if (!BUS_ERROR(ec) || (r4 != R4_DRD && r4 != R4_DWR)) |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 576 | goto wrong_mc3_mce; |
Borislav Petkov | f9350ef | 2009-07-28 14:17:30 +0200 | [diff] [blame] | 577 | |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 578 | pr_cont(" during %s.\n", R4_MSG(ec)); |
Borislav Petkov | ded5062 | 2010-08-27 17:03:34 +0200 | [diff] [blame] | 579 | } else |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 580 | goto wrong_mc3_mce; |
Borislav Petkov | ded5062 | 2010-08-27 17:03:34 +0200 | [diff] [blame] | 581 | |
Borislav Petkov | f9350ef | 2009-07-28 14:17:30 +0200 | [diff] [blame] | 582 | return; |
| 583 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 584 | wrong_mc3_mce: |
| 585 | pr_emerg(HW_ERR "Corrupted MC3 MCE info?\n"); |
Borislav Petkov | f9350ef | 2009-07-28 14:17:30 +0200 | [diff] [blame] | 586 | } |
| 587 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 588 | static void decode_mc4_mce(struct mce *m) |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 589 | { |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 590 | struct cpuinfo_x86 *c = &boot_cpu_data; |
| 591 | int node_id = amd_get_nb_id(m->extcpu); |
| 592 | u16 ec = EC(m->status); |
| 593 | u8 xec = XEC(m->status, 0x1f); |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 594 | u8 offset = 0; |
| 595 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 596 | pr_emerg(HW_ERR "MC4 Error (node %d): ", node_id); |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 597 | |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 598 | switch (xec) { |
| 599 | case 0x0 ... 0xe: |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 600 | |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 601 | /* special handling for DRAM ECCs */ |
| 602 | if (xec == 0x0 || xec == 0x8) { |
| 603 | /* no ECCs on F11h */ |
| 604 | if (c->x86 == 0x11) |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 605 | goto wrong_mc4_mce; |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 606 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 607 | pr_cont("%s.\n", mc4_mce_desc[xec]); |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 608 | |
| 609 | if (nb_bus_decoder) |
| 610 | nb_bus_decoder(node_id, m); |
| 611 | return; |
| 612 | } |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 613 | break; |
| 614 | |
| 615 | case 0xf: |
| 616 | if (TLB_ERROR(ec)) |
| 617 | pr_cont("GART Table Walk data error.\n"); |
| 618 | else if (BUS_ERROR(ec)) |
| 619 | pr_cont("DMA Exclusion Vector Table Walk error.\n"); |
| 620 | else |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 621 | goto wrong_mc4_mce; |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 622 | return; |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 623 | |
Borislav Petkov | 05cd667 | 2010-09-22 15:06:24 +0200 | [diff] [blame] | 624 | case 0x19: |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 625 | if (boot_cpu_data.x86 == 0x15 || boot_cpu_data.x86 == 0x16) |
Borislav Petkov | 05cd667 | 2010-09-22 15:06:24 +0200 | [diff] [blame] | 626 | pr_cont("Compute Unit Data Error.\n"); |
| 627 | else |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 628 | goto wrong_mc4_mce; |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 629 | return; |
Borislav Petkov | 05cd667 | 2010-09-22 15:06:24 +0200 | [diff] [blame] | 630 | |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 631 | case 0x1c ... 0x1f: |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 632 | offset = 13; |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 633 | break; |
| 634 | |
| 635 | default: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 636 | goto wrong_mc4_mce; |
Borislav Petkov | 6878267 | 2011-11-24 21:29:57 +0100 | [diff] [blame] | 637 | } |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 638 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 639 | pr_cont("%s.\n", mc4_mce_desc[xec - offset]); |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 640 | return; |
| 641 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 642 | wrong_mc4_mce: |
| 643 | pr_emerg(HW_ERR "Corrupted MC4 MCE info?\n"); |
Borislav Petkov | d93cc22 | 2009-07-28 10:56:15 +0200 | [diff] [blame] | 644 | } |
Borislav Petkov | d93cc22 | 2009-07-28 10:56:15 +0200 | [diff] [blame] | 645 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 646 | static void decode_mc5_mce(struct mce *m) |
Borislav Petkov | 53bd5fe | 2009-07-28 14:20:46 +0200 | [diff] [blame] | 647 | { |
Borislav Petkov | 8259a7e | 2010-09-22 15:28:59 +0200 | [diff] [blame] | 648 | struct cpuinfo_x86 *c = &boot_cpu_data; |
Aravind Gopalakrishnan | eba4bfb | 2014-07-14 16:58:19 +0200 | [diff] [blame] | 649 | u16 ec = EC(m->status); |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 650 | u8 xec = XEC(m->status, xec_mask); |
Borislav Petkov | 8259a7e | 2010-09-22 15:28:59 +0200 | [diff] [blame] | 651 | |
| 652 | if (c->x86 == 0xf || c->x86 == 0x11) |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 653 | goto wrong_mc5_mce; |
Borislav Petkov | fe4ea26 | 2010-08-31 18:38:24 +0200 | [diff] [blame] | 654 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 655 | pr_emerg(HW_ERR "MC5 Error: "); |
Borislav Petkov | 8259a7e | 2010-09-22 15:28:59 +0200 | [diff] [blame] | 656 | |
Aravind Gopalakrishnan | eba4bfb | 2014-07-14 16:58:19 +0200 | [diff] [blame] | 657 | if (INT_ERROR(ec)) { |
| 658 | if (xec <= 0x1f) { |
| 659 | pr_cont("Hardware Assert.\n"); |
| 660 | return; |
| 661 | } else |
| 662 | goto wrong_mc5_mce; |
| 663 | } |
| 664 | |
Borislav Petkov | 8259a7e | 2010-09-22 15:28:59 +0200 | [diff] [blame] | 665 | if (xec == 0x0 || xec == 0xc) |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 666 | pr_cont("%s.\n", mc5_mce_desc[xec]); |
Aravind Gopalakrishnan | aad19e5 | 2013-06-05 15:50:03 -0500 | [diff] [blame] | 667 | else if (xec <= 0xd) |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 668 | pr_cont("%s parity error.\n", mc5_mce_desc[xec]); |
Borislav Petkov | 8259a7e | 2010-09-22 15:28:59 +0200 | [diff] [blame] | 669 | else |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 670 | goto wrong_mc5_mce; |
Borislav Petkov | 8259a7e | 2010-09-22 15:28:59 +0200 | [diff] [blame] | 671 | |
| 672 | return; |
Borislav Petkov | fe4ea26 | 2010-08-31 18:38:24 +0200 | [diff] [blame] | 673 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 674 | wrong_mc5_mce: |
| 675 | pr_emerg(HW_ERR "Corrupted MC5 MCE info?\n"); |
Borislav Petkov | 53bd5fe | 2009-07-28 14:20:46 +0200 | [diff] [blame] | 676 | } |
| 677 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 678 | static void decode_mc6_mce(struct mce *m) |
Borislav Petkov | b8f85c4 | 2010-09-22 15:37:58 +0200 | [diff] [blame] | 679 | { |
Borislav Petkov | 6245288 | 2010-09-22 16:08:37 +0200 | [diff] [blame] | 680 | u8 xec = XEC(m->status, xec_mask); |
Borislav Petkov | b8f85c4 | 2010-09-22 15:37:58 +0200 | [diff] [blame] | 681 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 682 | pr_emerg(HW_ERR "MC6 Error: "); |
Borislav Petkov | b8f85c4 | 2010-09-22 15:37:58 +0200 | [diff] [blame] | 683 | |
Aravind Gopalakrishnan | bc4febe | 2014-11-04 11:41:08 -0600 | [diff] [blame] | 684 | if (xec > 0x5) |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 685 | goto wrong_mc6_mce; |
Borislav Petkov | b8f85c4 | 2010-09-22 15:37:58 +0200 | [diff] [blame] | 686 | |
Aravind Gopalakrishnan | bc4febe | 2014-11-04 11:41:08 -0600 | [diff] [blame] | 687 | pr_cont("%s parity error.\n", mc6_mce_desc[xec]); |
Borislav Petkov | b8f85c4 | 2010-09-22 15:37:58 +0200 | [diff] [blame] | 688 | return; |
| 689 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 690 | wrong_mc6_mce: |
| 691 | pr_emerg(HW_ERR "Corrupted MC6 MCE info?\n"); |
Borislav Petkov | b8f85c4 | 2010-09-22 15:37:58 +0200 | [diff] [blame] | 692 | } |
| 693 | |
Borislav Petkov | 6337583 | 2010-09-06 18:13:39 +0200 | [diff] [blame] | 694 | static inline void amd_decode_err_code(u16 ec) |
Borislav Petkov | d93cc22 | 2009-07-28 10:56:15 +0200 | [diff] [blame] | 695 | { |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 696 | if (INT_ERROR(ec)) { |
| 697 | pr_emerg(HW_ERR "internal: %s\n", UU_MSG(ec)); |
| 698 | return; |
| 699 | } |
Borislav Petkov | fa7ae8c | 2010-09-22 17:42:27 +0200 | [diff] [blame] | 700 | |
| 701 | pr_emerg(HW_ERR "cache level: %s", LL_MSG(ec)); |
| 702 | |
| 703 | if (BUS_ERROR(ec)) |
| 704 | pr_cont(", mem/io: %s", II_MSG(ec)); |
| 705 | else |
| 706 | pr_cont(", tx: %s", TT_MSG(ec)); |
| 707 | |
| 708 | if (MEM_ERROR(ec) || BUS_ERROR(ec)) { |
| 709 | pr_cont(", mem-tx: %s", R4_MSG(ec)); |
| 710 | |
| 711 | if (BUS_ERROR(ec)) |
| 712 | pr_cont(", part-proc: %s (%s)", PP_MSG(ec), TO_MSG(ec)); |
| 713 | } |
| 714 | |
| 715 | pr_cont("\n"); |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 716 | } |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 717 | |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 718 | /* |
| 719 | * Filter out unwanted MCE signatures here. |
| 720 | */ |
| 721 | static bool amd_filter_mce(struct mce *m) |
| 722 | { |
| 723 | u8 xec = (m->status >> 16) & 0x1f; |
| 724 | |
| 725 | /* |
| 726 | * NB GART TLB error reporting is disabled by default. |
| 727 | */ |
| 728 | if (m->bank == 4 && xec == 0x5 && !report_gart_errors) |
| 729 | return true; |
| 730 | |
| 731 | return false; |
| 732 | } |
| 733 | |
Borislav Petkov | d5c6770 | 2012-09-14 20:25:37 +0200 | [diff] [blame] | 734 | static const char *decode_error_status(struct mce *m) |
| 735 | { |
| 736 | if (m->status & MCI_STATUS_UC) { |
| 737 | if (m->status & MCI_STATUS_PCC) |
| 738 | return "System Fatal error."; |
| 739 | if (m->mcgstatus & MCG_STATUS_RIPV) |
| 740 | return "Uncorrected, software restartable error."; |
| 741 | return "Uncorrected, software containable error."; |
| 742 | } |
| 743 | |
| 744 | if (m->status & MCI_STATUS_DEFERRED) |
| 745 | return "Deferred error."; |
| 746 | |
| 747 | return "Corrected error, no action required."; |
| 748 | } |
| 749 | |
Borislav Petkov | 9cdeb40 | 2010-09-02 18:33:24 +0200 | [diff] [blame] | 750 | int amd_decode_mce(struct notifier_block *nb, unsigned long val, void *data) |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 751 | { |
Borislav Petkov | fb25319 | 2009-10-07 13:20:38 +0200 | [diff] [blame] | 752 | struct mce *m = (struct mce *)data; |
Borislav Petkov | f89f838 | 2012-09-13 15:14:22 +0200 | [diff] [blame] | 753 | struct cpuinfo_x86 *c = &cpu_data(m->extcpu); |
Borislav Petkov | b0b07a2 | 2011-08-24 18:44:22 +0200 | [diff] [blame] | 754 | int ecc; |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 755 | |
Borislav Petkov | 5ce88f6 | 2010-08-31 18:28:08 +0200 | [diff] [blame] | 756 | if (amd_filter_mce(m)) |
| 757 | return NOTIFY_STOP; |
| 758 | |
Borislav Petkov | fd0f5fff | 2014-02-17 20:51:52 +0100 | [diff] [blame] | 759 | pr_emerg(HW_ERR "%s\n", decode_error_status(m)); |
| 760 | |
| 761 | pr_emerg(HW_ERR "CPU:%d (%x:%x:%x) MC%d_STATUS[%s|%s|%s|%s|%s", |
| 762 | m->extcpu, |
| 763 | c->x86, c->x86_model, c->x86_mask, |
| 764 | m->bank, |
| 765 | ((m->status & MCI_STATUS_OVER) ? "Over" : "-"), |
Aravind Gopalakrishnan | 99e1dfb | 2015-07-13 06:53:02 -0500 | [diff] [blame^] | 766 | ((m->status & MCI_STATUS_UC) ? "UE" : |
| 767 | (m->status & MCI_STATUS_DEFERRED) ? "-" : "CE"), |
Borislav Petkov | fd0f5fff | 2014-02-17 20:51:52 +0100 | [diff] [blame] | 768 | ((m->status & MCI_STATUS_MISCV) ? "MiscV" : "-"), |
| 769 | ((m->status & MCI_STATUS_PCC) ? "PCC" : "-"), |
| 770 | ((m->status & MCI_STATUS_ADDRV) ? "AddrV" : "-")); |
| 771 | |
| 772 | if (c->x86 == 0x15 || c->x86 == 0x16) |
| 773 | pr_cont("|%s|%s", |
| 774 | ((m->status & MCI_STATUS_DEFERRED) ? "Deferred" : "-"), |
| 775 | ((m->status & MCI_STATUS_POISON) ? "Poison" : "-")); |
| 776 | |
| 777 | /* do the two bits[14:13] together */ |
| 778 | ecc = (m->status >> 45) & 0x3; |
| 779 | if (ecc) |
| 780 | pr_cont("|%sECC", ((ecc == 2) ? "C" : "U")); |
| 781 | |
| 782 | pr_cont("]: 0x%016llx\n", m->status); |
| 783 | |
| 784 | if (m->status & MCI_STATUS_ADDRV) |
Borislav Petkov | 50872cc | 2014-11-22 13:41:01 +0100 | [diff] [blame] | 785 | pr_emerg(HW_ERR "MC%d Error Address: 0x%016llx\n", m->bank, m->addr); |
Borislav Petkov | fd0f5fff | 2014-02-17 20:51:52 +0100 | [diff] [blame] | 786 | |
| 787 | if (!fam_ops) |
| 788 | goto err_code; |
| 789 | |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 790 | switch (m->bank) { |
| 791 | case 0: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 792 | decode_mc0_mce(m); |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 793 | break; |
Borislav Petkov | d93cc22 | 2009-07-28 10:56:15 +0200 | [diff] [blame] | 794 | |
Borislav Petkov | ab5535e | 2009-07-28 14:06:26 +0200 | [diff] [blame] | 795 | case 1: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 796 | decode_mc1_mce(m); |
Borislav Petkov | ab5535e | 2009-07-28 14:06:26 +0200 | [diff] [blame] | 797 | break; |
| 798 | |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 799 | case 2: |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 800 | decode_mc2_mce(m); |
Borislav Petkov | 56cad2d | 2009-07-28 14:14:24 +0200 | [diff] [blame] | 801 | break; |
| 802 | |
Borislav Petkov | f9350ef | 2009-07-28 14:17:30 +0200 | [diff] [blame] | 803 | case 3: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 804 | decode_mc3_mce(m); |
Borislav Petkov | f9350ef | 2009-07-28 14:17:30 +0200 | [diff] [blame] | 805 | break; |
| 806 | |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 807 | case 4: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 808 | decode_mc4_mce(m); |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 809 | break; |
| 810 | |
Borislav Petkov | 53bd5fe | 2009-07-28 14:20:46 +0200 | [diff] [blame] | 811 | case 5: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 812 | decode_mc5_mce(m); |
Borislav Petkov | 53bd5fe | 2009-07-28 14:20:46 +0200 | [diff] [blame] | 813 | break; |
| 814 | |
Borislav Petkov | b8f85c4 | 2010-09-22 15:37:58 +0200 | [diff] [blame] | 815 | case 6: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 816 | decode_mc6_mce(m); |
Borislav Petkov | b8f85c4 | 2010-09-22 15:37:58 +0200 | [diff] [blame] | 817 | break; |
| 818 | |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 819 | default: |
| 820 | break; |
Borislav Petkov | b69b29d | 2009-07-27 16:21:14 +0200 | [diff] [blame] | 821 | } |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 822 | |
Borislav Petkov | fd0f5fff | 2014-02-17 20:51:52 +0100 | [diff] [blame] | 823 | err_code: |
Borislav Petkov | 5196624 | 2009-07-28 13:50:43 +0200 | [diff] [blame] | 824 | amd_decode_err_code(m->status & 0xffff); |
Borislav Petkov | fb25319 | 2009-10-07 13:20:38 +0200 | [diff] [blame] | 825 | |
| 826 | return NOTIFY_STOP; |
Borislav Petkov | 549d042 | 2009-07-24 13:51:42 +0200 | [diff] [blame] | 827 | } |
Borislav Petkov | 9cdeb40 | 2010-09-02 18:33:24 +0200 | [diff] [blame] | 828 | EXPORT_SYMBOL_GPL(amd_decode_mce); |
Ingo Molnar | f436f8b | 2009-10-01 16:14:32 +0200 | [diff] [blame] | 829 | |
Borislav Petkov | fb25319 | 2009-10-07 13:20:38 +0200 | [diff] [blame] | 830 | static struct notifier_block amd_mce_dec_nb = { |
| 831 | .notifier_call = amd_decode_mce, |
| 832 | }; |
| 833 | |
Ingo Molnar | f436f8b | 2009-10-01 16:14:32 +0200 | [diff] [blame] | 834 | static int __init mce_amd_init(void) |
| 835 | { |
Borislav Petkov | bad11e0 | 2010-09-22 17:44:51 +0200 | [diff] [blame] | 836 | struct cpuinfo_x86 *c = &boot_cpu_data; |
| 837 | |
| 838 | if (c->x86_vendor != X86_VENDOR_AMD) |
Borislav Petkov | fd0f5fff | 2014-02-17 20:51:52 +0100 | [diff] [blame] | 839 | return -ENODEV; |
Borislav Petkov | e045c29 | 2010-08-06 18:55:45 +0200 | [diff] [blame] | 840 | |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 841 | fam_ops = kzalloc(sizeof(struct amd_decoder_ops), GFP_KERNEL); |
| 842 | if (!fam_ops) |
| 843 | return -ENOMEM; |
| 844 | |
Borislav Petkov | bad11e0 | 2010-09-22 17:44:51 +0200 | [diff] [blame] | 845 | switch (c->x86) { |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 846 | case 0xf: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 847 | fam_ops->mc0_mce = k8_mc0_mce; |
| 848 | fam_ops->mc1_mce = k8_mc1_mce; |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 849 | fam_ops->mc2_mce = k8_mc2_mce; |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 850 | break; |
| 851 | |
| 852 | case 0x10: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 853 | fam_ops->mc0_mce = f10h_mc0_mce; |
| 854 | fam_ops->mc1_mce = k8_mc1_mce; |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 855 | fam_ops->mc2_mce = k8_mc2_mce; |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 856 | break; |
| 857 | |
Borislav Petkov | f0157b3 | 2010-10-05 19:07:16 +0200 | [diff] [blame] | 858 | case 0x11: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 859 | fam_ops->mc0_mce = k8_mc0_mce; |
| 860 | fam_ops->mc1_mce = k8_mc1_mce; |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 861 | fam_ops->mc2_mce = k8_mc2_mce; |
Borislav Petkov | f0157b3 | 2010-10-05 19:07:16 +0200 | [diff] [blame] | 862 | break; |
| 863 | |
Borislav Petkov | 9be0bb1 | 2010-09-16 15:08:14 +0200 | [diff] [blame] | 864 | case 0x12: |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 865 | fam_ops->mc0_mce = f12h_mc0_mce; |
| 866 | fam_ops->mc1_mce = k8_mc1_mce; |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 867 | fam_ops->mc2_mce = k8_mc2_mce; |
Borislav Petkov | 9be0bb1 | 2010-09-16 15:08:14 +0200 | [diff] [blame] | 868 | break; |
| 869 | |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 870 | case 0x14: |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 871 | fam_ops->mc0_mce = cat_mc0_mce; |
| 872 | fam_ops->mc1_mce = cat_mc1_mce; |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 873 | fam_ops->mc2_mce = k8_mc2_mce; |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 874 | break; |
| 875 | |
Borislav Petkov | 2be64bf | 2010-09-17 19:11:47 +0200 | [diff] [blame] | 876 | case 0x15: |
Aravind Gopalakrishnan | eba4bfb | 2014-07-14 16:58:19 +0200 | [diff] [blame] | 877 | xec_mask = c->x86_model == 0x60 ? 0x3f : 0x1f; |
| 878 | |
Borislav Petkov | f05c41a | 2012-09-11 18:57:43 +0200 | [diff] [blame] | 879 | fam_ops->mc0_mce = f15h_mc0_mce; |
| 880 | fam_ops->mc1_mce = f15h_mc1_mce; |
Jacob Shin | 4a73d3d | 2012-12-18 15:06:10 -0600 | [diff] [blame] | 881 | fam_ops->mc2_mce = f15h_mc2_mce; |
Borislav Petkov | 2be64bf | 2010-09-17 19:11:47 +0200 | [diff] [blame] | 882 | break; |
| 883 | |
Jacob Shin | 980eec8 | 2012-12-18 15:06:11 -0600 | [diff] [blame] | 884 | case 0x16: |
| 885 | xec_mask = 0x1f; |
| 886 | fam_ops->mc0_mce = cat_mc0_mce; |
| 887 | fam_ops->mc1_mce = cat_mc1_mce; |
| 888 | fam_ops->mc2_mce = f16h_mc2_mce; |
| 889 | break; |
| 890 | |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 891 | default: |
Borislav Petkov | ec3e82d | 2012-04-04 14:21:02 +0200 | [diff] [blame] | 892 | printk(KERN_WARNING "Huh? What family is it: 0x%x?!\n", c->x86); |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 893 | kfree(fam_ops); |
Borislav Petkov | fd0f5fff | 2014-02-17 20:51:52 +0100 | [diff] [blame] | 894 | fam_ops = NULL; |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 895 | } |
| 896 | |
Borislav Petkov | 9530d60 | 2010-09-06 15:05:45 +0200 | [diff] [blame] | 897 | pr_info("MCE: In-kernel MCE decoding enabled.\n"); |
| 898 | |
Borislav Petkov | 3653ada | 2011-12-04 15:12:09 +0100 | [diff] [blame] | 899 | mce_register_decode_chain(&amd_mce_dec_nb); |
Ingo Molnar | f436f8b | 2009-10-01 16:14:32 +0200 | [diff] [blame] | 900 | |
| 901 | return 0; |
| 902 | } |
| 903 | early_initcall(mce_amd_init); |
Borislav Petkov | 0d18b2e | 2009-10-02 15:31:48 +0200 | [diff] [blame] | 904 | |
| 905 | #ifdef MODULE |
| 906 | static void __exit mce_amd_exit(void) |
| 907 | { |
Borislav Petkov | 3653ada | 2011-12-04 15:12:09 +0100 | [diff] [blame] | 908 | mce_unregister_decode_chain(&amd_mce_dec_nb); |
Borislav Petkov | 888ab8e | 2010-08-18 15:11:35 +0200 | [diff] [blame] | 909 | kfree(fam_ops); |
Borislav Petkov | 0d18b2e | 2009-10-02 15:31:48 +0200 | [diff] [blame] | 910 | } |
| 911 | |
| 912 | MODULE_DESCRIPTION("AMD MCE decoder"); |
| 913 | MODULE_ALIAS("edac-mce-amd"); |
| 914 | MODULE_LICENSE("GPL"); |
| 915 | module_exit(mce_amd_exit); |
| 916 | #endif |