Skip to content

Commit

Permalink
arm: pl310: fix cache sync
Browse files Browse the repository at this point in the history
According to PL310 TRM:
Atomic operations:
The following are atomic operations:
    Clean Line by PA or by Set/Way
    Invalidate Line by PA
    Clean and Invalidate Line by PA or by Set/Way
    Cache Sync.
These operations stall the slave ports until they are complete.
When these registers are read, bit [0], the C flag, indicates that
a background operation is in progress. When written, bit 0 must be
zero.

So write 1 to sync register is not correct.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
  • Loading branch information
MrVan authored and jforissier committed Jan 13, 2018
1 parent 8f643c0 commit a235648
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions core/arch/arm/kernel/tz_ssvce_pl310_a32.S
Expand Up @@ -91,13 +91,18 @@ loop_cli_way_done:

/* Cache Sync */

/* Wait for writing cache sync */
/*
* Wait for writing cache sync
* To PL310, Cache sync is atomic opertion, no need to check
* the status. For PL220, this check is needed. Keeping the loop
* for PL310 is no harm for PL310.
*/
loop_cli_sync:
ldr r1, [r0, #PL310_SYNC]
cmp r1, #0
bne loop_cli_sync

mov r1, #1
mov r1, #0
str r1, [r0, #PL310_SYNC]

loop_cli_sync_done:
Expand Down Expand Up @@ -127,7 +132,7 @@ loop_inv_way_sync:
cmp r1, #0
bne loop_inv_way_sync

mov r1, #1
mov r1, #0
str r1, [r0, #PL310_SYNC]

loop_inv_way_sync_done:
Expand Down Expand Up @@ -157,7 +162,7 @@ loop_cl_way_sync:
cmp r1, #0
bne loop_cl_way_sync

mov r1, #1
mov r1, #0
str r1, [r0, #PL310_SYNC]

loop_cl_way_sync_done:
Expand Down Expand Up @@ -212,7 +217,7 @@ loop_xxx_pa_sync:
cmp r12, #0
bne loop_xxx_pa_sync

mov r12, #1
mov r12, #0
str r12, [r0, #PL310_SYNC]

loop_xxx_pa_sync_done:
Expand Down

0 comments on commit a235648

Please sign in to comment.