arc: significant cache rework
PATCH v2 1/1 arc: significant cache rework
From: Alexey Brodkin <[email protected]>
[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. If SLC exists corresponding ops are run on cache flush/invalidate.
[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 particular for speed-up of relocation).
---
Compared to v1:
* Remove explicit selection of L2CACHE on/off in Kconfig, check this in runtime and use L2 ops only when L2 is detected.
This allows run the same executable on HW with and without L2 cache.
--- arch/arc/include/asm/arcregs.h | 5 +- arch/arc/include/asm/cache.h | 7 +- arch/arc/lib/cache.c | 375 ++++++++++++++++++++++++++++------------- arch/arc/lib/cpu.c | 2 + arch/arc/lib/init_helpers.c | 10 +- arch/arc/lib/start.S | 46 ++++- 6 files changed, 300 insertions(+), 145 deletions(-)
arch/arc/include/asm/arcregs.h +4 -1
@@ -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
@@ -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 +255 -120
463 lines not on this page · raw message
arch/arc/lib/cpu.c +2 -0
@@ -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
@@ -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 +37 -9
55 lines not on this page · raw message
Signature · 1 line
2.4.3
Alexey Brodkin
AppliedPATCH v2 1/1 arc: significant cache rework
Quoted 27 lines · Alexey Brodkin
From: Alexey Brodkin <[email protected]>
[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. If SLC exists corresponding ops are run on cache
flush/invalidate.[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 particular for speed-up of relocation).Signed-off-by Alexey Brodkin <[email protected]>---
Compared to v1:
* Remove explicit selection of L2CACHE on/off inKconfig, check this
in runtime
and use L2 ops only when L2 is detected.
This allows run the same executable on HW with and without L2
cache.
Quoted 9 lines
--- arch/arc/include/asm/arcregs.h | 5 +- arch/arc/include/asm/cache.h | 7 +- arch/arc/lib/cache.c | 375 ++++++++++++++++++++++++++++--- ---------- arch/arc/lib/cpu.c | 2 + arch/arc/lib/init_helpers.c | 10 +- arch/arc/lib/start.S | 46 ++++- 6 files changed, 300 insertions(+), 145 deletions(-)
Applied, thanks.
-Alexey