Skip to content

Commit b60b61d

Browse files
Nadav HaklaiJason Cooper
authored andcommitted
ARM: mvebu: Fix bug in coherency fabric low level init function
When adding CPU to the SMP group and enabling the coherency on this CPU we must protect the register access. The previous implementation claims to be atomic but doesn't provide any protection against parallel access to the coherency fabric control and configuration registers. This patch fixes this by using the ldrex and strex mechanism. This method should be used in all accesses to those registers. [[email protected]: fixed the commit's topic] Signed-off-by: Nadav Haklai <[email protected]> Signed-off-by: Gregory CLEMENT <[email protected]> Signed-off-by: Jason Cooper <[email protected]>
1 parent e89b405 commit b60b61d

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

arch/arm/mach-mvebu/coherency_ll.S

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,21 @@ ENTRY(ll_set_cpu_coherent)
3232

3333
/* Add CPU to SMP group - Atomic */
3434
add r3, r0, #ARMADA_XP_CFB_CTL_REG_OFFSET
35-
ldr r2, [r3]
35+
1:
36+
ldrex r2, [r3]
3637
orr r2, r2, r1
37-
str r2, [r3]
38+
strex r0, r2, [r3]
39+
cmp r0, #0
40+
bne 1b
3841

3942
/* Enable coherency on CPU - Atomic */
40-
add r3, r0, #ARMADA_XP_CFB_CFG_REG_OFFSET
41-
ldr r2, [r3]
43+
add r3, r3, #ARMADA_XP_CFB_CFG_REG_OFFSET
44+
1:
45+
ldrex r2, [r3]
4246
orr r2, r2, r1
43-
str r2, [r3]
47+
strex r0, r2, [r3]
48+
cmp r0, #0
49+
bne 1b
4450

4551
dsb
4652

0 commit comments

Comments
 (0)