linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64/mm: use correct operators for string comparison in cache.S
@ 2018-12-01 11:01 Ard Biesheuvel
  2018-12-03 13:11 ` Robin Murphy
  0 siblings, 1 reply; 12+ messages in thread
From: Ard Biesheuvel @ 2018-12-01 11:01 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: catalin.marinas, will.deacon, Ard Biesheuvel

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 provide some definitions that are guaranteed to be distinct,
and make them local so they don't pollute the gobal symbol space.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 arch/arm64/include/asm/assembler.h | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h
index 6142402c2eb4..d11c32df85c2 100644
--- a/arch/arm64/include/asm/assembler.h
+++ b/arch/arm64/include/asm/assembler.h
@@ -377,19 +377,24 @@ alternative_endif
  * 	size:		size of the region
  * 	Corrupts:	kaddr, size, tmp1, tmp2
  */
+	.set	.Lcvau,  0
+	.set	.Lcvac,  1
+	.set	.Lcvap,  2
+	.set	.Lcivac, 3
+
 	.macro dcache_by_line_op op, domain, kaddr, size, tmp1, tmp2
 	dcache_line_size \tmp1, \tmp2
 	add	\size, \kaddr, \size
 	sub	\tmp2, \tmp1, #1
 	bic	\kaddr, \kaddr, \tmp2
 9998:
-	.if	(\op == cvau || \op == cvac)
+	.if	(.L\op == .Lcvau || .L\op == .Lcvac)
 alternative_if_not ARM64_WORKAROUND_CLEAN_CACHE
 	dc	\op, \kaddr
 alternative_else
 	dc	civac, \kaddr
 alternative_endif
-	.elseif	(\op == cvap)
+	.elseif	(.L\op == .Lcvap)
 alternative_if ARM64_HAS_DCPOP
 	sys 3, c7, c12, 1, \kaddr	// dc cvap
 alternative_else
-- 
2.19.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-12-06 12:02 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-01 11:01 [PATCH] arm64/mm: use correct operators for string comparison in cache.S Ard Biesheuvel
2018-12-03 13:11 ` Robin Murphy
2018-12-03 13:22   ` Ard Biesheuvel
2018-12-03 17:45     ` Will Deacon
2018-12-03 17:54       ` Ard Biesheuvel
2018-12-03 18:11         ` Will Deacon
2018-12-04  0:44           ` Ard Biesheuvel
2018-12-06 11:51             ` Will Deacon
2018-12-06 11:59               ` Ard Biesheuvel
2018-12-06 11:20       ` Dave Martin
2018-12-06 11:47         ` Ard Biesheuvel
2018-12-06 12:02           ` Dave Martin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).