Skip to contentSkip to conversation

arc: cache - accommodate different L1 cache line lengths

PATCH New Alexey Brodkin 1 participant 1 message Dec 14, 2015 Synopsys ARC architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arc: cache - accommodate different L1 cache line lengths

ARC core could be configured with different L1 and L2 (AKA SLC) cache line lengths. At least these values are possible and were really used:
32, 64 or 128 bytes.

Current implementation requires cache line to be selected upon U-Boot configuration and then it will only work on matching hardware. Indeed this is quite efficient because cache line length gets hardcoded during code compilation. But OTOH it makes binary less portable.

With this commit we allow U-Boot to determine real L1 cache line length early in runtime and use this value later on. This extends portability of U-Boot binary a lot.

---
 arch/arc/Kconfig             |  11 ----
 arch/arc/include/asm/cache.h |  14 ++---
 arch/arc/lib/cache.c         | 118 ++++++++++++++++++++++++++++++-------------
 configs/axs101_defconfig     |   1 -
 configs/tb100_defconfig      |   1 -
 5 files changed, 89 insertions(+), 56 deletions(-)
arch/arc/Kconfig +0 -11
index 264c83d..f1dc6c8 100644
@@ -116,17 +116,6 @@ config SYS_DCACHE_OFF
 	bool "Do not use Data Cache"
 	default n
 
-config ARC_CACHE_LINE_SHIFT
-	int "Cache Line Length (as power of 2)"
-	range 5 7
-	default "6"
-	depends on !SYS_DCACHE_OFF || !SYS_ICACHE_OFF
-	help
-	  Starting with ARC700 4.9, Cache line length is configurable,
-	  This option specifies "N", with Line-len = 2 power N
-	  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.
-
 choice
 	prompt "Target select"
 	default TARGET_AXS101
arch/arc/include/asm/cache.h +7 -7
index 432606a..d26d9fb 100644
@@ -9,13 +9,13 @@
 
 #include <config.h>
 
-#ifdef CONFIG_ARC_CACHE_LINE_SHIFT
-#define CONFIG_SYS_CACHELINE_SIZE	(1 << CONFIG_ARC_CACHE_LINE_SHIFT)
-#define ARCH_DMA_MINALIGN		CONFIG_SYS_CACHELINE_SIZE
-#else
-/* Satisfy users of ARCH_DMA_MINALIGN */
-#define ARCH_DMA_MINALIGN		128
-#endif
+/*
+ * As of today we may handle any L1 cache line length right in software.
+ * For that essentially cache line length is a variable not constant.
+ * And to satisfy users of ARCH_DMA_MINALIGN we just use largest line length
+ * that may exist in either L1 or L2 (AKA SLC) caches on ARC.
+ */
+#define ARCH_DMA_MINALIGN	128
 
 #if defined(ARC_MMU_ABSENT)
 #define CONFIG_ARC_MMU_VER 0
arch/arc/lib/cache.c +82 -36

202 lines not on this page · raw message

configs/axs101_defconfig +0 -1
index a541d9d..b79dd3c 100644
@@ -1,6 +1,5 @@
 CONFIG_ARC=y
 CONFIG_SYS_DCACHE_OFF=y
-CONFIG_ARC_CACHE_LINE_SHIFT=5
 CONFIG_DM_SERIAL=y
 CONFIG_SYS_CLK_FREQ=750000000
 CONFIG_SYS_TEXT_BASE=0x81000000
configs/tb100_defconfig +0 -1
index 27ea43f..053b74c 100644
@@ -1,5 +1,4 @@
 CONFIG_ARC=y
-CONFIG_ARC_CACHE_LINE_SHIFT=5
 CONFIG_TARGET_TB100=y
 CONFIG_DM_SERIAL=y
 CONFIG_SYS_CLK_FREQ=500000000
Signature · 1 line
2.4.3