diff mbox series

[2/5] kselftest/arm64: add crc32 feature to hwcap test

Message ID 20230808061356.2215158-2-zengheng4@huawei.com (mailing list archive)
State New, archived
Headers show
Series [1/5] kselftest/arm64: add float-point feature to hwcap test | expand

Commit Message

Zeng Heng Aug. 8, 2023, 6:13 a.m. UTC
Add the CRC32 feature check in the set of hwcap tests.

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

Comments

Mark Brown Aug. 8, 2023, 12:28 p.m. UTC | #1
On Tue, Aug 08, 2023 at 02:13:52PM +0800, Zeng Heng wrote:

> +static void crc32_sigill(void)
> +{
> +	/* CRC32W W0, W0, W1 */
> +	asm volatile(".inst 0x1ac14800" : : : );
> +}

Same here, you could assemble rather than hand encode but otherwise

Reviewed-by: Mark Brown <broonie@kernel.org>
diff mbox series

Patch

diff --git a/tools/testing/selftests/arm64/abi/hwcap.c b/tools/testing/selftests/arm64/abi/hwcap.c
index eaf9881c2e43..7ea526e7934e 100644
--- a/tools/testing/selftests/arm64/abi/hwcap.c
+++ b/tools/testing/selftests/arm64/abi/hwcap.c
@@ -33,6 +33,12 @@ 
  */
 typedef void (*sigill_fn)(void);
 
+static void crc32_sigill(void)
+{
+	/* CRC32W W0, W0, W1 */
+	asm volatile(".inst 0x1ac14800" : : : );
+}
+
 static void cssc_sigill(void)
 {
 	/* CNT x0, x0 */
@@ -234,6 +240,13 @@  static const struct hwcap_data {
 	sigill_fn sigill_fn;
 	bool sigill_reliable;
 } hwcaps[] = {
+	{
+		.name = "CRC32",
+		.at_hwcap = AT_HWCAP,
+		.hwcap_bit = HWCAP_CRC32,
+		.cpuinfo = "crc32",
+		.sigill_fn = crc32_sigill,
+	},
 	{
 		.name = "CSSC",
 		.at_hwcap = AT_HWCAP2,