Skip to content

Commit 6dc3251

Browse files
vineetgarcSergey Matyukevich
authored andcommitted
ARC: boot log: eliminate struct cpuinfo_arc
This is first step in eliminating struct cpuinfo_arc[NR_CPUS] Back when we had just ARCompact ISA, the idea was to read/bit-fiddle the BCRs once and and cache decoded information in a global struct ready to use. With ARCv2 it was modified to contained abstract / ISA agnostic information. However with ARCv3 there 's too much disparity to abstract in common structures. So drop the entire decode once and store paradigm. Afterall there's only 2 users of this machinery anyways: boot printing and cat /proc/cpuinfo. None is performance critical to warrant locking away resident memory per cpu. - This is the commit message #1: This patch is first step in that direction - decouples struct cpuinfo_arc_mmu from global struct cpuinfo_arc - mmu code still has a trimmed down static version of struct cpuinfo_arc_mmu to cache information needed in performance critical code such as tlb flush routines - folds read_decode_mmu_bcr() into arc_mmu_mumbojumbo() - setup_processor() directly calls arc_mmu_init() and not via arc_cpu_init() - This is the commit message #2: ARC: boot log: eliminate struct cpuinfo_arc #2: cache - This is the commit message #3: ARC: eliminate struct cpuinfo_arc #3: don't export - This is the commit message #4: ARC: boot log: eliminate struct cpuinfo_arc #4 - boot log now clearly per ISA - global struct cpuinfo_arc[] elimiated - local struct struct arcinfo kept for passing info between functions Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
1 parent 9da66de commit 6dc3251

File tree

6 files changed

+417
-521
lines changed

6 files changed

+417
-521
lines changed

arch/arc/include/asm/arcregs.h

Lines changed: 55 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#define ARC_REG_ICCM_BUILD 0x78 /* ICCM size (common) */
2424
#define ARC_REG_XY_MEM_BCR 0x79
2525
#define ARC_REG_MAC_BCR 0x7a
26-
#define ARC_REG_MUL_BCR 0x7b
26+
#define ARC_REG_MPY_BCR 0x7b
2727
#define ARC_REG_SWAP_BCR 0x7c
2828
#define ARC_REG_NORM_BCR 0x7d
2929
#define ARC_REG_MIXMAX_BCR 0x7e
@@ -177,14 +177,67 @@ struct bcr_isa_arcv2 {
177177
#endif
178178
};
179179

180-
struct bcr_uarch_build_arcv2 {
180+
struct bcr_uarch_build {
181181
#ifdef CONFIG_CPU_BIG_ENDIAN
182182
unsigned int pad:8, prod:8, maj:8, min:8;
183183
#else
184184
unsigned int min:8, maj:8, prod:8, pad:8;
185185
#endif
186186
};
187187

188+
struct bcr_mmu_3 {
189+
#ifdef CONFIG_CPU_BIG_ENDIAN
190+
unsigned int ver:8, ways:4, sets:4, res:3, sasid:1, pg_sz:4,
191+
u_itlb:4, u_dtlb:4;
192+
#else
193+
unsigned int u_dtlb:4, u_itlb:4, pg_sz:4, sasid:1, res:3, sets:4,
194+
ways:4, ver:8;
195+
#endif
196+
};
197+
198+
struct bcr_mmu_4 {
199+
#ifdef CONFIG_CPU_BIG_ENDIAN
200+
unsigned int ver:8, sasid:1, sz1:4, sz0:4, res:2, pae:1,
201+
n_ways:2, n_entry:2, n_super:2, u_itlb:3, u_dtlb:3;
202+
#else
203+
/* DTLB ITLB JES JE JA */
204+
unsigned int u_dtlb:3, u_itlb:3, n_super:2, n_entry:2, n_ways:2,
205+
pae:1, res:2, sz0:4, sz1:4, sasid:1, ver:8;
206+
#endif
207+
};
208+
209+
struct bcr_cache {
210+
#ifdef CONFIG_CPU_BIG_ENDIAN
211+
unsigned int pad:12, line_len:4, sz:4, config:4, ver:8;
212+
#else
213+
unsigned int ver:8, config:4, sz:4, line_len:4, pad:12;
214+
#endif
215+
};
216+
217+
struct bcr_slc_cfg {
218+
#ifdef CONFIG_CPU_BIG_ENDIAN
219+
unsigned int pad:24, way:2, lsz:2, sz:4;
220+
#else
221+
unsigned int sz:4, lsz:2, way:2, pad:24;
222+
#endif
223+
};
224+
225+
struct bcr_clust_cfg {
226+
#ifdef CONFIG_CPU_BIG_ENDIAN
227+
unsigned int pad:7, c:1, num_entries:8, num_cores:8, ver:8;
228+
#else
229+
unsigned int ver:8, num_cores:8, num_entries:8, c:1, pad:7;
230+
#endif
231+
};
232+
233+
struct bcr_volatile {
234+
#ifdef CONFIG_CPU_BIG_ENDIAN
235+
unsigned int start:4, limit:4, pad:22, order:1, disable:1;
236+
#else
237+
unsigned int disable:1, order:1, pad:22, limit:4, start:4;
238+
#endif
239+
};
240+
188241
struct bcr_mpy {
189242
#ifdef CONFIG_CPU_BIG_ENDIAN
190243
unsigned int pad:8, x1616:8, dsp:4, cycles:2, type:2, ver:8;
@@ -302,49 +355,6 @@ struct bcr_generic {
302355
#endif
303356
};
304357

305-
/*
306-
*******************************************************************
307-
* Generic structures to hold build configuration used at runtime
308-
*/
309-
310-
struct cpuinfo_arc_mmu {
311-
unsigned int ver:4, pg_sz_k:8, s_pg_sz_m:8, pad:10, sasid:1, pae:1;
312-
unsigned int sets:12, ways:4, u_dtlb:8, u_itlb:8;
313-
};
314-
315-
struct cpuinfo_arc_cache {
316-
unsigned int sz_k:14, line_len:8, assoc:4, alias:1, vipt:1, pad:4;
317-
};
318-
319-
struct cpuinfo_arc_bpu {
320-
unsigned int ver, full, num_cache, num_pred, ret_stk;
321-
};
322-
323-
struct cpuinfo_arc_ccm {
324-
unsigned long base_addr;
325-
unsigned int sz;
326-
};
327-
328-
struct cpuinfo_arc {
329-
struct cpuinfo_arc_cache icache, dcache, slc;
330-
struct cpuinfo_arc_mmu mmu;
331-
struct cpuinfo_arc_bpu bpu;
332-
struct bcr_identity core;
333-
struct bcr_isa_arcv2 isa;
334-
const char *release, *name;
335-
unsigned long vec_base;
336-
struct cpuinfo_arc_ccm iccm, dccm;
337-
struct {
338-
unsigned int swap:1, norm:1, minmax:1, barrel:1, crc:1, swape:1, pad1:2,
339-
fpu_sp:1, fpu_dp:1, dual:1, dual_enb:1, pad2:4,
340-
ap_num:4, ap_full:1, smart:1, rtt:1, pad3:1,
341-
timer0:1, timer1:1, rtc:1, gfrc:1, pad4:4;
342-
} extn;
343-
struct bcr_mpy extn_mpy;
344-
};
345-
346-
extern struct cpuinfo_arc cpuinfo_arc700[];
347-
348358
static inline int is_isa_arcv3(void)
349359
{
350360
return IS_ENABLED(CONFIG_ISA_ARCV3);

arch/arc/include/asm/setup.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,9 @@ long __init arc_get_mem_sz(void);
3535
#define IS_AVAIL3(v, v2, s) IS_AVAIL1(v, s), IS_AVAIL1(v, IS_DISABLED_RUN(v2))
3636

3737
extern void arc_mmu_init(void);
38-
extern char *arc_mmu_mumbojumbo(int cpu_id, char *buf, int len);
39-
extern void read_decode_mmu_bcr(void);
38+
extern int arc_mmu_mumbojumbo(int cpu_id, char *buf, int len);
4039

4140
extern void arc_cache_init(void);
42-
extern char *arc_cache_mumbojumbo(int cpu_id, char *buf, int len);
43-
extern void read_decode_cache_bcr(void);
41+
extern int arc_cache_mumbojumbo(int cpu_id, char *buf, int len);
4442

4543
#endif /* __ASMARC_SETUP_H */

arch/arc/kernel/mcip.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,6 @@ static void mcip_probe_n_setup(void)
165165
IS_AVAIL1(mp.idu, "IDU "),
166166
IS_AVAIL1(mp.dbg, "DEBUG "),
167167
IS_AVAIL1(mp.gfrc, "GFRC"));
168-
169-
cpuinfo_arc700[0].extn.gfrc = mp.gfrc;
170168
}
171169

172170
struct plat_smp_ops plat_smp_ops = {

0 commit comments

Comments
 (0)