]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
selftests/arm64: Implement cmpbr_sigill() to hwcap test
authorYifan Wu <wuyifan50@huawei.com>
Thu, 5 Mar 2026 01:36:38 +0000 (09:36 +0800)
committerCatalin Marinas <catalin.marinas@arm.com>
Sat, 14 Mar 2026 16:58:16 +0000 (16:58 +0000)
The function executes a CBEQ instruction which is valid if the CPU
supports the CMPBR extension. The CBEQ branches to skip the following
UDF instruction, and no SIGILL is generated. Otherwise, it will
generate a SIGILL.

Signed-off-by: Yifan Wu <wuyifan50@huawei.com>
Reviewed-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
tools/testing/selftests/arm64/abi/hwcap.c

index c2661a312fc989a1764e265cc45eb682a2b95806..e22703d6b97c279cd8c02a23e0b534cbc3235873 100644 (file)
@@ -56,7 +56,8 @@ static void atomics_sigill(void)
 
 static void cmpbr_sigill(void)
 {
-       /* Not implemented, too complicated and unreliable anyway */
+       asm volatile(".inst 0x74C00040\n" /* CBEQ w0, w0, +8 */
+                    "udf #0" : : : "cc"); /* UDF #0 */
 }
 
 static void crc32_sigill(void)