[lkml]   [2018]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 5/5] arm64/mm: use string comparisons in dcache_by_line_op
The GAS directives that are currently being used in dcache_by_line_op
rely on assembler behavior that is not documented, and probably not
guaranteed to produce the correct behavior going forward.

Currently, we end up with some undefined symbols in cache.o:

$ nm arch/arm64/mm/cache.o
U civac
U cvac
U cvap
U cvau

This is due to the fact that the comparisons used to select the
operation type in the dcache_by_line_op macro are comparing symbols
not strings, and even though it seems that GAS is doing the right
thing here (undefined symbols by the same name are equal to each
other), it seems unwise to rely on this.

So let's switch to conditional directives that are documented as
operating on strings. Since these cannot be combined like ordinary
arithmetic expressions, invert the comparison logic.

Signed-off-by: Ard Biesheuvel <>
arch/arm64/include/asm/assembler.h | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h
index 09c5a5452f60..df3043e76e6a 100644
--- a/arch/arm64/include/asm/assembler.h
+++ b/arch/arm64/include/asm/assembler.h
@@ -383,21 +383,23 @@ alternative_endif
sub \tmp2, \tmp1, #1
bic \kaddr, \kaddr, \tmp2
- .if (\op == cvau || \op == cvac)
+ .ifnc \op, civac
+ .ifnc \op, cvap
alternative_if_not ARM64_WORKAROUND_CLEAN_CACHE
dc \op, \kaddr
dc civac, \kaddr
- .elseif (\op == cvap)
+ .else
alternative_cb arm64_handle_dc_cvap
dc civac, \kaddr
sys 3, c7, c12, 1, \kaddr // dc cvap
dc cvac, \kaddr
+ .endif
- dc \op, \kaddr
+ dc civac, \kaddr
add \kaddr, \kaddr, \tmp1
cmp \kaddr, \size
 \ /
  Last update: 2018-12-06 17:00    [W:0.089 / U:0.184 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site