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