Skip to contentSkip to conversation

ARM: align the start and end of v7_setup_stack to cache line

PATCH New Cong Zhang 1 participant 1 message Apr 20, 2020 Arm (32-bit)

lore
Share & tools
lore

Cong Zhang

author
#0 lore raw

PATCH 1/1 ARM: align the start and end of v7_setup_stack to cache line

The v7_setup_stack is used when D-cache disabled. When CPU is reading something nearby with D-cache enabled. It is possible to read v7_setup_stack to cache line. There is a risk that when cache line write back the data, v7_setup_stack may already been modified by other CPU with D-cache disabled.
The change make v7_setup_stack align cache line size and use the whole cache line to prevent corrupting v7_setup_stack.

---
 arch/arm/mm/proc-v7.S | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
arch/arm/mm/proc-v7.S +3 -2
index 339eb17..587e2eb 100644
@@ -18,6 +18,7 @@
 #include <asm/pgtable-hwdef.h>
 #include <asm/pgtable.h>
 #include <asm/memory.h>
+#include <asm/cache.h>
 
 #include "proc-macros.S"
 
@@ -548,10 +549,10 @@ __v7_setup_stack_ptr:
 ENDPROC(__v7_setup)
 
 	.bss
-	.align	2
+	.align	L1_CACHE_SHIFT
 __v7_setup_stack:
 	.space	4 * 7				@ 7 registers
-
+	.align	L1_CACHE_SHIFT
 	__INITDATA
 
 	.weak cpu_v7_bugs_init
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel