From nobody Mon Nov 25 05:28:08 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D614217451; Wed, 30 Oct 2024 15:40:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730302856; cv=none; b=HRIhksEXKUZU+16Re7lvT+9QiGLGQld3rtjfxul5K6l4WAnp3OC/7liHCBcaYMc/8gQ0ZdV5A2ndScsbwSozCBe09K+9Vnbdn5lQ44A5/3wYlmGkv+QjQ9LCbNYDFvPHPGOmbOospaiD8zIzf35hSpCpZbnWbR38tKzSZrVlkXE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730302856; c=relaxed/simple; bh=h2Wehl87NboyijTuuRSERBYg5ixqNkdqmXD3SKKUYoE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Bs/MLC9OPHggixyhPQB2Yj0kEK2Lr6jM1Yc9YeykHvu4HgTmeFfvugleWa2bzSHh5pQqwuBqmAaP6KZgCepEcb6g3rwaKwMvHKVidmCnWYie+fMMuSXBVuCxeUICngugeeGsuDaiC1Jj4ZpPczXTyNhGqJY/rw0Z8lhENPL1xPo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bQ03D0h8; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bQ03D0h8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8506EC4CED2; Wed, 30 Oct 2024 15:40:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730302856; bh=h2Wehl87NboyijTuuRSERBYg5ixqNkdqmXD3SKKUYoE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=bQ03D0h8kK7xNuv2AZynEjG4RhfP/dLt6o7804gHljvl+JdaxufJ3IekYHmzRQs1T CnkjLfd//r5FQUHRkGxjcM+v2wQtrH8RlGfhHOKSjJxzglWL6WtNdErx2nhRobxi04 qOvGUnocORZvF3YflcCAqfFxiP3z0FwhSqYgcN6p6LwrIsSbHstgWAzCQioskYIDh2 uLk1UrYS27Fr/JCqV14hN+uWvz+TfsbiohPlyK/DuwZOC/LVt9hyunG7b+VZ8sN6g5 xEOWmwERiz+EeAU8Gz87xlksQNonXKyoeS/ZaLHtG0yMv2dYRHW75Dzp+xIf438Mtb p0ndmG60GQP9Q== From: Mark Brown Date: Wed, 30 Oct 2024 15:34:54 +0000 Subject: [PATCH v2 9/9] kselftest/arm64: Add 2024 dpISA extensions to hwcap test Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241030-arm64-2024-dpisa-v2-9-b6601a15d2a5@kernel.org> References: <20241030-arm64-2024-dpisa-v2-0-b6601a15d2a5@kernel.org> In-Reply-To: <20241030-arm64-2024-dpisa-v2-0-b6601a15d2a5@kernel.org> To: Catalin Marinas , Will Deacon , Jonathan Corbet , Marc Zyngier , Oliver Upton , Joey Gouly , Suzuki K Poulose , Shuah Khan Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, kvmarm@lists.linux.dev, linux-kselftest@vger.kernel.org, Mark Brown X-Mailer: b4 0.15-dev-9b746 X-Developer-Signature: v=1; a=openpgp-sha256; l=9994; i=broonie@kernel.org; h=from:subject:message-id; bh=h2Wehl87NboyijTuuRSERBYg5ixqNkdqmXD3SKKUYoE=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBnIlNolSpmr2hzm9KJyObikwX7mZZOt19Iu2o9uBl6 RoyEal6JATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZyJTaAAKCRAk1otyXVSH0OhDB/ 9Vjek6vs+JBDwIdQ/waKoEN9gO45OuGkfj3n7AORB3x6dHhCYWPLBErrYCs2ubPPNWR8RKS1SfwAyb QGYGUKBrehq925POmjog9xOMkn39l1O9c4kfGkoVubBp1Sy5DBRVp5kpAsUxBFnwEiSgJ/SZAtze/q WNzwZlwUddvzruS9dE0pUUc3Rs/nVRVvmV2z38ZokfrdA5MBnOxA6CJBKuXE2XRrxokH5XElm8U34+ oaKGAzRXGmSLTMMK+EmQHgskGpi2MKhaHrFRNNhf8JUvYZ19x9PA+Zlae4U0n5XolpvaQIu1Az7IH2 DI8UgBuOiHOx7/UJEbj14dGCyWlYE8 X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB We don't actually test SIGILL generation for CMPBR since the need to branch makes it a pain to generate and the SIGILL detection would be unreliable anyway. Since this should be very unusual we provide a stub function rather than supporting a missing function. The sigill functions aren't well sorted in the file so the ordering is a bit random. Signed-off-by: Mark Brown Reviewed-by: Shuah Khan --- tools/testing/selftests/arm64/abi/hwcap.c | 273 ++++++++++++++++++++++++++= +++- 1 file changed, 271 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/arm64/abi/hwcap.c b/tools/testing/self= tests/arm64/abi/hwcap.c index f2d6007a2b983eba77a880ec7e614396a6cb1377..beb380bc09b0d07269a85a60e5d= 2977367740473 100644 --- a/tools/testing/selftests/arm64/abi/hwcap.c +++ b/tools/testing/selftests/arm64/abi/hwcap.c @@ -46,6 +46,12 @@ static void atomics_sigill(void) asm volatile(".inst 0xb82003ff" : : : ); } =20 +static void cmpbr_sigill(void) +{ + /* Not implemented, too complicated and unreliable anyway */ +} + + static void crc32_sigill(void) { /* CRC32W W0, W0, W1 */ @@ -82,6 +88,18 @@ static void f8fma_sigill(void) asm volatile(".inst 0xec0fc00"); } =20 +static void f8mm4_sigill(void) +{ + /* FMMLA V0.4SH, V0.16B, V0.16B */ + asm volatile(".inst 0x6e00ec00"); +} + +static void f8mm8_sigill(void) +{ + /* FMMLA V0.4S, V0.16B, V0.16B */ + asm volatile(".inst 0x6e80ec00"); +} + static void faminmax_sigill(void) { /* FAMIN V0.4H, V0.4H, V0.4H */ @@ -98,6 +116,12 @@ static void fpmr_sigill(void) asm volatile("mrs x0, S3_3_C4_C4_2" : : : "x0"); } =20 +static void fprcvt_sigill(void) +{ + /* FCVTAS S0, H0 */ + asm volatile(".inst 0x1efa0000"); +} + static void ilrcpc_sigill(void) { /* LDAPUR W0, [SP, #8] */ @@ -215,6 +239,42 @@ static void sme2p1_sigill(void) asm volatile("msr S0_3_C4_C6_3, xzr" : : : ); } =20 +static void sme2p2_sigill(void) +{ + /* SMSTART SM */ + asm volatile("msr S0_3_C4_C3_3, xzr" : : : ); + + /* UXTB Z0.D, P0/Z, Z0.D */ + asm volatile(".inst 0x4c1a000" : : : ); + + /* SMSTOP */ + asm volatile("msr S0_3_C4_C6_3, xzr" : : : ); +} + +static void sme_aes_sigill(void) +{ + /* SMSTART SM */ + asm volatile("msr S0_3_C4_C3_3, xzr" : : : ); + + /* AESD z0.b, z0.b, z0.b */ + asm volatile(".inst 0x4522e400" : : : "z0"); + + /* SMSTOP */ + asm volatile("msr S0_3_C4_C6_3, xzr" : : : ); +} + +static void sme_sbitperm_sigill(void) +{ + /* SMSTART SM */ + asm volatile("msr S0_3_C4_C3_3, xzr" : : : ); + + /* BDEP Z0.B, Z0.B, Z0.B */ + asm volatile(".inst 0x4500b400" : : : "z0"); + + /* SMSTOP */ + asm volatile("msr S0_3_C4_C6_3, xzr" : : : ); +} + static void smei16i32_sigill(void) { /* SMSTART */ @@ -323,13 +383,73 @@ static void smesf8dp4_sigill(void) asm volatile("msr S0_3_C4_C6_3, xzr" : : : ); } =20 +static void smesf8mm8_sigill(void) +{ + /* SMSTART */ + asm volatile("msr S0_3_C4_C7_3, xzr" : : : ); + + /* FMMLA V0.4S, V0.16B, V0.16B */ + asm volatile(".inst 0x6e80ec00"); + + /* SMSTOP */ + asm volatile("msr S0_3_C4_C6_3, xzr" : : : ); +} + +static void smesf8mm4_sigill(void) +{ + /* SMSTART */ + asm volatile("msr S0_3_C4_C7_3, xzr" : : : ); + + /* FMMLA V0.4SH, V0.16B, V0.16B */ + asm volatile(".inst 0x6e00ec00"); + + /* SMSTOP */ + asm volatile("msr S0_3_C4_C6_3, xzr" : : : ); +} + static void smesf8fma_sigill(void) { /* SMSTART */ asm volatile("msr S0_3_C4_C7_3, xzr" : : : ); =20 - /* FMLALB V0.8H, V0.16B, V0.16B */ - asm volatile(".inst 0xec0fc00"); + /* FMLALB Z0.8H, Z0.B, Z0.B */ + asm volatile(".inst 0x64205000"); + + /* SMSTOP */ + asm volatile("msr S0_3_C4_C6_3, xzr" : : : ); +} + +static void smesfexpa_sigill(void) +{ + /* SMSTART */ + asm volatile("msr S0_3_C4_C7_3, xzr" : : : ); + + /* FEXPA Z0.D, Z0.D */ + asm volatile(".inst 0x04e0b800"); + + /* SMSTOP */ + asm volatile("msr S0_3_C4_C6_3, xzr" : : : ); +} + +static void smesmop4_sigill(void) +{ + /* SMSTART */ + asm volatile("msr S0_3_C4_C7_3, xzr" : : : ); + + /* SMOP4A ZA0.S, Z0.B, { Z0.B - Z1.B } */ + asm volatile(".inst 0x80108000"); + + /* SMSTOP */ + asm volatile("msr S0_3_C4_C6_3, xzr" : : : ); +} + +static void smestmop_sigill(void) +{ + /* SMSTART */ + asm volatile("msr S0_3_C4_C7_3, xzr" : : : ); + + /* STMOPA ZA0.S, { Z0.H - Z1.H }, Z0.H, Z20[0] */ + asm volatile(".inst 0x80408008"); =20 /* SMSTOP */ asm volatile("msr S0_3_C4_C6_3, xzr" : : : ); @@ -353,18 +473,42 @@ static void sve2p1_sigill(void) asm volatile(".inst 0x65000000" : : : "z0"); } =20 +static void sve2p2_sigill(void) +{ + /* NOT Z0.D, P0/Z, Z0.D */ + asm volatile(".inst 0x4cea000" : : : "z0"); +} + static void sveaes_sigill(void) { /* AESD z0.b, z0.b, z0.b */ asm volatile(".inst 0x4522e400" : : : "z0"); } =20 +static void sveaes2_sigill(void) +{ + /* AESD {Z0.B - Z1.B }, { Z0.B - Z1.B }, Z0.Q */ + asm volatile(".inst 0x4522ec00" : : : "z0"); +} + static void sveb16b16_sigill(void) { /* BFADD ZA.H[W0, 0], {Z0.H-Z1.H} */ asm volatile(".inst 0xC1E41C00" : : : ); } =20 +static void svebfscale_sigill(void) +{ + /* BFSCALE Z0.H, P0/M, Z0.H, Z0.H */ + asm volatile(".inst 0x65098000" : : : "z0"); +} + +static void svef16mm_sigill(void) +{ + /* FMMLA Z0.S, Z0.H, Z0.H */ + asm volatile(".inst 0x6420e400"); +} + static void svepmull_sigill(void) { /* PMULLB Z0.Q, Z0.D, Z0.D */ @@ -383,6 +527,12 @@ static void svesha3_sigill(void) asm volatile(".inst 0x4203800" : : : "z0"); } =20 +static void sveeltperm_sigill(void) +{ + /* COMPACT Z0.B, P0, Z0.B */ + asm volatile(".inst 0x5218000" : : : "x0"); +} + static void svesm4_sigill(void) { /* SM4E Z0.S, Z0.S, Z0.S */ @@ -458,6 +608,13 @@ static const struct hwcap_data { .cpuinfo =3D "aes", .sigill_fn =3D aes_sigill, }, + { + .name =3D "CMPBR", + .at_hwcap =3D AT_HWCAP, + .hwcap_bit =3D HWCAP_CMPBR, + .cpuinfo =3D "cmpbr", + .sigill_fn =3D cmpbr_sigill, + }, { .name =3D "CRC32", .at_hwcap =3D AT_HWCAP, @@ -512,6 +669,20 @@ static const struct hwcap_data { .cpuinfo =3D "f8fma", .sigill_fn =3D f8fma_sigill, }, + { + .name =3D "F8MM8", + .at_hwcap =3D AT_HWCAP, + .hwcap_bit =3D HWCAP_F8MM8, + .cpuinfo =3D "f8mm8", + .sigill_fn =3D f8mm8_sigill, + }, + { + .name =3D "F8MM4", + .at_hwcap =3D AT_HWCAP, + .hwcap_bit =3D HWCAP_F8MM4, + .cpuinfo =3D "f8mm4", + .sigill_fn =3D f8mm4_sigill, + }, { .name =3D "FAMINMAX", .at_hwcap =3D AT_HWCAP2, @@ -534,6 +705,13 @@ static const struct hwcap_data { .sigill_fn =3D fpmr_sigill, .sigill_reliable =3D true, }, + { + .name =3D "FPRCVT", + .at_hwcap =3D AT_HWCAP, + .hwcap_bit =3D HWCAP_FPRCVT, + .cpuinfo =3D "fprcvt", + .sigill_fn =3D fprcvt_sigill, + }, { .name =3D "JSCVT", .at_hwcap =3D AT_HWCAP, @@ -672,6 +850,20 @@ static const struct hwcap_data { .cpuinfo =3D "sme2p1", .sigill_fn =3D sme2p1_sigill, }, + { + .name =3D "SME 2.2", + .at_hwcap =3D AT_HWCAP, + .hwcap_bit =3D HWCAP_SME2P2, + .cpuinfo =3D "sme2p2", + .sigill_fn =3D sme2p2_sigill, + }, + { + .name =3D "SME AES", + .at_hwcap =3D AT_HWCAP, + .hwcap_bit =3D HWCAP_SME_AES, + .cpuinfo =3D "smeaes", + .sigill_fn =3D sme_aes_sigill, + }, { .name =3D "SME I16I32", .at_hwcap =3D AT_HWCAP2, @@ -721,6 +913,13 @@ static const struct hwcap_data { .cpuinfo =3D "smelutv2", .sigill_fn =3D smelutv2_sigill, }, + { + .name =3D "SME SBITPERM", + .at_hwcap =3D AT_HWCAP, + .hwcap_bit =3D HWCAP_SME_SBITPERM, + .cpuinfo =3D "smesbitperm", + .sigill_fn =3D sme_sbitperm_sigill, + }, { .name =3D "SME SF8FMA", .at_hwcap =3D AT_HWCAP2, @@ -728,6 +927,20 @@ static const struct hwcap_data { .cpuinfo =3D "smesf8fma", .sigill_fn =3D smesf8fma_sigill, }, + { + .name =3D "SME SF8MM8", + .at_hwcap =3D AT_HWCAP, + .hwcap_bit =3D HWCAP_SME_SF8MM8, + .cpuinfo =3D "smesf8mm8", + .sigill_fn =3D smesf8mm8_sigill, + }, + { + .name =3D "SME SF8MM4", + .at_hwcap =3D AT_HWCAP, + .hwcap_bit =3D HWCAP_SME_SF8MM8, + .cpuinfo =3D "smesf8mm4", + .sigill_fn =3D smesf8mm4_sigill, + }, { .name =3D "SME SF8DP2", .at_hwcap =3D AT_HWCAP2, @@ -742,6 +955,27 @@ static const struct hwcap_data { .cpuinfo =3D "smesf8dp4", .sigill_fn =3D smesf8dp4_sigill, }, + { + .name =3D "SME SFEXPA", + .at_hwcap =3D AT_HWCAP, + .hwcap_bit =3D HWCAP_SME_SFEXPA, + .cpuinfo =3D "smesfexpa", + .sigill_fn =3D smesfexpa_sigill, + }, + { + .name =3D "SME SMOP4", + .at_hwcap =3D AT_HWCAP, + .hwcap_bit =3D HWCAP_SME_SMOP4, + .cpuinfo =3D "smesmop4", + .sigill_fn =3D smesmop4_sigill, + }, + { + .name =3D "SME STMOP", + .at_hwcap =3D AT_HWCAP, + .hwcap_bit =3D HWCAP_SME_STMOP, + .cpuinfo =3D "smestmop", + .sigill_fn =3D smestmop_sigill, + }, { .name =3D "SVE", .at_hwcap =3D AT_HWCAP, @@ -764,6 +998,13 @@ static const struct hwcap_data { .cpuinfo =3D "sve2p1", .sigill_fn =3D sve2p1_sigill, }, + { + .name =3D "SVE 2.2", + .at_hwcap =3D AT_HWCAP, + .hwcap_bit =3D HWCAP_SVE2P2, + .cpuinfo =3D "sve2p2", + .sigill_fn =3D sve2p2_sigill, + }, { .name =3D "SVE AES", .at_hwcap =3D AT_HWCAP2, @@ -771,6 +1012,34 @@ static const struct hwcap_data { .cpuinfo =3D "sveaes", .sigill_fn =3D sveaes_sigill, }, + { + .name =3D "SVE AES2", + .at_hwcap =3D AT_HWCAP, + .hwcap_bit =3D HWCAP_SVE_AES2, + .cpuinfo =3D "sveaes2", + .sigill_fn =3D sveaes2_sigill, + }, + { + .name =3D "SVE BFSCALE", + .at_hwcap =3D AT_HWCAP, + .hwcap_bit =3D HWCAP_SVE_BFSCALE, + .cpuinfo =3D "svebfscale", + .sigill_fn =3D svebfscale_sigill, + }, + { + .name =3D "SVE ELTPERM", + .at_hwcap =3D AT_HWCAP, + .hwcap_bit =3D HWCAP_SVE_ELTPERM, + .cpuinfo =3D "sveeltperm", + .sigill_fn =3D sveeltperm_sigill, + }, + { + .name =3D "SVE F16MM", + .at_hwcap =3D AT_HWCAP, + .hwcap_bit =3D HWCAP_SVE_F16MM, + .cpuinfo =3D "svef16mm", + .sigill_fn =3D svef16mm_sigill, + }, { .name =3D "SVE2 B16B16", .at_hwcap =3D AT_HWCAP2, --=20 2.39.2