hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/arch/mips/kernel/mips-cm.c
....@@ -1,11 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright (C) 2013 Imagination Technologies
34 * Author: Paul Burton <paul.burton@mips.com>
4
- *
5
- * This program is free software; you can redistribute it and/or modify it
6
- * under the terms of the GNU General Public License as published by the
7
- * Free Software Foundation; either version 2 of the License, or (at your
8
- * option) any later version.
95 */
106
117 #include <linux/errno.h>
....@@ -118,6 +114,48 @@
118114 "Exclusive/OK", "Exclusive/Data"
119115 };
120116
117
+static char *cm2_l2_type[4] = {
118
+ [0x0] = "None",
119
+ [0x1] = "Tag RAM single/double ECC error",
120
+ [0x2] = "Data RAM single/double ECC error",
121
+ [0x3] = "WS RAM uncorrectable dirty parity"
122
+};
123
+
124
+static char *cm2_l2_instr[32] = {
125
+ [0x00] = "L2_NOP",
126
+ [0x01] = "L2_ERR_CORR",
127
+ [0x02] = "L2_TAG_INV",
128
+ [0x03] = "L2_WS_CLEAN",
129
+ [0x04] = "L2_RD_MDYFY_WR",
130
+ [0x05] = "L2_WS_MRU",
131
+ [0x06] = "L2_EVICT_LN2",
132
+ [0x07] = "0x07",
133
+ [0x08] = "L2_EVICT",
134
+ [0x09] = "L2_REFL",
135
+ [0x0a] = "L2_RD",
136
+ [0x0b] = "L2_WR",
137
+ [0x0c] = "L2_EVICT_MRU",
138
+ [0x0d] = "L2_SYNC",
139
+ [0x0e] = "L2_REFL_ERR",
140
+ [0x0f] = "0x0f",
141
+ [0x10] = "L2_INDX_WB_INV",
142
+ [0x11] = "L2_INDX_LD_TAG",
143
+ [0x12] = "L2_INDX_ST_TAG",
144
+ [0x13] = "L2_INDX_ST_DATA",
145
+ [0x14] = "L2_INDX_ST_ECC",
146
+ [0x15] = "0x15",
147
+ [0x16] = "0x16",
148
+ [0x17] = "0x17",
149
+ [0x18] = "L2_FTCH_AND_LCK",
150
+ [0x19] = "L2_HIT_INV",
151
+ [0x1a] = "L2_HIT_WB_INV",
152
+ [0x1b] = "L2_HIT_WB",
153
+ [0x1c] = "0x1c",
154
+ [0x1d] = "0x1d",
155
+ [0x1e] = "0x1e",
156
+ [0x1f] = "0x1f"
157
+};
158
+
121159 static char *cm2_causes[32] = {
122160 "None", "GC_WR_ERR", "GC_RD_ERR", "COH_WR_ERR",
123161 "COH_RD_ERR", "MMIO_WR_ERR", "MMIO_RD_ERR", "0x07",
....@@ -125,7 +163,7 @@
125163 "0x0c", "0x0d", "0x0e", "0x0f",
126164 "0x10", "INTVN_WR_ERR", "INTVN_RD_ERR", "0x13",
127165 "0x14", "0x15", "0x16", "0x17",
128
- "0x18", "0x19", "0x1a", "0x1b",
166
+ "L2_RD_UNCORR", "L2_WR_UNCORR", "L2_CORR", "0x1b",
129167 "0x1c", "0x1d", "0x1e", "0x1f"
130168 };
131169
....@@ -197,7 +235,7 @@
197235 write_gcr_l2_only_sync_base(addr | CM_GCR_L2_ONLY_SYNC_BASE_SYNCEN);
198236
199237 /* Map the region */
200
- mips_cm_l2sync_base = ioremap_nocache(addr, MIPS_CM_L2SYNC_SIZE);
238
+ mips_cm_l2sync_base = ioremap(addr, MIPS_CM_L2SYNC_SIZE);
201239 }
202240
203241 int mips_cm_probe(void)
....@@ -218,7 +256,7 @@
218256 if (!addr)
219257 return -ENODEV;
220258
221
- mips_gcr_base = ioremap_nocache(addr, MIPS_CM_GCR_SIZE);
259
+ mips_gcr_base = ioremap(addr, MIPS_CM_GCR_SIZE);
222260 if (!mips_gcr_base)
223261 return -ENXIO;
224262
....@@ -363,7 +401,7 @@
363401 "CCA=%lu TR=%s MCmd=%s STag=%lu "
364402 "SPort=%lu\n", cca_bits, cm2_tr[tr_bits],
365403 cm2_cmd[cmd_bits], stag_bits, sport_bits);
366
- } else {
404
+ } else if (cause < 24) {
367405 /* glob state & sresp together */
368406 unsigned long c3_bits = (cm_error >> 18) & 7;
369407 unsigned long c2_bits = (cm_error >> 15) & 7;
....@@ -380,9 +418,25 @@
380418 cm2_core[c1_bits], cm2_core[c0_bits],
381419 sc_bit ? "True" : "False",
382420 cm2_cmd[cmd_bits], sport_bits);
421
+ } else {
422
+ unsigned long muc_bit = (cm_error >> 23) & 1;
423
+ unsigned long ins_bits = (cm_error >> 18) & 0x1f;
424
+ unsigned long arr_bits = (cm_error >> 16) & 3;
425
+ unsigned long dw_bits = (cm_error >> 12) & 15;
426
+ unsigned long way_bits = (cm_error >> 9) & 7;
427
+ unsigned long mway_bit = (cm_error >> 8) & 1;
428
+ unsigned long syn_bits = (cm_error >> 0) & 0xFF;
429
+
430
+ snprintf(buf, sizeof(buf),
431
+ "Type=%s%s Instr=%s DW=%lu Way=%lu "
432
+ "MWay=%s Syndrome=0x%02lx",
433
+ muc_bit ? "Multi-UC " : "",
434
+ cm2_l2_type[arr_bits],
435
+ cm2_l2_instr[ins_bits], dw_bits, way_bits,
436
+ mway_bit ? "True" : "False", syn_bits);
383437 }
384
- pr_err("CM_ERROR=%08llx %s <%s>\n", cm_error,
385
- cm2_causes[cause], buf);
438
+ pr_err("CM_ERROR=%08llx %s <%s>\n", cm_error,
439
+ cm2_causes[cause], buf);
386440 pr_err("CM_ADDR =%08llx\n", cm_addr);
387441 pr_err("CM_OTHER=%08llx %s\n", cm_other, cm2_causes[ocause]);
388442 } else { /* CM3 */