diff options
author | Nadav Haklai <nadavh@marvell.com> | 2013-05-23 04:54:02 -0400 |
---|---|---|
committer | Jason Cooper <jason@lakedaemon.net> | 2013-05-28 10:50:08 -0400 |
commit | b60b61d41220c8d34e2c62a748bc78bc5d40585e (patch) | |
tree | 577e002b7826bd271580a6e34c41028895ec1d2b /arch/arm/mach-mvebu | |
parent | e89b4058096569c999fa599370162022a5a2b3d2 (diff) |
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.
[gregory.clement@free-electrons.com: fixed the commit's topic]
Signed-off-by: Nadav Haklai <nadavh@marvell.com>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Diffstat (limited to 'arch/arm/mach-mvebu')
-rw-r--r-- | arch/arm/mach-mvebu/coherency_ll.S | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/arch/arm/mach-mvebu/coherency_ll.S b/arch/arm/mach-mvebu/coherency_ll.S index 53e8391192cd..5476669ba905 100644 --- a/arch/arm/mach-mvebu/coherency_ll.S +++ b/arch/arm/mach-mvebu/coherency_ll.S | |||
@@ -32,15 +32,21 @@ ENTRY(ll_set_cpu_coherent) | |||
32 | 32 | ||
33 | /* Add CPU to SMP group - Atomic */ | 33 | /* Add CPU to SMP group - Atomic */ |
34 | add r3, r0, #ARMADA_XP_CFB_CTL_REG_OFFSET | 34 | add r3, r0, #ARMADA_XP_CFB_CTL_REG_OFFSET |
35 | ldr r2, [r3] | 35 | 1: |
36 | ldrex r2, [r3] | ||
36 | orr r2, r2, r1 | 37 | orr r2, r2, r1 |
37 | str r2, [r3] | 38 | strex r0, r2, [r3] |
39 | cmp r0, #0 | ||
40 | bne 1b | ||
38 | 41 | ||
39 | /* Enable coherency on CPU - Atomic */ | 42 | /* Enable coherency on CPU - Atomic */ |
40 | add r3, r0, #ARMADA_XP_CFB_CFG_REG_OFFSET | 43 | add r3, r3, #ARMADA_XP_CFB_CFG_REG_OFFSET |
41 | ldr r2, [r3] | 44 | 1: |
45 | ldrex r2, [r3] | ||
42 | orr r2, r2, r1 | 46 | orr r2, r2, r1 |
43 | str r2, [r3] | 47 | strex r0, r2, [r3] |
48 | cmp r0, #0 | ||
49 | bne 1b | ||
44 | 50 | ||
45 | dsb | 51 | dsb |
46 | 52 | ||