提交 90607c7a 编写于 作者: P Phil Elwell 提交者: Zheng Zengkai

ARM: proc-v7: Force misalignment of early stmia

raspberrypi inclusion
category: feature
bugzilla: 50432

--------------------------------

In an attempt to prevent the problem of CPUn not starting, explicitly
misalign the scratch space used to save registers acros the cache
invalidation.

Notes:
At this stage in the boot process the core is running with its cache
disabled. Before enabling the cache its contents must be explicitly
invalidated, a process that requires quite a few registers that the
caller must preserve. Evidence suggests that something is writing a
block of zeroes over that space at a time when all other cores should
be idle, possibly some kind of write-combiner, and the misalignment is
designed to disrupt any write-coalescing.

In truth, I don't understand why this patch works, and when the failure
is so random it is hard to be certain that this isn't just rolling the
dice again. One interesting test would be to change the "addeq r12, #4"s
to "addeq r12, #0"s determine see if the offset itself is significant or
just the additional code.

See: https://github.com/Hexxeh/rpi-firmware/issues/232Signed-off-by: NPhil Elwell <phil@raspberrypi.com>
Signed-off-by: NFang Yafen <yafen@iscas.ac.cn>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 263106ca
...@@ -287,6 +287,8 @@ __v7_ca17mp_setup: ...@@ -287,6 +287,8 @@ __v7_ca17mp_setup:
mov r10, #0 mov r10, #0
1: adr r0, __v7_setup_stack_ptr 1: adr r0, __v7_setup_stack_ptr
ldr r12, [r0] ldr r12, [r0]
tst r12, #0x1f
addeq r12, r12, #4
add r12, r12, r0 @ the local stack add r12, r12, r0 @ the local stack
stmia r12, {r1-r6, lr} @ v7_invalidate_l1 touches r0-r6 stmia r12, {r1-r6, lr} @ v7_invalidate_l1 touches r0-r6
bl v7_invalidate_l1 bl v7_invalidate_l1
...@@ -474,6 +476,8 @@ __v7_setup: ...@@ -474,6 +476,8 @@ __v7_setup:
adr r0, __v7_setup_stack_ptr adr r0, __v7_setup_stack_ptr
ldr r12, [r0] ldr r12, [r0]
add r12, r12, r0 @ the local stack add r12, r12, r0 @ the local stack
tst r12, #0x1f
addeq r12, r12, #4
stmia r12, {r1-r6, lr} @ v7_invalidate_l1 touches r0-r6 stmia r12, {r1-r6, lr} @ v7_invalidate_l1 touches r0-r6
bl v7_invalidate_l1 bl v7_invalidate_l1
ldmia r12, {r1-r6, lr} ldmia r12, {r1-r6, lr}
...@@ -557,7 +561,7 @@ ENDPROC(__v7_setup) ...@@ -557,7 +561,7 @@ ENDPROC(__v7_setup)
.bss .bss
.align 2 .align 2
__v7_setup_stack: __v7_setup_stack:
.space 4 * 7 @ 7 registers .space 4 * 8 @ 7 registers + 1 spare
__INITDATA __INITDATA
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册