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

ARC: boot log: eliminate struct cpuinfo_arc #4: boot log per ISA

- boot log now clearly per ISA
- global struct cpuinfo_arc[] elimiated
- local struct struct arcinfo kept for passing info
between functions

Tested-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202308162101.Ve5jBg80-lkp@intel.com
Signed-off-by: Vineet Gupta <vgupta@kernel.org>

+288 -363
+2 -31
arch/arc/include/asm/arcregs.h
··· 23 23 #define ARC_REG_ICCM_BUILD 0x78 /* ICCM size (common) */ 24 24 #define ARC_REG_XY_MEM_BCR 0x79 25 25 #define ARC_REG_MAC_BCR 0x7a 26 - #define ARC_REG_MUL_BCR 0x7b 26 + #define ARC_REG_MPY_BCR 0x7b 27 27 #define ARC_REG_SWAP_BCR 0x7c 28 28 #define ARC_REG_NORM_BCR 0x7d 29 29 #define ARC_REG_MIXMAX_BCR 0x7e ··· 177 177 #endif 178 178 }; 179 179 180 - struct bcr_uarch_build_arcv2 { 180 + struct bcr_uarch_build { 181 181 #ifdef CONFIG_CPU_BIG_ENDIAN 182 182 unsigned int pad:8, prod:8, maj:8, min:8; 183 183 #else ··· 353 353 #else 354 354 unsigned int ver:8, info:24; 355 355 #endif 356 - }; 357 - 358 - /* 359 - ******************************************************************* 360 - * Generic structures to hold build configuration used at runtime 361 - */ 362 - 363 - struct cpuinfo_arc_bpu { 364 - unsigned int ver, full, num_cache, num_pred, ret_stk; 365 - }; 366 - 367 - struct cpuinfo_arc_ccm { 368 - unsigned int base_addr, sz; 369 - }; 370 - 371 - struct cpuinfo_arc { 372 - struct cpuinfo_arc_bpu bpu; 373 - struct bcr_identity core; 374 - struct bcr_isa_arcv2 isa; 375 - const char *release, *name; 376 - unsigned int vec_base; 377 - struct cpuinfo_arc_ccm iccm, dccm; 378 - struct { 379 - unsigned int swap:1, norm:1, minmax:1, barrel:1, crc:1, swape:1, pad1:2, 380 - fpu_sp:1, fpu_dp:1, dual:1, dual_enb:1, pad2:4, 381 - ap_num:4, ap_full:1, smart:1, rtt:1, pad3:1, 382 - timer0:1, timer1:1, rtc:1, gfrc:1, pad4:4; 383 - } extn; 384 - struct bcr_mpy extn_mpy; 385 356 }; 386 357 387 358 static inline int is_isa_arcv2(void)
+2 -2
arch/arc/include/asm/setup.h
··· 35 35 #define IS_AVAIL3(v, v2, s) IS_AVAIL1(v, s), IS_AVAIL1(v, IS_DISABLED_RUN(v2)) 36 36 37 37 extern void arc_mmu_init(void); 38 - extern char *arc_mmu_mumbojumbo(int cpu_id, char *buf, int len); 38 + extern int arc_mmu_mumbojumbo(int cpu_id, char *buf, int len); 39 39 40 40 extern void arc_cache_init(void); 41 - extern char *arc_cache_mumbojumbo(int cpu_id, char *buf, int len); 41 + extern int arc_cache_mumbojumbo(int cpu_id, char *buf, int len); 42 42 43 43 extern void __init handle_uboot_args(void); 44 44
+277 -323
arch/arc/kernel/setup.c
··· 29 29 #include <asm/mach_desc.h> 30 30 #include <asm/smp.h> 31 31 #include <asm/dsp-impl.h> 32 + #include <soc/arc/mcip.h> 32 33 33 34 #define FIX_PTR(x) __asm__ __volatile__(";" : "+r"(x)) 34 35 ··· 44 43 45 44 struct task_struct *_current_task[NR_CPUS]; /* For stack switching */ 46 45 47 - struct cpuinfo_arc cpuinfo_arc700[NR_CPUS]; 46 + struct cpuinfo_arc { 47 + int arcver; 48 + unsigned int t0:1, t1:1; 49 + struct { 50 + unsigned long base; 51 + unsigned int sz; 52 + } iccm, dccm; 53 + }; 48 54 49 - static const struct id_to_str arc_legacy_rel[] = { 55 + #ifdef CONFIG_ISA_ARCV2 56 + 57 + static const struct id_to_str arc_hs_rel[] = { 50 58 /* ID.ARCVER, Release */ 51 - #ifdef CONFIG_ISA_ARCOMPACT 52 - { 0x34, "R4.10"}, 53 - { 0x35, "R4.11"}, 54 - #else 55 59 { 0x51, "R2.0" }, 56 60 { 0x52, "R2.1" }, 57 61 { 0x53, "R3.0" }, 58 - #endif 59 - { 0x00, NULL } 60 62 }; 61 63 62 64 static const struct id_to_str arc_hs_ver54_rel[] = { ··· 70 66 { 3, "R4.00a"}, 71 67 { 0xFF, NULL } 72 68 }; 69 + #endif 73 70 74 - static void read_decode_ccm_bcr(struct cpuinfo_arc *cpu) 71 + static int 72 + arcompact_mumbojumbo(int c, struct cpuinfo_arc *info, char *buf, int len) 75 73 { 76 - if (is_isa_arcompact()) { 77 - struct bcr_iccm_arcompact iccm; 78 - struct bcr_dccm_arcompact dccm; 74 + int n = 0; 75 + #ifdef CONFIG_ISA_ARCOMPACT 76 + char *cpu_nm, *isa_nm = "ARCompact"; 77 + struct bcr_fp_arcompact fpu_sp, fpu_dp; 78 + int atomic = 0, be, present; 79 + int bpu_full, bpu_cache, bpu_pred; 80 + struct bcr_bpu_arcompact bpu; 81 + struct bcr_iccm_arcompact iccm; 82 + struct bcr_dccm_arcompact dccm; 83 + struct bcr_generic isa; 79 84 80 - READ_BCR(ARC_REG_ICCM_BUILD, iccm); 81 - if (iccm.ver) { 82 - cpu->iccm.sz = 4096 << iccm.sz; /* 8K to 512K */ 83 - cpu->iccm.base_addr = iccm.base << 16; 84 - } 85 + READ_BCR(ARC_REG_ISA_CFG_BCR, isa); 85 86 86 - READ_BCR(ARC_REG_DCCM_BUILD, dccm); 87 - if (dccm.ver) { 88 - unsigned long base; 89 - cpu->dccm.sz = 2048 << dccm.sz; /* 2K to 256K */ 90 - 91 - base = read_aux_reg(ARC_REG_DCCM_BASE_BUILD); 92 - cpu->dccm.base_addr = base & ~0xF; 93 - } 94 - } else { 95 - struct bcr_iccm_arcv2 iccm; 96 - struct bcr_dccm_arcv2 dccm; 97 - unsigned long region; 98 - 99 - READ_BCR(ARC_REG_ICCM_BUILD, iccm); 100 - if (iccm.ver) { 101 - cpu->iccm.sz = 256 << iccm.sz00; /* 512B to 16M */ 102 - if (iccm.sz00 == 0xF && iccm.sz01 > 0) 103 - cpu->iccm.sz <<= iccm.sz01; 104 - 105 - region = read_aux_reg(ARC_REG_AUX_ICCM); 106 - cpu->iccm.base_addr = region & 0xF0000000; 107 - } 108 - 109 - READ_BCR(ARC_REG_DCCM_BUILD, dccm); 110 - if (dccm.ver) { 111 - cpu->dccm.sz = 256 << dccm.sz0; 112 - if (dccm.sz0 == 0xF && dccm.sz1 > 0) 113 - cpu->dccm.sz <<= dccm.sz1; 114 - 115 - region = read_aux_reg(ARC_REG_AUX_DCCM); 116 - cpu->dccm.base_addr = region & 0xF0000000; 117 - } 87 + if (!isa.ver) /* ISA BCR absent, use Kconfig info */ 88 + atomic = IS_ENABLED(CONFIG_ARC_HAS_LLSC); 89 + else { 90 + /* ARC700_BUILD only has 2 bits of isa info */ 91 + atomic = isa.info & 1; 118 92 } 93 + 94 + be = IS_ENABLED(CONFIG_CPU_BIG_ENDIAN); 95 + 96 + if (info->arcver < 0x34) 97 + cpu_nm = "ARC750"; 98 + else 99 + cpu_nm = "ARC770"; 100 + 101 + n += scnprintf(buf + n, len - n, "processor [%d]\t: %s (%s ISA) %s\n", 102 + c, cpu_nm, isa_nm, IS_AVAIL1(be, "[Big-Endian]")); 103 + 104 + READ_BCR(ARC_REG_FP_BCR, fpu_sp); 105 + READ_BCR(ARC_REG_DPFP_BCR, fpu_dp); 106 + 107 + if (fpu_sp.ver | fpu_dp.ver) 108 + n += scnprintf(buf + n, len - n, "FPU\t\t: %s%s\n", 109 + IS_AVAIL1(fpu_sp.ver, "SP "), 110 + IS_AVAIL1(fpu_dp.ver, "DP ")); 111 + 112 + READ_BCR(ARC_REG_BPU_BCR, bpu); 113 + bpu_full = bpu.fam ? 1 : 0; 114 + bpu_cache = 256 << (bpu.ent - 1); 115 + bpu_pred = 256 << (bpu.ent - 1); 116 + 117 + n += scnprintf(buf + n, len - n, 118 + "BPU\t\t: %s%s match, cache:%d, Predict Table:%d\n", 119 + IS_AVAIL1(bpu_full, "full"), 120 + IS_AVAIL1(!bpu_full, "partial"), 121 + bpu_cache, bpu_pred); 122 + 123 + READ_BCR(ARC_REG_ICCM_BUILD, iccm); 124 + if (iccm.ver) { 125 + info->iccm.sz = 4096 << iccm.sz; /* 8K to 512K */ 126 + info->iccm.base = iccm.base << 16; 127 + } 128 + 129 + READ_BCR(ARC_REG_DCCM_BUILD, dccm); 130 + if (dccm.ver) { 131 + unsigned long base; 132 + info->dccm.sz = 2048 << dccm.sz; /* 2K to 256K */ 133 + 134 + base = read_aux_reg(ARC_REG_DCCM_BASE_BUILD); 135 + info->dccm.base = base & ~0xF; 136 + } 137 + 138 + /* ARCompact ISA specific sanity checks */ 139 + present = fpu_dp.ver; /* SP has no arch visible regs */ 140 + CHK_OPT_STRICT(CONFIG_ARC_FPU_SAVE_RESTORE, present); 141 + #endif 142 + return n; 143 + 119 144 } 120 145 121 - static void decode_arc_core(struct cpuinfo_arc *cpu) 146 + static int arcv2_mumbojumbo(int c, struct cpuinfo_arc *info, char *buf, int len) 122 147 { 123 - struct bcr_uarch_build_arcv2 uarch; 124 - const struct id_to_str *tbl; 125 - 126 - if (cpu->core.family < 0x54) { /* includes arc700 */ 127 - 128 - for (tbl = &arc_legacy_rel[0]; tbl->id != 0; tbl++) { 129 - if (cpu->core.family == tbl->id) { 130 - cpu->release = tbl->str; 131 - break; 132 - } 133 - } 134 - 135 - if (is_isa_arcompact()) 136 - cpu->name = "ARC700"; 137 - else if (tbl->str) 138 - cpu->name = "HS38"; 139 - else 140 - cpu->name = cpu->release = "Unknown"; 141 - 142 - return; 143 - } 148 + int n = 0; 149 + #ifdef CONFIG_ISA_ARCV2 150 + const char *release, *cpu_nm, *isa_nm = "ARCv2"; 151 + int dual_issue = 0, dual_enb = 0, mpy_opt, present; 152 + int bpu_full, bpu_cache, bpu_pred, bpu_ret_stk; 153 + char mpy_nm[16], lpb_nm[32]; 154 + struct bcr_isa_arcv2 isa; 155 + struct bcr_mpy mpy; 156 + struct bcr_fp_arcv2 fpu; 157 + struct bcr_bpu_arcv2 bpu; 158 + struct bcr_lpb lpb; 159 + struct bcr_iccm_arcv2 iccm; 160 + struct bcr_dccm_arcv2 dccm; 161 + struct bcr_erp erp; 144 162 145 163 /* 146 164 * Initial HS cores bumped AUX IDENTITY.ARCVER for each release until 147 165 * ARCVER 0x54 which introduced AUX MICRO_ARCH_BUILD and subsequent 148 166 * releases only update it. 149 167 */ 150 - READ_BCR(ARC_REG_MICRO_ARCH_BCR, uarch); 151 168 152 - if (uarch.prod == 4) { 153 - cpu->name = "HS48"; 154 - cpu->extn.dual = 1; 169 + cpu_nm = "HS38"; 155 170 171 + if (info->arcver > 0x50 && info->arcver <= 0x53) { 172 + release = arc_hs_rel[info->arcver - 0x51].str; 156 173 } else { 157 - cpu->name = "HS38"; 158 - } 174 + const struct id_to_str *tbl; 175 + struct bcr_uarch_build uarch; 159 176 160 - for (tbl = &arc_hs_ver54_rel[0]; tbl->id != 0xFF; tbl++) { 161 - if (uarch.maj == tbl->id) { 162 - cpu->release = tbl->str; 163 - break; 177 + READ_BCR(ARC_REG_MICRO_ARCH_BCR, uarch); 178 + 179 + for (tbl = &arc_hs_ver54_rel[0]; tbl->id != 0xFF; tbl++) { 180 + if (uarch.maj == tbl->id) { 181 + release = tbl->str; 182 + break; 183 + } 164 184 } 165 - } 166 - } 167 - 168 - static void read_arc_build_cfg_regs(void) 169 - { 170 - struct bcr_timer timer; 171 - struct bcr_generic bcr; 172 - struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()]; 173 - struct bcr_isa_arcv2 isa; 174 - struct bcr_actionpoint ap; 175 - 176 - FIX_PTR(cpu); 177 - 178 - READ_BCR(AUX_IDENTITY, cpu->core); 179 - decode_arc_core(cpu); 180 - 181 - READ_BCR(ARC_REG_TIMERS_BCR, timer); 182 - cpu->extn.timer0 = timer.t0; 183 - cpu->extn.timer1 = timer.t1; 184 - cpu->extn.rtc = timer.rtc; 185 - 186 - cpu->vec_base = read_aux_reg(AUX_INTR_VEC_BASE); 187 - 188 - READ_BCR(ARC_REG_MUL_BCR, cpu->extn_mpy); 189 - 190 - /* Read CCM BCRs for boot reporting even if not enabled in Kconfig */ 191 - read_decode_ccm_bcr(cpu); 192 - 193 - if (is_isa_arcompact()) { 194 - struct bcr_fp_arcompact sp, dp; 195 - struct bcr_bpu_arcompact bpu; 196 - 197 - READ_BCR(ARC_REG_FP_BCR, sp); 198 - READ_BCR(ARC_REG_DPFP_BCR, dp); 199 - cpu->extn.fpu_sp = sp.ver ? 1 : 0; 200 - cpu->extn.fpu_dp = dp.ver ? 1 : 0; 201 - 202 - READ_BCR(ARC_REG_BPU_BCR, bpu); 203 - cpu->bpu.ver = bpu.ver; 204 - cpu->bpu.full = bpu.fam ? 1 : 0; 205 - if (bpu.ent) { 206 - cpu->bpu.num_cache = 256 << (bpu.ent - 1); 207 - cpu->bpu.num_pred = 256 << (bpu.ent - 1); 208 - } 209 - } else { 210 - struct bcr_fp_arcv2 spdp; 211 - struct bcr_bpu_arcv2 bpu; 212 - 213 - READ_BCR(ARC_REG_FP_V2_BCR, spdp); 214 - cpu->extn.fpu_sp = spdp.sp ? 1 : 0; 215 - cpu->extn.fpu_dp = spdp.dp ? 1 : 0; 216 - 217 - READ_BCR(ARC_REG_BPU_BCR, bpu); 218 - cpu->bpu.ver = bpu.ver; 219 - cpu->bpu.full = bpu.ft; 220 - cpu->bpu.num_cache = 256 << bpu.bce; 221 - cpu->bpu.num_pred = 2048 << bpu.pte; 222 - cpu->bpu.ret_stk = 4 << bpu.rse; 223 - 224 - /* if dual issue hardware, is it enabled ? */ 225 - if (cpu->extn.dual) { 185 + if (uarch.prod == 4) { 226 186 unsigned int exec_ctrl; 227 187 188 + cpu_nm = "HS48"; 189 + dual_issue = 1; 190 + /* if dual issue hardware, is it enabled ? */ 228 191 READ_BCR(AUX_EXEC_CTRL, exec_ctrl); 229 - cpu->extn.dual_enb = !(exec_ctrl & 1); 192 + dual_enb = !(exec_ctrl & 1); 230 193 } 231 194 } 232 - 233 - READ_BCR(ARC_REG_AP_BCR, ap); 234 - if (ap.ver) { 235 - cpu->extn.ap_num = 2 << ap.num; 236 - cpu->extn.ap_full = !ap.min; 237 - } 238 - 239 - READ_BCR(ARC_REG_SMART_BCR, bcr); 240 - cpu->extn.smart = bcr.ver ? 1 : 0; 241 - 242 - READ_BCR(ARC_REG_RTT_BCR, bcr); 243 - cpu->extn.rtt = bcr.ver ? 1 : 0; 244 195 245 196 READ_BCR(ARC_REG_ISA_CFG_BCR, isa); 246 197 247 - /* some hacks for lack of feature BCR info in old ARC700 cores */ 248 - if (is_isa_arcompact()) { 249 - if (!isa.ver) /* ISA BCR absent, use Kconfig info */ 250 - cpu->isa.atomic = IS_ENABLED(CONFIG_ARC_HAS_LLSC); 251 - else { 252 - /* ARC700_BUILD only has 2 bits of isa info */ 253 - struct bcr_generic bcr = *(struct bcr_generic *)&isa; 254 - cpu->isa.atomic = bcr.info & 1; 255 - } 198 + n += scnprintf(buf + n, len - n, "processor [%d]\t: %s %s (%s ISA) %s%s%s\n", 199 + c, cpu_nm, release, isa_nm, 200 + IS_AVAIL1(isa.be, "[Big-Endian]"), 201 + IS_AVAIL3(dual_issue, dual_enb, " Dual-Issue ")); 256 202 257 - cpu->isa.be = IS_ENABLED(CONFIG_CPU_BIG_ENDIAN); 203 + READ_BCR(ARC_REG_MPY_BCR, mpy); 204 + mpy_opt = 2; /* stock MPY/MPYH */ 205 + if (mpy.dsp) /* OPT 7-9 */ 206 + mpy_opt = mpy.dsp + 6; 258 207 259 - /* there's no direct way to distinguish 750 vs. 770 */ 260 - if (unlikely(cpu->core.family < 0x34)) 261 - cpu->name = "ARC750"; 262 - } else { 263 - cpu->isa = isa; 208 + scnprintf(mpy_nm, 16, "mpy[opt %d] ", mpy_opt); 209 + 210 + READ_BCR(ARC_REG_FP_V2_BCR, fpu); 211 + 212 + n += scnprintf(buf + n, len - n, "ISA Extn\t: %s%s%s%s%s%s%s%s%s%s%s\n", 213 + IS_AVAIL2(isa.atomic, "atomic ", CONFIG_ARC_HAS_LLSC), 214 + IS_AVAIL2(isa.ldd, "ll64 ", CONFIG_ARC_HAS_LL64), 215 + IS_AVAIL2(isa.unalign, "unalign ", CONFIG_ARC_USE_UNALIGNED_MEM_ACCESS), 216 + IS_AVAIL1(mpy.ver, mpy_nm), 217 + IS_AVAIL1(isa.div_rem, "div_rem "), 218 + IS_AVAIL1((fpu.sp | fpu.dp), " FPU:"), 219 + IS_AVAIL1(fpu.sp, " sp"), 220 + IS_AVAIL1(fpu.dp, " dp")); 221 + 222 + READ_BCR(ARC_REG_BPU_BCR, bpu); 223 + bpu_full = bpu.ft; 224 + bpu_cache = 256 << bpu.bce; 225 + bpu_pred = 2048 << bpu.pte; 226 + bpu_ret_stk = 4 << bpu.rse; 227 + 228 + READ_BCR(ARC_REG_LPB_BUILD, lpb); 229 + if (lpb.ver) { 230 + unsigned int ctl; 231 + ctl = read_aux_reg(ARC_REG_LPB_CTRL); 232 + 233 + scnprintf(lpb_nm, sizeof(lpb_nm), " Loop Buffer:%d %s", 234 + lpb.entries, IS_DISABLED_RUN(!ctl)); 264 235 } 265 - } 266 - 267 - static char *arc_cpu_mumbojumbo(int cpu_id, char *buf, int len) 268 - { 269 - struct cpuinfo_arc *cpu = &cpuinfo_arc700[cpu_id]; 270 - struct bcr_identity *core = &cpu->core; 271 - char mpy_opt[16]; 272 - int n = 0; 273 - 274 - FIX_PTR(cpu); 275 236 276 237 n += scnprintf(buf + n, len - n, 277 - "\nIDENTITY\t: ARCVER [%#02x] ARCNUM [%#02x] CHIPID [%#4x]\n", 278 - core->family, core->cpu_id, core->chip_id); 238 + "BPU\t\t: %s%s match, cache:%d, Predict Table:%d Return stk: %d%s\n", 239 + IS_AVAIL1(bpu_full, "full"), 240 + IS_AVAIL1(!bpu_full, "partial"), 241 + bpu_cache, bpu_pred, bpu_ret_stk, 242 + lpb_nm); 279 243 280 - n += scnprintf(buf + n, len - n, "processor [%d]\t: %s %s (%s ISA) %s%s%s\n", 281 - cpu_id, cpu->name, cpu->release, 282 - is_isa_arcompact() ? "ARCompact" : "ARCv2", 283 - IS_AVAIL1(cpu->isa.be, "[Big-Endian]"), 284 - IS_AVAIL3(cpu->extn.dual, cpu->extn.dual_enb, " Dual-Issue ")); 285 - 286 - n += scnprintf(buf + n, len - n, "Timers\t\t: %s%s%s%s%s%s\nISA Extn\t: ", 287 - IS_AVAIL1(cpu->extn.timer0, "Timer0 "), 288 - IS_AVAIL1(cpu->extn.timer1, "Timer1 "), 289 - IS_AVAIL2(cpu->extn.rtc, "RTC [UP 64-bit] ", CONFIG_ARC_TIMERS_64BIT), 290 - IS_AVAIL2(cpu->extn.gfrc, "GFRC [SMP 64-bit] ", CONFIG_ARC_TIMERS_64BIT)); 291 - 292 - if (cpu->extn_mpy.ver) { 293 - if (is_isa_arcompact()) { 294 - scnprintf(mpy_opt, 16, "mpy"); 295 - } else { 296 - 297 - int opt = 2; /* stock MPY/MPYH */ 298 - 299 - if (cpu->extn_mpy.dsp) /* OPT 7-9 */ 300 - opt = cpu->extn_mpy.dsp + 6; 301 - 302 - scnprintf(mpy_opt, 16, "mpy[opt %d] ", opt); 303 - } 244 + READ_BCR(ARC_REG_ICCM_BUILD, iccm); 245 + if (iccm.ver) { 246 + unsigned long base; 247 + info->iccm.sz = 256 << iccm.sz00; /* 512B to 16M */ 248 + if (iccm.sz00 == 0xF && iccm.sz01 > 0) 249 + info->iccm.sz <<= iccm.sz01; 250 + base = read_aux_reg(ARC_REG_AUX_ICCM); 251 + info->iccm.base = base & 0xF0000000; 304 252 } 305 253 306 - n += scnprintf(buf + n, len - n, "%s%s%s%s%s%s%s%s\n", 307 - IS_AVAIL2(cpu->isa.atomic, "atomic ", CONFIG_ARC_HAS_LLSC), 308 - IS_AVAIL2(cpu->isa.ldd, "ll64 ", CONFIG_ARC_HAS_LL64), 309 - IS_AVAIL2(cpu->isa.unalign, "unalign ", CONFIG_ARC_USE_UNALIGNED_MEM_ACCESS), 310 - IS_AVAIL1(cpu->extn_mpy.ver, mpy_opt), 311 - IS_AVAIL1(cpu->isa.div_rem, "div_rem ")); 312 - 313 - if (cpu->bpu.ver) { 314 - n += scnprintf(buf + n, len - n, 315 - "BPU\t\t: %s%s match, cache:%d, Predict Table:%d Return stk: %d", 316 - IS_AVAIL1(cpu->bpu.full, "full"), 317 - IS_AVAIL1(!cpu->bpu.full, "partial"), 318 - cpu->bpu.num_cache, cpu->bpu.num_pred, cpu->bpu.ret_stk); 319 - 320 - if (is_isa_arcv2()) { 321 - struct bcr_lpb lpb; 322 - 323 - READ_BCR(ARC_REG_LPB_BUILD, lpb); 324 - if (lpb.ver) { 325 - unsigned int ctl; 326 - ctl = read_aux_reg(ARC_REG_LPB_CTRL); 327 - 328 - n += scnprintf(buf + n, len - n, " Loop Buffer:%d %s", 329 - lpb.entries, 330 - IS_DISABLED_RUN(!ctl)); 331 - } 332 - } 333 - n += scnprintf(buf + n, len - n, "\n"); 254 + READ_BCR(ARC_REG_DCCM_BUILD, dccm); 255 + if (dccm.ver) { 256 + unsigned long base; 257 + info->dccm.sz = 256 << dccm.sz0; 258 + if (dccm.sz0 == 0xF && dccm.sz1 > 0) 259 + info->dccm.sz <<= dccm.sz1; 260 + base = read_aux_reg(ARC_REG_AUX_DCCM); 261 + info->dccm.base = base & 0xF0000000; 334 262 } 335 263 336 - return buf; 337 - } 338 - 339 - static char *arc_extn_mumbojumbo(int cpu_id, char *buf, int len) 340 - { 341 - int n = 0; 342 - struct cpuinfo_arc *cpu = &cpuinfo_arc700[cpu_id]; 343 - 344 - FIX_PTR(cpu); 345 - 346 - n += scnprintf(buf + n, len - n, "Vector Table\t: %#x\n", cpu->vec_base); 347 - 348 - if (cpu->extn.fpu_sp || cpu->extn.fpu_dp) 349 - n += scnprintf(buf + n, len - n, "FPU\t\t: %s%s\n", 350 - IS_AVAIL1(cpu->extn.fpu_sp, "SP "), 351 - IS_AVAIL1(cpu->extn.fpu_dp, "DP ")); 352 - 353 - if (cpu->extn.ap_num | cpu->extn.smart | cpu->extn.rtt) { 354 - n += scnprintf(buf + n, len - n, "DEBUG\t\t: %s%s", 355 - IS_AVAIL1(cpu->extn.smart, "smaRT "), 356 - IS_AVAIL1(cpu->extn.rtt, "RTT ")); 357 - if (cpu->extn.ap_num) { 358 - n += scnprintf(buf + n, len - n, "ActionPoint %d/%s", 359 - cpu->extn.ap_num, 360 - cpu->extn.ap_full ? "full":"min"); 361 - } 362 - n += scnprintf(buf + n, len - n, "\n"); 363 - } 364 - 365 - if (cpu->dccm.sz || cpu->iccm.sz) 366 - n += scnprintf(buf + n, len - n, "Extn [CCM]\t: DCCM @ %x, %d KB / ICCM: @ %x, %d KB\n", 367 - cpu->dccm.base_addr, TO_KB(cpu->dccm.sz), 368 - cpu->iccm.base_addr, TO_KB(cpu->iccm.sz)); 369 - 370 - if (is_isa_arcv2()) { 371 - 372 - /* Error Protection: ECC/Parity */ 373 - struct bcr_erp erp; 374 - READ_BCR(ARC_REG_ERP_BUILD, erp); 375 - 376 - if (erp.ver) { 377 - struct ctl_erp ctl; 378 - READ_BCR(ARC_REG_ERP_CTRL, ctl); 379 - 380 - /* inverted bits: 0 means enabled */ 381 - n += scnprintf(buf + n, len - n, "Extn [ECC]\t: %s%s%s%s%s%s\n", 264 + /* Error Protection: ECC/Parity */ 265 + READ_BCR(ARC_REG_ERP_BUILD, erp); 266 + if (erp.ver) { 267 + struct ctl_erp ctl; 268 + READ_BCR(ARC_REG_ERP_CTRL, ctl); 269 + /* inverted bits: 0 means enabled */ 270 + n += scnprintf(buf + n, len - n, "Extn [ECC]\t: %s%s%s%s%s%s\n", 382 271 IS_AVAIL3(erp.ic, !ctl.dpi, "IC "), 383 272 IS_AVAIL3(erp.dc, !ctl.dpd, "DC "), 384 273 IS_AVAIL3(erp.mmu, !ctl.mpd, "MMU ")); 385 - } 386 274 } 275 + 276 + /* ARCv2 ISA specific sanity checks */ 277 + present = fpu.sp | fpu.dp | mpy.dsp; /* DSP and/or FPU */ 278 + CHK_OPT_STRICT(CONFIG_ARC_HAS_ACCL_REGS, present); 279 + 280 + dsp_config_check(); 281 + #endif 282 + return n; 283 + } 284 + 285 + static char *arc_cpu_mumbojumbo(int c, struct cpuinfo_arc *info, char *buf, int len) 286 + { 287 + struct bcr_identity ident; 288 + struct bcr_timer timer; 289 + struct bcr_generic bcr; 290 + struct mcip_bcr mp; 291 + struct bcr_actionpoint ap; 292 + unsigned long vec_base; 293 + int ap_num, ap_full, smart, rtt, n; 294 + 295 + memset(info, 0, sizeof(struct cpuinfo_arc)); 296 + 297 + READ_BCR(AUX_IDENTITY, ident); 298 + info->arcver = ident.family; 299 + 300 + n = scnprintf(buf, len, 301 + "\nIDENTITY\t: ARCVER [%#02x] ARCNUM [%#02x] CHIPID [%#4x]\n", 302 + ident.family, ident.cpu_id, ident.chip_id); 303 + 304 + if (is_isa_arcompact()) { 305 + n += arcompact_mumbojumbo(c, info, buf + n, len - n); 306 + } else if (is_isa_arcv2()){ 307 + n += arcv2_mumbojumbo(c, info, buf + n, len - n); 308 + } 309 + 310 + n += arc_mmu_mumbojumbo(c, buf + n, len - n); 311 + n += arc_cache_mumbojumbo(c, buf + n, len - n); 312 + 313 + READ_BCR(ARC_REG_TIMERS_BCR, timer); 314 + info->t0 = timer.t0; 315 + info->t1 = timer.t1; 316 + 317 + READ_BCR(ARC_REG_MCIP_BCR, mp); 318 + vec_base = read_aux_reg(AUX_INTR_VEC_BASE); 319 + 320 + n += scnprintf(buf + n, len - n, 321 + "Timers\t\t: %s%s%s%s%s%s\nVector Table\t: %#lx\n", 322 + IS_AVAIL1(timer.t0, "Timer0 "), 323 + IS_AVAIL1(timer.t1, "Timer1 "), 324 + IS_AVAIL2(timer.rtc, "RTC [UP 64-bit] ", CONFIG_ARC_TIMERS_64BIT), 325 + IS_AVAIL2(mp.gfrc, "GFRC [SMP 64-bit] ", CONFIG_ARC_TIMERS_64BIT), 326 + vec_base); 327 + 328 + READ_BCR(ARC_REG_AP_BCR, ap); 329 + if (ap.ver) { 330 + ap_num = 2 << ap.num; 331 + ap_full = !ap.min; 332 + } 333 + 334 + READ_BCR(ARC_REG_SMART_BCR, bcr); 335 + smart = bcr.ver ? 1 : 0; 336 + 337 + READ_BCR(ARC_REG_RTT_BCR, bcr); 338 + rtt = bcr.ver ? 1 : 0; 339 + 340 + if (ap.ver | smart | rtt) { 341 + n += scnprintf(buf + n, len - n, "DEBUG\t\t: %s%s", 342 + IS_AVAIL1(smart, "smaRT "), 343 + IS_AVAIL1(rtt, "RTT ")); 344 + if (ap.ver) { 345 + n += scnprintf(buf + n, len - n, "ActionPoint %d/%s", 346 + ap_num, 347 + ap_full ? "full":"min"); 348 + } 349 + n += scnprintf(buf + n, len - n, "\n"); 350 + } 351 + 352 + if (info->dccm.sz || info->iccm.sz) 353 + n += scnprintf(buf + n, len - n, 354 + "Extn [CCM]\t: DCCM @ %lx, %d KB / ICCM: @ %lx, %d KB\n", 355 + info->dccm.base, TO_KB(info->dccm.sz), 356 + info->iccm.base, TO_KB(info->iccm.sz)); 387 357 388 358 return buf; 389 359 } ··· 376 398 panic("Disable %s, hardware NOT present\n", opt_name); 377 399 } 378 400 379 - static void arc_chk_core_config(void) 401 + /* 402 + * ISA agnostic sanity checks 403 + */ 404 + static void arc_chk_core_config(struct cpuinfo_arc *info) 380 405 { 381 - struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()]; 382 - int present = 0; 383 - 384 - if (!cpu->extn.timer0) 406 + if (!info->t0) 385 407 panic("Timer0 is not present!\n"); 386 408 387 - if (!cpu->extn.timer1) 409 + if (!info->t1) 388 410 panic("Timer1 is not present!\n"); 389 411 390 412 #ifdef CONFIG_ARC_HAS_DCCM ··· 392 414 * DCCM can be arbit placed in hardware. 393 415 * Make sure it's placement/sz matches what Linux is built with 394 416 */ 395 - if ((unsigned int)__arc_dccm_base != cpu->dccm.base_addr) 417 + if ((unsigned int)__arc_dccm_base != info->dccm.base) 396 418 panic("Linux built with incorrect DCCM Base address\n"); 397 419 398 - if (CONFIG_ARC_DCCM_SZ * SZ_1K != cpu->dccm.sz) 420 + if (CONFIG_ARC_DCCM_SZ * SZ_1K != info->dccm.sz) 399 421 panic("Linux built with incorrect DCCM Size\n"); 400 422 #endif 401 423 402 424 #ifdef CONFIG_ARC_HAS_ICCM 403 - if (CONFIG_ARC_ICCM_SZ * SZ_1K != cpu->iccm.sz) 425 + if (CONFIG_ARC_ICCM_SZ * SZ_1K != info->iccm.sz) 404 426 panic("Linux built with incorrect ICCM Size\n"); 405 427 #endif 406 - 407 - /* 408 - * FP hardware/software config sanity 409 - * -If hardware present, kernel needs to save/restore FPU state 410 - * -If not, it will crash trying to save/restore the non-existant regs 411 - */ 412 - 413 - if (is_isa_arcompact()) { 414 - /* only DPDP checked since SP has no arch visible regs */ 415 - present = cpu->extn.fpu_dp; 416 - CHK_OPT_STRICT(CONFIG_ARC_FPU_SAVE_RESTORE, present); 417 - } else { 418 - /* Accumulator Low:High pair (r58:59) present if DSP MPY or FPU */ 419 - present = cpu->extn_mpy.dsp | cpu->extn.fpu_sp | cpu->extn.fpu_dp; 420 - CHK_OPT_STRICT(CONFIG_ARC_HAS_ACCL_REGS, present); 421 - 422 - dsp_config_check(); 423 - } 424 428 } 425 429 426 430 /* ··· 413 453 414 454 void setup_processor(void) 415 455 { 456 + struct cpuinfo_arc info; 457 + int c = smp_processor_id(); 416 458 char str[512]; 417 - int cpu_id = smp_processor_id(); 418 459 419 - read_arc_build_cfg_regs(); 460 + pr_info("%s", arc_cpu_mumbojumbo(c, &info, str, sizeof(str))); 461 + pr_info("%s", arc_platform_smp_cpuinfo()); 462 + 463 + arc_chk_core_config(&info); 464 + 420 465 arc_init_IRQ(); 421 - 422 - pr_info("%s", arc_cpu_mumbojumbo(cpu_id, str, sizeof(str))); 423 - pr_info("%s", arc_mmu_mumbojumbo(cpu_id, str, sizeof(str))); 424 - pr_info("%s", arc_cache_mumbojumbo(cpu_id, str, sizeof(str))); 425 - 426 466 arc_mmu_init(); 427 467 arc_cache_init(); 428 468 429 - pr_info("%s", arc_extn_mumbojumbo(cpu_id, str, sizeof(str))); 430 - pr_info("%s", arc_platform_smp_cpuinfo()); 431 - 432 - arc_chk_core_config(); 433 469 } 434 470 435 471 static inline bool uboot_arg_invalid(unsigned long addr) ··· 572 616 char *str; 573 617 int cpu_id = ptr_to_cpu(v); 574 618 struct device *cpu_dev = get_cpu_device(cpu_id); 619 + struct cpuinfo_arc info; 575 620 struct clk *cpu_clk; 576 621 unsigned long freq = 0; 577 622 ··· 585 628 if (!str) 586 629 goto done; 587 630 588 - seq_printf(m, arc_cpu_mumbojumbo(cpu_id, str, PAGE_SIZE)); 631 + seq_printf(m, arc_cpu_mumbojumbo(cpu_id, &info, str, PAGE_SIZE)); 589 632 590 633 cpu_clk = clk_get(cpu_dev, NULL); 591 634 if (IS_ERR(cpu_clk)) { ··· 602 645 loops_per_jiffy / (500000 / HZ), 603 646 (loops_per_jiffy / (5000 / HZ)) % 100); 604 647 605 - seq_printf(m, arc_mmu_mumbojumbo(cpu_id, str, PAGE_SIZE)); 606 - seq_printf(m, arc_cache_mumbojumbo(cpu_id, str, PAGE_SIZE)); 607 - seq_printf(m, arc_extn_mumbojumbo(cpu_id, str, PAGE_SIZE)); 608 648 seq_printf(m, arc_platform_smp_cpuinfo()); 609 649 610 650 free_page((unsigned long)str);
+5 -5
arch/arc/mm/cache.c
··· 39 39 void (*__dma_cache_inv)(phys_addr_t start, unsigned long sz); 40 40 void (*__dma_cache_wback)(phys_addr_t start, unsigned long sz); 41 41 42 - static char *read_decode_cache_bcr_arcv2(int c, char *buf, int len) 42 + static int read_decode_cache_bcr_arcv2(int c, char *buf, int len) 43 43 { 44 44 struct cpuinfo_arc_cache *p_slc = &slc_info; 45 45 struct bcr_identity ident; ··· 94 94 perip_base, 95 95 IS_AVAIL3(ioc_exists, ioc_enable, ", IO-Coherency (per-device) ")); 96 96 97 - return buf; 97 + return n; 98 98 } 99 99 100 - char *arc_cache_mumbojumbo(int c, char *buf, int len) 100 + int arc_cache_mumbojumbo(int c, char *buf, int len) 101 101 { 102 102 struct cpuinfo_arc_cache *p_ic = &ic_info, *p_dc = &dc_info; 103 103 struct bcr_cache ibcr, dbcr; ··· 153 153 154 154 slc_chk: 155 155 if (is_isa_arcv2()) 156 - read_decode_cache_bcr_arcv2(c, buf + n, len - n); 156 + n += read_decode_cache_bcr_arcv2(c, buf + n, len - n); 157 157 158 - return buf; 158 + return n; 159 159 } 160 160 161 161 /*
+2 -2
arch/arc/mm/tlb.c
··· 562 562 * the cpuinfo structure for later use. 563 563 * No Validation is done here, simply read/convert the BCRs 564 564 */ 565 - char *arc_mmu_mumbojumbo(int c, char *buf, int len) 565 + int arc_mmu_mumbojumbo(int c, char *buf, int len) 566 566 { 567 567 struct cpuinfo_arc_mmu *mmu = &mmuinfo; 568 568 unsigned int bcr, u_dtlb, u_itlb, sasid; ··· 607 607 IS_AVAIL1(sasid, ", SASID"), 608 608 IS_AVAIL2(mmu->pae, ", PAE40 ", CONFIG_ARC_HAS_PAE40)); 609 609 610 - return buf; 610 + return n; 611 611 } 612 612 613 613 int pae40_exist_but_not_enab(void)