Skip to contentSkip to conversation

arc: significant cache rework

PATCH Superseded Alexey Brodkin 1 participant 1 message May 18, 2015 Synopsys ARC architecture

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arc: significant cache rework

[1] Align cache management functions to those in Linux kernel. I.e.:
a) Use the same functions for all cache ops (D$ Inv/Flush)
b) Split cache ops in 3 sub-functions: "before", "lineloop" and
"after". That way we may re-use "before" and "after" functions for region and full cache ops.

[2] Implement full-functional L2 (SLC) management. Before SLC was
simply disabled early on boot. It's also possible to enable or disable L2 cache from config utility.

[3] Disable/enable corresponding caches early on boot. So if U-Boot is
configured to use caches they will be used at all times (this is useful in partucular for speed-up of relocation).

---
 arch/arc/Kconfig               |  10 ++
 arch/arc/include/asm/arcregs.h |   5 +-
 arch/arc/include/asm/cache.h   |   7 +-
 arch/arc/lib/cache.c           | 378 ++++++++++++++++++++++++++++-------------
 arch/arc/lib/cpu.c             |   2 +
 arch/arc/lib/init_helpers.c    |  10 +-
 arch/arc/lib/start.S           |  50 +++++-
 7 files changed, 317 insertions(+), 145 deletions(-)
arch/arc/Kconfig +10 -0
index 67d28d3..a8f82b1 100644
@@ -130,6 +130,16 @@ config ARC_CACHE_LINE_SHIFT
 	  So line lengths of 32, 64, 128 are specified by 5,6,7, respectively
 	  Linux only supports same line lengths for I and D caches.
 
+config SYS_L2CACHE_OFF
+	bool "Do not use L2 cache (AKA System-Level Cache, SLC)"
+	default n
+	depends on ISA_ARCV2
+	depends on !SYS_DCACHE_OFF
+	help
+	  ARC cores based on ISAv2 may have L2 cache, also known as SLC
+	  (System-Level Cache).
+	  Select this option to disable usage of L2 cache completely.
+
 choice
 	prompt "Target select"
 	optional
arch/arc/include/asm/arcregs.h +4 -1
index 0e11dcc..667f218 100644
@@ -47,9 +47,12 @@
 #endif
 #define ARC_BCR_DC_BUILD	0x72
 #define ARC_BCR_SLC		0xce
-#define ARC_AUX_SLC_CONTROL	0x903
+#define ARC_AUX_SLC_CONFIG	0x901
+#define ARC_AUX_SLC_CTRL	0x903
 #define ARC_AUX_SLC_FLUSH	0x904
 #define ARC_AUX_SLC_INVALIDATE	0x905
+#define ARC_AUX_SLC_IVDL	0x910
+#define ARC_AUX_SLC_FLDL	0x912
 
 #ifndef __ASSEMBLY__
 /* Accessors for auxiliary registers */
arch/arc/include/asm/cache.h +1 -6
index 0b3ebd9..432606a 100644
@@ -29,12 +29,7 @@
 
 #ifndef __ASSEMBLY__
 
-#ifdef CONFIG_ISA_ARCV2
-void slc_enable(void);
-void slc_disable(void);
-void slc_flush(void);
-void slc_invalidate(void);
-#endif
+void cache_init(void);
 
 #endif /* __ASSEMBLY__ */
 
arch/arc/lib/cache.c +258 -120

466 lines not on this page · raw message

arch/arc/lib/cpu.c +2 -0
index 3c930bc..4e4dd74 100644
@@ -23,6 +23,8 @@ int arch_cpu_init(void)
 	gd->cpu_clk = CONFIG_SYS_CLK_FREQ;
 	gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
 
+	cache_init();
+
 	return 0;
 }
 
arch/arc/lib/init_helpers.c +1 -9
index 25690ee..dbc8d68 100644
@@ -10,16 +10,8 @@ DECLARE_GLOBAL_DATA_PTR;
 
 int init_cache_f_r(void)
 {
-#ifndef CONFIG_SYS_ICACHE_OFF
-	icache_enable();
-	/* Make sure no stale entries persist from before we disabled cache */
-	invalidate_icache_all();
-#endif
-
 #ifndef CONFIG_SYS_DCACHE_OFF
-	dcache_enable();
-	/* Make sure no stale entries persist from before we disabled cache */
-	invalidate_dcache_all();
+	flush_dcache_all();
 #endif
 	return 0;
 }
arch/arc/lib/start.S +41 -9

59 lines not on this page · raw message

Signature · 1 line
2.1.0