Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARCv2: boot log: refurbish HS core/release identification

HS core names and releases have so far been identified based solely on
IDENTIFY.ARCVER field. With the future HS releases this will not
be sufficient as same ARCVER 0x54 could be an HS38 or HS48.

So rewrite the code to use a new BCR to identify the cores properly.

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>

+75 -57
+1 -1
arch/arc/include/asm/arcregs.h
··· 313 313 struct cpuinfo_arc_bpu bpu; 314 314 struct bcr_identity core; 315 315 struct bcr_isa_arcv2 isa; 316 - const char *details, *name; 316 + const char *release, *name; 317 317 unsigned int vec_base; 318 318 struct cpuinfo_arc_ccm iccm, dccm; 319 319 struct {
+74 -56
arch/arc/kernel/setup.c
··· 45 45 46 46 struct cpuinfo_arc cpuinfo_arc700[NR_CPUS]; 47 47 48 - static const struct id_to_str arc_cpu_rel[] = { 48 + static const struct id_to_str arc_legacy_rel[] = { 49 + /* ID.ARCVER, Release */ 49 50 #ifdef CONFIG_ISA_ARCOMPACT 50 - { 0x34, "R4.10"}, 51 - { 0x35, "R4.11"}, 51 + { 0x34, "R4.10"}, 52 + { 0x35, "R4.11"}, 52 53 #else 53 - { 0x51, "R2.0" }, 54 - { 0x52, "R2.1" }, 55 - { 0x53, "R3.0" }, 56 - { 0x54, "R3.10a" }, 54 + { 0x51, "R2.0" }, 55 + { 0x52, "R2.1" }, 56 + { 0x53, "R3.0" }, 57 57 #endif 58 - { 0x00, NULL } 58 + { 0x00, NULL } 59 59 }; 60 60 61 - static const struct id_to_str arc_cpu_nm[] = { 62 - #ifdef CONFIG_ISA_ARCOMPACT 63 - { 0x20, "ARC 600" }, 64 - { 0x30, "ARC 770" }, /* 750 identified seperately */ 65 - #else 66 - { 0x40, "ARC EM" }, 67 - { 0x50, "ARC HS38" }, 68 - { 0x54, "ARC HS48" }, 69 - #endif 70 - { 0x00, "Unknown" } 61 + static const struct id_to_str arc_cpu_rel[] = { 62 + /* UARCH.MAJOR, Release */ 63 + { 0, "R3.10a"}, 64 + { 1, "R3.50a"}, 65 + { 0xFF, NULL } 71 66 }; 72 67 73 68 static void read_decode_ccm_bcr(struct cpuinfo_arc *cpu) ··· 112 117 } 113 118 } 114 119 120 + static void decode_arc_core(struct cpuinfo_arc *cpu) 121 + { 122 + struct bcr_uarch_build_arcv2 uarch; 123 + const struct id_to_str *tbl; 124 + 125 + /* 126 + * Up until (including) the first core4 release (0x54) things were 127 + * simple: AUX IDENTITY.ARCVER was sufficient to identify arc family 128 + * and release: 0x50 to 0x53 was HS38, 0x54 was HS48 (dual issue) 129 + */ 130 + 131 + if (cpu->core.family < 0x54) { /* includes arc700 */ 132 + 133 + for (tbl = &arc_legacy_rel[0]; tbl->id != 0; tbl++) { 134 + if (cpu->core.family == tbl->id) { 135 + cpu->release = tbl->str; 136 + break; 137 + } 138 + } 139 + 140 + if (is_isa_arcompact()) 141 + cpu->name = "ARC700"; 142 + else if (tbl->str) 143 + cpu->name = "HS38"; 144 + else 145 + cpu->name = cpu->release = "Unknown"; 146 + 147 + return; 148 + } 149 + 150 + /* 151 + * However the subsequent HS release (same 0x54) allow HS38 or HS48 152 + * configurations and encode this info in a different BCR. 153 + * The BCR was introduced in 0x54 so can't be read unconditionally. 154 + */ 155 + 156 + READ_BCR(ARC_REG_MICRO_ARCH_BCR, uarch); 157 + 158 + if (uarch.prod == 4) { 159 + cpu->name = "HS48"; 160 + cpu->extn.dual = 1; 161 + 162 + } else { 163 + cpu->name = "HS38"; 164 + } 165 + 166 + for (tbl = &arc_cpu_rel[0]; tbl->id != 0xFF; tbl++) { 167 + if (uarch.maj == tbl->id) { 168 + cpu->release = tbl->str; 169 + break; 170 + } 171 + } 172 + } 173 + 115 174 static void read_arc_build_cfg_regs(void) 116 175 { 117 176 struct bcr_timer timer; 118 177 struct bcr_generic bcr; 119 178 struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()]; 120 - const struct id_to_str *tbl; 121 179 struct bcr_isa_arcv2 isa; 122 180 struct bcr_actionpoint ap; 123 181 124 182 FIX_PTR(cpu); 125 183 126 184 READ_BCR(AUX_IDENTITY, cpu->core); 127 - 128 - for (tbl = &arc_cpu_rel[0]; tbl->id != 0; tbl++) { 129 - if (cpu->core.family == tbl->id) { 130 - cpu->details = tbl->str; 131 - break; 132 - } 133 - } 134 - 135 - for (tbl = &arc_cpu_nm[0]; tbl->id != 0; tbl++) { 136 - if ((cpu->core.family & 0xF4) == tbl->id) 137 - break; 138 - } 139 - cpu->name = tbl->str; 185 + decode_arc_core(cpu); 140 186 141 187 READ_BCR(ARC_REG_TIMERS_BCR, timer); 142 188 cpu->extn.timer0 = timer.t0; ··· 235 199 cpu->bpu.num_pred = 2048 << bpu.pte; 236 200 cpu->bpu.ret_stk = 4 << bpu.rse; 237 201 238 - if (cpu->core.family >= 0x54) { 202 + /* if dual issue hardware, is it enabled ? */ 203 + if (cpu->extn.dual) { 204 + unsigned int exec_ctrl; 239 205 240 - struct bcr_uarch_build_arcv2 uarch; 241 - 242 - /* 243 - * The first 0x54 core (uarch maj:min 0:1 or 0:2) was 244 - * dual issue only (HS4x). But next uarch rev (1:0) 245 - * allows it be configured for single issue (HS3x) 246 - * Ensure we fiddle with dual issue only on HS4x 247 - */ 248 - READ_BCR(ARC_REG_MICRO_ARCH_BCR, uarch); 249 - 250 - if (uarch.prod == 4) { 251 - unsigned int exec_ctrl; 252 - 253 - /* dual issue hardware always present */ 254 - cpu->extn.dual = 1; 255 - 256 - READ_BCR(AUX_EXEC_CTRL, exec_ctrl); 257 - 258 - /* dual issue hardware enabled ? */ 259 - cpu->extn.dual_enb = !(exec_ctrl & 1); 260 - 261 - } 206 + READ_BCR(AUX_EXEC_CTRL, exec_ctrl); 207 + cpu->extn.dual_enb = !(exec_ctrl & 1); 262 208 } 263 209 } 264 210 ··· 291 273 core->family, core->cpu_id, core->chip_id); 292 274 293 275 n += scnprintf(buf + n, len - n, "processor [%d]\t: %s %s (%s ISA) %s%s%s\n", 294 - cpu_id, cpu->name, cpu->details, 276 + cpu_id, cpu->name, cpu->release, 295 277 is_isa_arcompact() ? "ARCompact" : "ARCv2", 296 278 IS_AVAIL1(cpu->isa.be, "[Big-Endian]"), 297 279 IS_AVAIL3(cpu->extn.dual, cpu->extn.dual_enb, " Dual-Issue "));