diff options
author | Vineet Gupta <vgupta@synopsys.com> | 2014-06-27 06:19:47 -0400 |
---|---|---|
committer | Vineet Gupta <vgupta@synopsys.com> | 2014-07-23 01:52:10 -0400 |
commit | da40ff48bda631b2530e561d5cc0663baae8d7de (patch) | |
tree | 9cfb7f231b1fd6d1cf0e62d91ed92a49564ca727 /arch | |
parent | 590892deb650fa152698f0a2f4eba44789e51c38 (diff) |
ARC: cache boot reporting updates
* print aliasing or not, VIPT/PIPT etc
* compress param storage using bitfields
* more use of IS_ENABLED to de-uglify code
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arc/include/asm/arcregs.h | 2 | ||||
-rw-r--r-- | arch/arc/mm/cache_arc700.c | 61 |
2 files changed, 37 insertions, 26 deletions
diff --git a/arch/arc/include/asm/arcregs.h b/arch/arc/include/asm/arcregs.h index 355cb470c2a4..372466b371bf 100644 --- a/arch/arc/include/asm/arcregs.h +++ b/arch/arc/include/asm/arcregs.h | |||
@@ -296,7 +296,7 @@ struct cpuinfo_arc_mmu { | |||
296 | }; | 296 | }; |
297 | 297 | ||
298 | struct cpuinfo_arc_cache { | 298 | struct cpuinfo_arc_cache { |
299 | unsigned int sz, line_len, assoc, ver; | 299 | unsigned int sz_k:8, line_len:8, assoc:4, ver:4, alias:1, vipt:1, pad:6; |
300 | }; | 300 | }; |
301 | 301 | ||
302 | struct cpuinfo_arc_ccm { | 302 | struct cpuinfo_arc_ccm { |
diff --git a/arch/arc/mm/cache_arc700.c b/arch/arc/mm/cache_arc700.c index 353b202c37c9..8070928e89de 100644 --- a/arch/arc/mm/cache_arc700.c +++ b/arch/arc/mm/cache_arc700.c | |||
@@ -77,21 +77,19 @@ char *arc_cache_mumbojumbo(int c, char *buf, int len) | |||
77 | { | 77 | { |
78 | int n = 0; | 78 | int n = 0; |
79 | 79 | ||
80 | #define PR_CACHE(p, enb, str) \ | 80 | #define PR_CACHE(p, cfg, str) \ |
81 | { \ | ||
82 | if (!(p)->ver) \ | 81 | if (!(p)->ver) \ |
83 | n += scnprintf(buf + n, len - n, str"\t\t: N/A\n"); \ | 82 | n += scnprintf(buf + n, len - n, str"\t\t: N/A\n"); \ |
84 | else \ | 83 | else \ |
85 | n += scnprintf(buf + n, len - n, \ | 84 | n += scnprintf(buf + n, len - n, \ |
86 | str"\t\t: (%uK) VIPT, %dway set-asc, %ub Line %s\n", \ | 85 | str"\t\t: %uK, %dway/set, %uB Line, %s%s%s\n", \ |
87 | TO_KB((p)->sz), (p)->assoc, (p)->line_len, \ | 86 | (p)->sz_k, (p)->assoc, (p)->line_len, \ |
88 | enb ? "" : "DISABLED (kernel-build)"); \ | 87 | (p)->vipt ? "VIPT" : "PIPT", \ |
89 | } | 88 | (p)->alias ? " aliasing" : "", \ |
89 | IS_ENABLED(cfg) ? "" : " (not used)"); | ||
90 | 90 | ||
91 | PR_CACHE(&cpuinfo_arc700[c].icache, IS_ENABLED(CONFIG_ARC_HAS_ICACHE), | 91 | PR_CACHE(&cpuinfo_arc700[c].icache, CONFIG_ARC_HAS_ICACHE, "I-Cache"); |
92 | "I-Cache"); | 92 | PR_CACHE(&cpuinfo_arc700[c].dcache, CONFIG_ARC_HAS_DCACHE, "D-Cache"); |
93 | PR_CACHE(&cpuinfo_arc700[c].dcache, IS_ENABLED(CONFIG_ARC_HAS_DCACHE), | ||
94 | "D-Cache"); | ||
95 | 93 | ||
96 | return buf; | 94 | return buf; |
97 | } | 95 | } |
@@ -116,20 +114,31 @@ void read_decode_cache_bcr(void) | |||
116 | p_ic = &cpuinfo_arc700[cpu].icache; | 114 | p_ic = &cpuinfo_arc700[cpu].icache; |
117 | READ_BCR(ARC_REG_IC_BCR, ibcr); | 115 | READ_BCR(ARC_REG_IC_BCR, ibcr); |
118 | 116 | ||
117 | if (!ibcr.ver) | ||
118 | goto dc_chk; | ||
119 | |||
119 | BUG_ON(ibcr.config != 3); | 120 | BUG_ON(ibcr.config != 3); |
120 | p_ic->assoc = 2; /* Fixed to 2w set assoc */ | 121 | p_ic->assoc = 2; /* Fixed to 2w set assoc */ |
121 | p_ic->line_len = 8 << ibcr.line_len; | 122 | p_ic->line_len = 8 << ibcr.line_len; |
122 | p_ic->sz = 0x200 << ibcr.sz; | 123 | p_ic->sz_k = 1 << (ibcr.sz - 1); |
123 | p_ic->ver = ibcr.ver; | 124 | p_ic->ver = ibcr.ver; |
125 | p_ic->vipt = 1; | ||
126 | p_ic->alias = p_ic->sz_k/p_ic->assoc/TO_KB(PAGE_SIZE) > 1; | ||
124 | 127 | ||
128 | dc_chk: | ||
125 | p_dc = &cpuinfo_arc700[cpu].dcache; | 129 | p_dc = &cpuinfo_arc700[cpu].dcache; |
126 | READ_BCR(ARC_REG_DC_BCR, dbcr); | 130 | READ_BCR(ARC_REG_DC_BCR, dbcr); |
127 | 131 | ||
132 | if (!dbcr.ver) | ||
133 | return; | ||
134 | |||
128 | BUG_ON(dbcr.config != 2); | 135 | BUG_ON(dbcr.config != 2); |
129 | p_dc->assoc = 4; /* Fixed to 4w set assoc */ | 136 | p_dc->assoc = 4; /* Fixed to 4w set assoc */ |
130 | p_dc->line_len = 16 << dbcr.line_len; | 137 | p_dc->line_len = 16 << dbcr.line_len; |
131 | p_dc->sz = 0x200 << dbcr.sz; | 138 | p_dc->sz_k = 1 << (dbcr.sz - 1); |
132 | p_dc->ver = dbcr.ver; | 139 | p_dc->ver = dbcr.ver; |
140 | p_dc->vipt = 1; | ||
141 | p_dc->alias = p_dc->sz_k/p_dc->assoc/TO_KB(PAGE_SIZE) > 1; | ||
133 | } | 142 | } |
134 | 143 | ||
135 | /* | 144 | /* |
@@ -142,14 +151,16 @@ void read_decode_cache_bcr(void) | |||
142 | void arc_cache_init(void) | 151 | void arc_cache_init(void) |
143 | { | 152 | { |
144 | unsigned int __maybe_unused cpu = smp_processor_id(); | 153 | unsigned int __maybe_unused cpu = smp_processor_id(); |
145 | struct cpuinfo_arc_cache __maybe_unused *ic, __maybe_unused *dc; | ||
146 | char str[256]; | 154 | char str[256]; |
147 | 155 | ||
148 | printk(arc_cache_mumbojumbo(0, str, sizeof(str))); | 156 | printk(arc_cache_mumbojumbo(0, str, sizeof(str))); |
149 | 157 | ||
150 | #ifdef CONFIG_ARC_HAS_ICACHE | 158 | if (IS_ENABLED(CONFIG_ARC_HAS_ICACHE)) { |
151 | ic = &cpuinfo_arc700[cpu].icache; | 159 | struct cpuinfo_arc_cache *ic = &cpuinfo_arc700[cpu].icache; |
152 | if (ic->ver) { | 160 | |
161 | if (!ic->ver) | ||
162 | panic("cache support enabled but non-existent cache\n"); | ||
163 | |||
153 | if (ic->line_len != L1_CACHE_BYTES) | 164 | if (ic->line_len != L1_CACHE_BYTES) |
154 | panic("ICache line [%d] != kernel Config [%d]", | 165 | panic("ICache line [%d] != kernel Config [%d]", |
155 | ic->line_len, L1_CACHE_BYTES); | 166 | ic->line_len, L1_CACHE_BYTES); |
@@ -158,26 +169,26 @@ void arc_cache_init(void) | |||
158 | panic("Cache ver [%d] doesn't match MMU ver [%d]\n", | 169 | panic("Cache ver [%d] doesn't match MMU ver [%d]\n", |
159 | ic->ver, CONFIG_ARC_MMU_VER); | 170 | ic->ver, CONFIG_ARC_MMU_VER); |
160 | } | 171 | } |
161 | #endif | ||
162 | 172 | ||
163 | #ifdef CONFIG_ARC_HAS_DCACHE | 173 | if (IS_ENABLED(CONFIG_ARC_HAS_DCACHE)) { |
164 | dc = &cpuinfo_arc700[cpu].dcache; | 174 | struct cpuinfo_arc_cache *dc = &cpuinfo_arc700[cpu].dcache; |
165 | if (dc->ver) { | 175 | int handled; |
166 | unsigned int dcache_does_alias; | 176 | |
177 | if (!dc->ver) | ||
178 | panic("cache support enabled but non-existent cache\n"); | ||
167 | 179 | ||
168 | if (dc->line_len != L1_CACHE_BYTES) | 180 | if (dc->line_len != L1_CACHE_BYTES) |
169 | panic("DCache line [%d] != kernel Config [%d]", | 181 | panic("DCache line [%d] != kernel Config [%d]", |
170 | dc->line_len, L1_CACHE_BYTES); | 182 | dc->line_len, L1_CACHE_BYTES); |
171 | 183 | ||
172 | /* check for D-Cache aliasing */ | 184 | /* check for D-Cache aliasing */ |
173 | dcache_does_alias = (dc->sz / dc->assoc) > PAGE_SIZE; | 185 | handled = IS_ENABLED(CONFIG_ARC_CACHE_VIPT_ALIASING); |
174 | 186 | ||
175 | if (dcache_does_alias && !cache_is_vipt_aliasing()) | 187 | if (dc->alias && !handled) |
176 | panic("Enable CONFIG_ARC_CACHE_VIPT_ALIASING\n"); | 188 | panic("Enable CONFIG_ARC_CACHE_VIPT_ALIASING\n"); |
177 | else if (!dcache_does_alias && cache_is_vipt_aliasing()) | 189 | else if (!dc->alias && handled) |
178 | panic("Don't need CONFIG_ARC_CACHE_VIPT_ALIASING\n"); | 190 | panic("Don't need CONFIG_ARC_CACHE_VIPT_ALIASING\n"); |
179 | } | 191 | } |
180 | #endif | ||
181 | } | 192 | } |
182 | 193 | ||
183 | #define OP_INV 0x1 | 194 | #define OP_INV 0x1 |