[PATCH v1] cache_v8: agilex5: Disable Dcache in the SPL

Jit Loon Lim jit.loon.lim at intel.com
Wed Jun 21 16:06:51 CEST 2023


From: Kah Jing Lee <kah.jing.lee at intel.com>

Dcache feature is not enabled in SPL and enable it will cause ISR
exception. Since the Dcache is not supported in SPL, new
CONFIG_SPL_SYS_DISABLE_DCACHE_OPS is added to Kconfig to disable Dcache
in SPL.

Signed-off-by: Kah Jing Lee <kah.jing.lee at intel.com>
---
 arch/arm/cpu/armv8/cache_v8.c | 20 +++++++++++---------
 common/spl/Kconfig            |  7 +++++++
 2 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/arch/arm/cpu/armv8/cache_v8.c b/arch/arm/cpu/armv8/cache_v8.c
index cb1131a048..7f25d3a6ce 100644
--- a/arch/arm/cpu/armv8/cache_v8.c
+++ b/arch/arm/cpu/armv8/cache_v8.c
@@ -534,29 +534,31 @@ inline void flush_dcache_all(void)
 #endif
 }
 
-#ifndef CONFIG_SYS_DISABLE_DCACHE_OPS
-/*
- * Invalidates range in all levels of D-cache/unified cache
- */
+#if CONFIG_IS_ENABLED(SYS_DISABLE_DCACHE_OPS) || \
+	CONFIG_IS_ENABLED(SPL_SYS_DISABLE_DCACHE_OPS) && \
+	CONFIG_IS_ENABLED(SPL_BUILD)
 void invalidate_dcache_range(unsigned long start, unsigned long stop)
 {
-	__asm_invalidate_dcache_range(start, stop);
 }
 
-/*
- * Flush range(clean & invalidate) from all levels of D-cache/unified cache
- */
 void flush_dcache_range(unsigned long start, unsigned long stop)
 {
-	__asm_flush_dcache_range(start, stop);
 }
 #else
+/*
+ * Invalidates range in all levels of D-cache/unified cache
+ */
 void invalidate_dcache_range(unsigned long start, unsigned long stop)
 {
+	__asm_invalidate_dcache_range(start, stop);
 }
 
+/*
+ * Flush range(clean & invalidate) from all levels of D-cache/unified cache
+ */
 void flush_dcache_range(unsigned long start, unsigned long stop)
 {
+	__asm_flush_dcache_range(start, stop);
 }
 #endif /* CONFIG_SYS_DISABLE_DCACHE_OPS */
 
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 2c042ad306..7e458503df 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -19,6 +19,13 @@ config SPL
 menu "SPL configuration options"
 	depends on SPL
 
+config SPL_SYS_DISABLE_DCACHE_OPS
+	bool "Do not enable dcache operation in SPL"
+	depends on SPL
+	help
+	  Do not enable data cache operation in SPL. This will turn off the
+	  Dcache support and have the empty dcache declaration.
+
 config SPL_FRAMEWORK
 	bool "Support SPL based upon the common SPL framework"
 	default y
-- 
2.26.2



More information about the U-Boot mailing list