Skip to content

Commit d8a324f

Browse files
kristina-martsenkoctmarinas
authored andcommitted
kselftest/arm64: add MOPS to hwcap test
Add the MOPS hwcap to the hwcap kselftest and check that a SIGILL is not generated when the feature is detected. A SIGILL is reliable when the feature is not detected as SCTLR_EL1.MSCEn won't have been set. Signed-off-by: Kristina Martsenko <[email protected]> Reviewed-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent 3e1dedb commit d8a324f

File tree

1 file changed

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

1 file changed

+22
-0
lines changed

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,20 @@ static void cssc_sigill(void)
3939
asm volatile(".inst 0xdac01c00" : : : "x0");
4040
}
4141

42+
static void mops_sigill(void)
43+
{
44+
char dst[1], src[1];
45+
register char *dstp asm ("x0") = dst;
46+
register char *srcp asm ("x1") = src;
47+
register long size asm ("x2") = 1;
48+
49+
/* CPYP [x0]!, [x1]!, x2! */
50+
asm volatile(".inst 0x1d010440"
51+
: "+r" (dstp), "+r" (srcp), "+r" (size)
52+
:
53+
: "cc", "memory");
54+
}
55+
4256
static void rng_sigill(void)
4357
{
4458
asm volatile("mrs x0, S3_3_C2_C4_0" : : : "x0");
@@ -209,6 +223,14 @@ static const struct hwcap_data {
209223
.cpuinfo = "cssc",
210224
.sigill_fn = cssc_sigill,
211225
},
226+
{
227+
.name = "MOPS",
228+
.at_hwcap = AT_HWCAP2,
229+
.hwcap_bit = HWCAP2_MOPS,
230+
.cpuinfo = "mops",
231+
.sigill_fn = mops_sigill,
232+
.sigill_reliable = true,
233+
},
212234
{
213235
.name = "RNG",
214236
.at_hwcap = AT_HWCAP2,

0 commit comments

Comments
 (0)