[PATCH v4 08/22] arm64: Remove unnecessary empty alternatives

Josh Poimboeuf <[email protected]>
Newsgroups org.kernel.vger.live-patching,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel
Message-ID <a22bffd0fa5b02511fb6e4c1b68af871f260e691.1786230311.git.jpoimboe@kernel.org>
The code in arch/arm64/mm/cache.S creates three empty alternatives, all
from calling the dcache_by_myline_op_nosync asm macro.  If \op == cvau,
it creates an empty alternative for ARM64_WORKAROUND_4311569.

Since orig_len == 0, the alternative patching code mostly ignores it,
though it does do an unnecessary clean_dcache_range_nopatch().  It also
triggers an objtool error ("empty alternative entry").

Clean it up by moving the .ifnc check outside the alternative emit.

Signed-off-by: Josh Poimboeuf <[email protected]>
---
 arch/arm64/include/asm/assembler.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h
index effae53e9739d..6e059efced5bb 100644
--- a/arch/arm64/include/asm/assembler.h
+++ b/arch/arm64/include/asm/assembler.h
@@ -404,13 +404,13 @@ alternative_else_nop_endif
 	add	\start, \start, \linesz
 	cmp	\start, \end
 	b.lo	.Ldcache_op\@
-alternative_if ARM64_WORKAROUND_4311569
 	.ifnc	\op, cvau
+alternative_if ARM64_WORKAROUND_4311569
 	mov	\start, \tmp
 	mov	\tmp, xzr
 	cbnz	\start, .Ldcache_op\@
-	.endif
 alternative_else_nop_endif
+	.endif
 
 	_cond_uaccess_extable .Ldcache_op\@, \fixup
 	.endm
-- 
2.54.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.