[PATCH] kselftest/arm64: add RCpc load-acquire to the tested hwcaps

Zeng Heng zengheng4 at huawei.com
Thu Aug 3 00:02:31 PDT 2023


Add RCpc load-acquire and various features check in the set of hwcaps.

Test log as shown below:
~~~
  # RCpc load-acquire present
  ok 47 cpuinfo_match_RCpc load-acquire
  ok 48 sigill_RCpc load-acquire
  # RCpc load-acquire2 present
  ok 49 cpuinfo_match_RCpc load-acquire2
  ok 50 sigill_RCpc load-acquire2
~~~

Signed-off-by: Zeng Heng <zengheng4 at huawei.com>
---
 tools/testing/selftests/arm64/abi/hwcap.c | 26 +++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/tools/testing/selftests/arm64/abi/hwcap.c b/tools/testing/selftests/arm64/abi/hwcap.c
index 93333a90bf3a..ccb3f6adb68f 100644
--- a/tools/testing/selftests/arm64/abi/hwcap.c
+++ b/tools/testing/selftests/arm64/abi/hwcap.c
@@ -194,6 +194,18 @@ static void svebf16_sigill(void)
 	asm volatile(".inst 0x658aa000" : : : "z0");
 }
 
+static void lrcpc_sigill(void)
+{
+	/* LDAPR W0, [SP, #0] */
+	asm volatile(".inst 0xb8bfc3e0" : : : );
+}
+
+static void ilrcpc_sigill(void)
+{
+	/* LDAPUR W0, [SP, #8] */
+	asm volatile(".inst 0x994083e0" : : : );
+}
+
 static const struct hwcap_data {
 	const char *name;
 	unsigned long at_hwcap;
@@ -364,6 +376,20 @@ static const struct hwcap_data {
 		.hwcap_bit = HWCAP2_SVE_EBF16,
 		.cpuinfo = "sveebf16",
 	},
+	{
+		.name = "RCpc load-acquire",
+		.at_hwcap = AT_HWCAP,
+		.hwcap_bit = HWCAP_LRCPC,
+		.cpuinfo = "lrcpc",
+		.sigill_fn = lrcpc_sigill,
+	},
+	{
+		.name = "RCpc load-acquire2",
+		.at_hwcap = AT_HWCAP,
+		.hwcap_bit = HWCAP_ILRCPC,
+		.cpuinfo = "ilrcpc",
+		.sigill_fn = ilrcpc_sigill,
+	},
 };
 
 static bool seen_sigill;
-- 
2.25.1




More information about the linux-arm-kernel mailing list