Thread (42 messages) 42 messages, 3 authors, 2021-05-25
STALE1840d
Revisions (4)
  1. v1 [diff vs current]
  2. v2 [diff vs current]
  3. v3 current
  4. v4 [diff vs current]

[PATCH v3 04/18] arm64: assembler: user_alt label optional

From: Fuad Tabba <hidden>
Date: 2021-05-20 12:47:05
Subsystem: arm64 port (aarch64 architecture), the rest · Maintainers: Catalin Marinas, Will Deacon, Linus Torvalds

Make the label for the extable entry in user_alt optional, only
generating an extable entry if provided.

This is needed later in the series, to avoid instruction
duplication in the assembly code.

While at it, clean up the label used to be globally unique using
\@ as for other macros.

Signed-off-by: Fuad Tabba <redacted>
---
 arch/arm64/include/asm/alternative-macros.h | 9 ++++++---
 arch/arm64/mm/cache.S                       | 2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/arch/arm64/include/asm/alternative-macros.h b/arch/arm64/include/asm/alternative-macros.h
index 8a078fc662ac..01ef954c9b2d 100644
--- a/arch/arm64/include/asm/alternative-macros.h
+++ b/arch/arm64/include/asm/alternative-macros.h
@@ -197,9 +197,12 @@ alternative_endif
 #define _ALTERNATIVE_CFG(insn1, insn2, cap, cfg, ...)	\
 	alternative_insn insn1, insn2, cap, IS_ENABLED(cfg)
 
-.macro user_alt, label, oldinstr, newinstr, cond
-9999:	alternative_insn "\oldinstr", "\newinstr", \cond
-	_asm_extable 9999b, \label
+.macro user_alt, oldinstr, newinstr, cond, label
+.Lextable_\@:
+	alternative_insn "\oldinstr", "\newinstr", \cond
+	.ifnc \label,
+	_asm_extable .Lextable_\@, \label
+	.endif
 .endm
 
 #endif  /*  __ASSEMBLY__  */
diff --git a/arch/arm64/mm/cache.S b/arch/arm64/mm/cache.S
index 2d881f34dd9d..5ff8dfa86975 100644
--- a/arch/arm64/mm/cache.S
+++ b/arch/arm64/mm/cache.S
@@ -47,7 +47,7 @@ alternative_else_nop_endif
 	sub	x3, x2, #1
 	bic	x4, x0, x3
 1:
-user_alt 9f, "dc cvau, x4",  "dc civac, x4",  ARM64_WORKAROUND_CLEAN_CACHE
+user_alt "dc cvau, x4",  "dc civac, x4",  ARM64_WORKAROUND_CLEAN_CACHE, 9f
 	add	x4, x4, x2
 	cmp	x4, x1
 	b.lo	1b
-- 
2.31.1.751.gd2f1c929bd-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help