Skip to content

Commit 7eb4ee6

Browse files
henryZewilldeacon
authored andcommitted
kselftest/arm64: add SHA1 and related features to hwcap test
Add the SHA1 and related features check in the set of hwcap tests. Signed-off-by: Zeng Heng <[email protected]> Reviewed-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent e08302e commit 7eb4ee6

File tree

1 file changed

+39
-0
lines changed
  • tools/testing/selftests/arm64/abi

1 file changed

+39
-0
lines changed

tools/testing/selftests/arm64/abi/hwcap.c

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,24 @@ static void rng_sigill(void)
8787
asm volatile("mrs x0, S3_3_C2_C4_0" : : : "x0");
8888
}
8989

90+
static void sha1_sigill(void)
91+
{
92+
/* SHA1H S0, S0 */
93+
asm volatile(".inst 0x5e280800" : : : );
94+
}
95+
96+
static void sha2_sigill(void)
97+
{
98+
/* SHA256H Q0, Q0, V0.4S */
99+
asm volatile(".inst 0x5e004000" : : : );
100+
}
101+
102+
static void sha512_sigill(void)
103+
{
104+
/* SHA512H Q0, Q0, V0.2D */
105+
asm volatile(".inst 0xce608000" : : : );
106+
}
107+
90108
static void sme_sigill(void)
91109
{
92110
/* RDSVL x0, #0 */
@@ -327,6 +345,27 @@ static const struct hwcap_data {
327345
.hwcap_bit = HWCAP2_RPRFM,
328346
.cpuinfo = "rprfm",
329347
},
348+
{
349+
.name = "SHA1",
350+
.at_hwcap = AT_HWCAP,
351+
.hwcap_bit = HWCAP_SHA1,
352+
.cpuinfo = "sha1",
353+
.sigill_fn = sha1_sigill,
354+
},
355+
{
356+
.name = "SHA2",
357+
.at_hwcap = AT_HWCAP,
358+
.hwcap_bit = HWCAP_SHA2,
359+
.cpuinfo = "sha2",
360+
.sigill_fn = sha2_sigill,
361+
},
362+
{
363+
.name = "SHA512",
364+
.at_hwcap = AT_HWCAP,
365+
.hwcap_bit = HWCAP_SHA512,
366+
.cpuinfo = "sha512",
367+
.sigill_fn = sha512_sigill,
368+
},
330369
{
331370
.name = "SME",
332371
.at_hwcap = AT_HWCAP2,

0 commit comments

Comments
 (0)