aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arc
diff options
context:
space:
mode:
authorVineet Gupta <vgupta@synopsys.com>2013-09-05 03:47:49 -0400
committerVineet Gupta <vgupta@synopsys.com>2013-11-06 00:11:37 -0500
commit63d2dfdbf4b12a6993adf5005fd308d611d453d6 (patch)
treeb4878a30a70b513ff081f2a4ec0f61a683d0e029 /arch/arc
parentf3e4de327403cee6f76c0dca1b45d6fb0b08daf4 (diff)
ARC: cacheflush refactor #2: I and D caches lines to have same size
Having them be different seems an obscure configuration. Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Diffstat (limited to 'arch/arc')
-rw-r--r--arch/arc/include/asm/cache.h8
-rw-r--r--arch/arc/mm/cache_arc700.c30
2 files changed, 16 insertions, 22 deletions
diff --git a/arch/arc/include/asm/cache.h b/arch/arc/include/asm/cache.h
index e4abdaac6f9f..2fd3162ec4df 100644
--- a/arch/arc/include/asm/cache.h
+++ b/arch/arc/include/asm/cache.h
@@ -17,13 +17,7 @@
17#endif 17#endif
18 18
19#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) 19#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
20 20#define CACHE_LINE_MASK (~(L1_CACHE_BYTES - 1))
21/* For a rare case where customers have differently config I/D */
22#define ARC_ICACHE_LINE_LEN L1_CACHE_BYTES
23#define ARC_DCACHE_LINE_LEN L1_CACHE_BYTES
24
25#define ICACHE_LINE_MASK (~(ARC_ICACHE_LINE_LEN - 1))
26#define DCACHE_LINE_MASK (~(ARC_DCACHE_LINE_LEN - 1))
27 21
28/* 22/*
29 * ARC700 doesn't cache any access in top 256M. 23 * ARC700 doesn't cache any access in top 256M.
diff --git a/arch/arc/mm/cache_arc700.c b/arch/arc/mm/cache_arc700.c
index 2787e5a2c306..0be5b2075701 100644
--- a/arch/arc/mm/cache_arc700.c
+++ b/arch/arc/mm/cache_arc700.c
@@ -182,7 +182,7 @@ void arc_cache_init(void)
182 182
183#ifdef CONFIG_ARC_HAS_ICACHE 183#ifdef CONFIG_ARC_HAS_ICACHE
184 /* 1. Confirm some of I-cache params which Linux assumes */ 184 /* 1. Confirm some of I-cache params which Linux assumes */
185 if (ic->line_len != ARC_ICACHE_LINE_LEN) 185 if (ic->line_len != L1_CACHE_BYTES)
186 panic("Cache H/W doesn't match kernel Config"); 186 panic("Cache H/W doesn't match kernel Config");
187 187
188 if (ic->ver != CONFIG_ARC_MMU_VER) 188 if (ic->ver != CONFIG_ARC_MMU_VER)
@@ -205,7 +205,7 @@ chk_dc:
205 return; 205 return;
206 206
207#ifdef CONFIG_ARC_HAS_DCACHE 207#ifdef CONFIG_ARC_HAS_DCACHE
208 if (dc->line_len != ARC_DCACHE_LINE_LEN) 208 if (dc->line_len != L1_CACHE_BYTES)
209 panic("Cache H/W doesn't match kernel Config"); 209 panic("Cache H/W doesn't match kernel Config");
210 210
211 /* check for D-Cache aliasing */ 211 /* check for D-Cache aliasing */
@@ -298,7 +298,7 @@ static inline void __dc_entire_op(const int cacheop)
298static inline void __dc_line_loop(unsigned long paddr, unsigned long vaddr, 298static inline void __dc_line_loop(unsigned long paddr, unsigned long vaddr,
299 unsigned long sz, const int cacheop) 299 unsigned long sz, const int cacheop)
300{ 300{
301 /* which MMU cmd: INV (discard or wback-n-discard) OR FLUSH (wback) */ 301 /* d$ cmd: INV (discard or wback-n-discard) OR FLUSH (wback) */
302 const int aux = cacheop & OP_INV ? ARC_REG_DC_IVDL : ARC_REG_DC_FLDL; 302 const int aux = cacheop & OP_INV ? ARC_REG_DC_IVDL : ARC_REG_DC_FLDL;
303 int num_lines; 303 int num_lines;
304 304
@@ -309,12 +309,12 @@ static inline void __dc_line_loop(unsigned long paddr, unsigned long vaddr,
309 * -@sz will be integral multiple of line size (being page sized). 309 * -@sz will be integral multiple of line size (being page sized).
310 */ 310 */
311 if (!(__builtin_constant_p(sz) && sz == PAGE_SIZE)) { 311 if (!(__builtin_constant_p(sz) && sz == PAGE_SIZE)) {
312 sz += paddr & ~DCACHE_LINE_MASK; 312 sz += paddr & ~CACHE_LINE_MASK;
313 paddr &= DCACHE_LINE_MASK; 313 paddr &= CACHE_LINE_MASK;
314 vaddr &= DCACHE_LINE_MASK; 314 vaddr &= CACHE_LINE_MASK;
315 } 315 }
316 316
317 num_lines = DIV_ROUND_UP(sz, ARC_DCACHE_LINE_LEN); 317 num_lines = DIV_ROUND_UP(sz, L1_CACHE_BYTES);
318 318
319#if (CONFIG_ARC_MMU_VER <= 2) 319#if (CONFIG_ARC_MMU_VER <= 2)
320 paddr |= (vaddr >> PAGE_SHIFT) & 0x1F; 320 paddr |= (vaddr >> PAGE_SHIFT) & 0x1F;
@@ -329,12 +329,12 @@ static inline void __dc_line_loop(unsigned long paddr, unsigned long vaddr,
329 write_aux_reg(ARC_REG_DC_PTAG, paddr); 329 write_aux_reg(ARC_REG_DC_PTAG, paddr);
330 330
331 write_aux_reg(aux, vaddr); 331 write_aux_reg(aux, vaddr);
332 vaddr += ARC_DCACHE_LINE_LEN; 332 vaddr += L1_CACHE_BYTES;
333#else 333#else
334 /* paddr contains stuffed vaddrs bits */ 334 /* paddr contains stuffed vaddrs bits */
335 write_aux_reg(aux, paddr); 335 write_aux_reg(aux, paddr);
336#endif 336#endif
337 paddr += ARC_DCACHE_LINE_LEN; 337 paddr += L1_CACHE_BYTES;
338 } 338 }
339} 339}
340 340
@@ -443,12 +443,12 @@ static void __ic_line_inv_vaddr(unsigned long paddr, unsigned long vaddr,
443 * -@sz will be integral multiple of line size (being page sized). 443 * -@sz will be integral multiple of line size (being page sized).
444 */ 444 */
445 if (!(__builtin_constant_p(sz) && sz == PAGE_SIZE)) { 445 if (!(__builtin_constant_p(sz) && sz == PAGE_SIZE)) {
446 sz += paddr & ~ICACHE_LINE_MASK; 446 sz += paddr & ~CACHE_LINE_MASK;
447 paddr &= ICACHE_LINE_MASK; 447 paddr &= CACHE_LINE_MASK;
448 vaddr &= ICACHE_LINE_MASK; 448 vaddr &= CACHE_LINE_MASK;
449 } 449 }
450 450
451 num_lines = DIV_ROUND_UP(sz, ARC_ICACHE_LINE_LEN); 451 num_lines = DIV_ROUND_UP(sz, L1_CACHE_BYTES);
452 452
453#if (CONFIG_ARC_MMU_VER <= 2) 453#if (CONFIG_ARC_MMU_VER <= 2)
454 /* bits 17:13 of vaddr go as bits 4:0 of paddr */ 454 /* bits 17:13 of vaddr go as bits 4:0 of paddr */
@@ -463,12 +463,12 @@ static void __ic_line_inv_vaddr(unsigned long paddr, unsigned long vaddr,
463 463
464 /* index bits come from vaddr */ 464 /* index bits come from vaddr */
465 write_aux_reg(ARC_REG_IC_IVIL, vaddr); 465 write_aux_reg(ARC_REG_IC_IVIL, vaddr);
466 vaddr += ARC_ICACHE_LINE_LEN; 466 vaddr += L1_CACHE_BYTES;
467#else 467#else
468 /* paddr contains stuffed vaddrs bits */ 468 /* paddr contains stuffed vaddrs bits */
469 write_aux_reg(ARC_REG_IC_IVIL, paddr); 469 write_aux_reg(ARC_REG_IC_IVIL, paddr);
470#endif 470#endif
471 paddr += ARC_ICACHE_LINE_LEN; 471 paddr += L1_CACHE_BYTES;
472 } 472 }
473 local_irq_restore(flags); 473 local_irq_restore(flags);
474} 474}