Skip to contentSkip to conversation

arm: armv8: remove redundant definition of mmu_status

PATCH In review Anshul Dalal 5 participants 5 messages Sep 16, 2025 – Oct 3, 2025 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm: armv8: remove redundant definition of mmu_status

mmu_status is used in io memcpy functions to prevent accesses to non 8-byte aligned addresses when the mmu is disabled. Though there is a redundant definition enabled when icaches is turned off by setting SYS_ICACHE_OFF.

This patch removes the redundant definition, allowing mmu_status to properly report the status regardless of config settings. This shouldn't be a problem since access to non 8-byte aligned data can be done irrespective of icache state.

Fixes 268f6ac1f95c ("arm64: Update memcpy_{from, to}io() helpers")
---
 arch/arm/cpu/armv8/cache_v8.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)
arch/arm/cpu/armv8/cache_v8.c +5 -10
index 1dcb6007475..74814601483 100644
@@ -1184,11 +1184,6 @@ int icache_status(void)
 	return (get_sctlr() & CR_I) != 0;
 }
 
-int mmu_status(void)
-{
-	return (get_sctlr() & CR_M) != 0;
-}
-
 void invalidate_icache_all(void)
 {
 	__asm_invalidate_icache_all();
@@ -1210,17 +1205,17 @@ int icache_status(void)
 	return 0;
 }
 
-int mmu_status(void)
-{
-	return 0;
-}
-
 void invalidate_icache_all(void)
 {
 }
 
 #endif	/* !CONFIG_IS_ENABLED(SYS_ICACHE_OFF) */
 
+int mmu_status(void)
+{
+	return (get_sctlr() & CR_M) != 0;
+}
+
 /*
  * Enable dCache & iCache, whether cache is actually enabled
  * depend on CONFIG_SYS_DCACHE_OFF and CONFIG_SYS_ICACHE_OFF
Signature · 1 line
2.51.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 46 lines · Anshul Dalal

mmu_status is used in io memcpy functions to prevent accesses to non 8-byte aligned addresses when the mmu is disabled. Though there is a redundant definition enabled when icaches is turned off by setting SYS_ICACHE_OFF.

This patch removes the redundant definition, allowing mmu_status to properly report the status regardless of config settings. This shouldn't be a problem since access to non 8-byte aligned data can be done irrespective of icache state.

Fixes 268f6ac1f95c ("arm64: Update memcpy_{from, to}io() helpers")
---
 arch/arm/cpu/armv8/cache_v8.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)
arch/arm/cpu/armv8/cache_v8.c +0 -10
index 1dcb6007475..74814601483 100644
@@ -1184,11 +1184,6 @@ int icache_status(void)
 	return (get_sctlr() & CR_I) != 0;
 }
 
-int mmu_status(void)
-{
-	return (get_sctlr() & CR_M) != 0;
-}
-
 void invalidate_icache_all(void)
 {
 	__asm_invalidate_icache_all();
@@ -1210,17 +1205,17 @@ int icache_status(void)
 	return 0;
 }
 
-int mmu_status(void)
-{
-	return 0;
-}
-
 void invalidate_icache_all(void)
 {
 }
 

arch/arm/cpu/armv8/cache_v8.c int icache_status(void) · line 1221

Quoted 10 lines
arch/arm/cpu/armv8/cache_v8.c +5 -0
 #endif	/* !CONFIG_IS_ENABLED(SYS_ICACHE_OFF) */
 
+int mmu_status(void)
+{
+	return (get_sctlr() & CR_M) != 0;
+}
+
 /*
  * Enable dCache & iCache, whether cache is actually enabled
  * depend on CONFIG_SYS_DCACHE_OFF and CONFIG_SYS_ICACHE_OFF

Thanks
Patrice

Reviewed-by on v1 1/1
#2 lore raw
In reply to Anshul Dalal
Quoted 44 lines · Anshul Dalal

mmu_status is used in io memcpy functions to prevent accesses to non 8-byte aligned addresses when the mmu is disabled. Though there is a redundant definition enabled when icaches is turned off by setting SYS_ICACHE_OFF.

This patch removes the redundant definition, allowing mmu_status to properly report the status regardless of config settings. This shouldn't be a problem since access to non 8-byte aligned data can be done irrespective of icache state.

Fixes 268f6ac1f95c ("arm64: Update memcpy_{from, to}io() helpers")
---
 arch/arm/cpu/armv8/cache_v8.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)
arch/arm/cpu/armv8/cache_v8.c +0 -10
index 1dcb6007475..74814601483 100644
@@ -1184,11 +1184,6 @@ int icache_status(void)
 	return (get_sctlr() & CR_I) != 0;
 }
 
-int mmu_status(void)
-{
-	return (get_sctlr() & CR_M) != 0;
-}
-
 void invalidate_icache_all(void)
 {
 	__asm_invalidate_icache_all();
@@ -1210,17 +1205,17 @@ int icache_status(void)
 	return 0;
 }
 
-int mmu_status(void)
-{
-	return 0;
-}
-
 void invalidate_icache_all(void)
 {

arch/arm/cpu/armv8/cache_v8.c int icache_status(void) · line 1219

Quoted 10 lines
arch/arm/cpu/armv8/cache_v8.c +5 -0
 }
 
 #endif	/* !CONFIG_IS_ENABLED(SYS_ICACHE_OFF) */
 
+int mmu_status(void)
+{
+	return (get_sctlr() & CR_M) != 0;
+}
+
 /*

Good catch,

Signature · 3 lines
Best regards,
Dhruva Gole
Texas Instruments Incorporated
Acked-by on v1 1/1
#3 lore raw
In reply to Anshul Dalal
Quoted 11 lines · Anshul Dalal

mmu_status is used in io memcpy functions to prevent accesses to non 8-byte aligned addresses when the mmu is disabled. Though there is a redundant definition enabled when icaches is turned off by setting SYS_ICACHE_OFF.

This patch removes the redundant definition, allowing mmu_status to properly report the status regardless of config settings. This shouldn't be a problem since access to non 8-byte aligned data can be done irrespective of icache state.

Quoted 4 lines
Fixes 268f6ac1f95c ("arm64: Update memcpy_{from, to}io() helpers")

---

Quoted 45 lines
 arch/arm/cpu/armv8/cache_v8.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)
arch/arm/cpu/armv8/cache_v8.c +5 -11
index 1dcb6007475..74814601483 100644
@@ -1184,11 +1184,6 @@ int icache_status(void)
        return (get_sctlr() & CR_I) != 0;
 }
 
-int mmu_status(void)
-{
-       return (get_sctlr() & CR_M) != 0;
-}
-
 void invalidate_icache_all(void)
 {
        __asm_invalidate_icache_all();
@@ -1210,17 +1205,17 @@ int icache_status(void)
        return 0;
 }
 
-int mmu_status(void)
-{
-       return 0;
-}
-
 void invalidate_icache_all(void)
 {
 }
 
 #endif /* !CONFIG_IS_ENABLED(SYS_ICACHE_OFF) */
 
+int mmu_status(void)
+{
+       return (get_sctlr() & CR_M) != 0;
+}
+
 /*
  * Enable dCache & iCache, whether cache is actually enabled
  * depend on CONFIG_SYS_DCACHE_OFF and CONFIG_SYS_ICACHE_OFF
--

2.51.0

#4 lore raw
In reply to Anshul Dalal
Quoted 11 lines · Anshul Dalal

mmu_status is used in io memcpy functions to prevent accesses to non 8-byte aligned addresses when the mmu is disabled. Though there is a redundant definition enabled when icaches is turned off by setting SYS_ICACHE_OFF.

This patch removes the redundant definition, allowing mmu_status to properly report the status regardless of config settings. This shouldn't be a problem since access to non 8-byte aligned data can be done irrespective of icache state.

[...]

Applied to u-boot/next, thanks!

[1/1] arm: armv8: remove redundant definition of mmu_status

      commit: 8fd3768ca1683b45aeb5662094de6bcffdb7735b
Signature · 1 line
Tom