Commit 3ec5204c authored by Soby Mathew's avatar Soby Mathew
Browse files

Exit early if size zero for cache helpers



This patch enables cache helper functions `flush_dcache_range`,
`clean_dcache_range` and `invalidate_dcache_range` to exit early
if the size argument specified is zero

Change-Id: I0b63e8f4bd3d47ec08bf2a0b0b9a7ff8a269a9b0
Signed-off-by: default avatarSoby Mathew <soby.mathew@arm.com>
parent ee05ae16
...@@ -20,6 +20,9 @@ ...@@ -20,6 +20,9 @@
* This macro can be used for implementing various data cache operations `op` * This macro can be used for implementing various data cache operations `op`
*/ */
.macro do_dcache_maintenance_by_mva op, coproc, opc1, CRn, CRm, opc2 .macro do_dcache_maintenance_by_mva op, coproc, opc1, CRn, CRm, opc2
/* Exit early if size is zero */
cmp r1, #0
beq exit_loop_\op
dcache_line_size r2, r3 dcache_line_size r2, r3
add r1, r0, r1 add r1, r0, r1
sub r3, r2, #1 sub r3, r2, #1
...@@ -30,6 +33,7 @@ loop_\op: ...@@ -30,6 +33,7 @@ loop_\op:
cmp r0, r1 cmp r0, r1
blo loop_\op blo loop_\op
dsb sy dsb sy
exit_loop_\op:
bx lr bx lr
.endm .endm
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
* This macro can be used for implementing various data cache operations `op` * This macro can be used for implementing various data cache operations `op`
*/ */
.macro do_dcache_maintenance_by_mva op .macro do_dcache_maintenance_by_mva op
/* Exit early if size is zero */
cbz x1, exit_loop_\op
dcache_line_size x2, x3 dcache_line_size x2, x3
add x1, x0, x1 add x1, x0, x1
sub x3, x2, #1 sub x3, x2, #1
...@@ -30,6 +32,7 @@ loop_\op: ...@@ -30,6 +32,7 @@ loop_\op:
cmp x0, x1 cmp x0, x1
b.lo loop_\op b.lo loop_\op
dsb sy dsb sy
exit_loop_\op:
ret ret
.endm .endm
/* ------------------------------------------ /* ------------------------------------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment