Skip to contentSkip to conversation

cache_v8: agilex5: Disable Dcache in the SPL

PATCH In review Jit Loon Lim 3 participants 6 messages Jun 21, 2023 – Jun 26, 2023 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cache_v8: agilex5: Disable Dcache in the SPL

From: Kah Jing Lee <[email protected]>

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.

---
 arch/arm/cpu/armv8/cache_v8.c | 20 +++++++++++---------
 common/spl/Kconfig            |  7 +++++++
 2 files changed, 18 insertions(+), 9 deletions(-)
arch/arm/cpu/armv8/cache_v8.c +11 -9
index cb1131a048..7f25d3a6ce 100644
@@ -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 */
 
common/spl/Kconfig +7 -0
index 2c042ad306..7e458503df 100644
@@ -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
Signature · 1 line
2.26.2
#1 lore raw
Quoted 9 lines · Jit Loon Lim

From: Kah Jing Lee <[email protected]>

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.

This is missing your own SoB.

Now, I'd like to understand what you are actually trying to fix. What is this 'ISR' exception? This isn't something the architecture describes. Unless you are using CMOs on something that isn't memory or for which you don't have a mapping, this should never generate an exception.

Thanks,

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
#2 lore raw
Quoted 12 lines · Marc Zyngier
Quoted 9 lines · Jit Loon Lim

From: Kah Jing Lee <[email protected]>

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.

Quoted 7 lines

This is missing your own SoB.

Now, I'd like to understand what you are actually trying to fix. What is this 'ISR' exception? This isn't something the architecture describes. Unless you are using CMOs on something that isn't memory or for which you don't have a mapping, this should never generate an exception.

You beat me to it, indeed, thanks !

#3 lore raw
Quoted 33 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Wednesday, 21 June, 2023 10:20 PM
To: Marc Zyngier <[email protected]>; Lim, Jit Loon <[email protected]>
Cc: [email protected]; Jagan Teki <[email protected]>; Simon <[email protected]>; Chee, Tien Fong <[email protected]>; Hea, Kok Kiang <[email protected]>; Lokanathan, Raaj <[email protected]>; Maniyam, Dinesh <[email protected]>; Ng, Boon Khai <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Chong, Teik Heng <[email protected]>; Zamri, Muhammad Hazim Izzat <[email protected]>; Tang, Sieu Mun <[email protected]>; Ying-Chun Liu <[email protected]>; Lee, Kah Jing <[email protected]>
Subject: Re: [PATCH v1] cache_v8: agilex5: Disable Dcache in the SPL

Quoted 14 lines · Marc Zyngier
Quoted 9 lines · Jit Loon Lim

From: Kah Jing Lee <[email protected]>

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.

This is missing your own SoB.

Quoted 7 lines
Quoted 5 lines

Now, I'd like to understand what you are actually trying to fix. What is this 'ISR' exception? This isn't something the architecture describes. Unless you are using CMOs on something that isn't memory or for which you don't have a mapping, this should never generate an exception.

You beat me to it, indeed, thanks !

The intention of doing this is because when we init SDMMC driver, the driver will call the invalidate_dcache_range.
However, during that time, the dcache is not available in SPL yet thus causing exception.
https://elixir.bootlin.com/u-boot/latest/source/drivers/mmc/sdhci.c#L181 -> https://elixir.bootlin.com/u-boot/latest/source/include/linux/dma-mapping.h#L55 -> https://elixir.bootlin.com/u-boot/latest/source/arch/arm/cpu/armv8/cache_v8.c#L475

#4 lore raw
Quoted 40 lines · Jit Loon
Quoted 40 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Wednesday, 21 June, 2023 10:20 PM
To: Marc Zyngier <[email protected]>; Lim, Jit Loon <[email protected]>
Cc: [email protected]; Jagan Teki <[email protected]>; Simon <[email protected]>; Chee, Tien Fong <[email protected]>; Hea, Kok Kiang <[email protected]>; Lokanathan, Raaj <[email protected]>; Maniyam, Dinesh <[email protected]>; Ng, Boon Khai <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Chong, Teik Heng <[email protected]>; Zamri, Muhammad Hazim Izzat <[email protected]>; Tang, Sieu Mun <[email protected]>; Ying-Chun Liu <[email protected]>; Lee, Kah Jing <[email protected]>
Subject: Re: [PATCH v1] cache_v8: agilex5: Disable Dcache in the SPL

Quoted 19 lines · Marc Zyngier
Quoted 9 lines · Jit Loon Lim

From: Kah Jing Lee <[email protected]>

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.

This is missing your own SoB.

Now, I'd like to understand what you are actually trying to fix. What is this 'ISR' exception? This isn't something the architecture describes. Unless you are using CMOs on something that isn't memory or for which you don't have a mapping, this should never generate an exception.

Quoted 6 lines
Quoted 1 line

You beat me to it, indeed, thanks !

The intention of doing this is because when we init SDMMC driver, the driver will call the invalidate_dcache_range. However, during that time, the dcache is not available in SPL yet thus causing exception.

Again: which exception?

There is no such thing as "the dcache isn't available". It is always valid to invalidate it, irrespective of it being enabled or not.

My impression is that you are papering over another bug (such as feeding non-memory to the CMOs), and are getting an SError back, which would be entirely justified.

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.