Skip to content

Commit

Permalink
kselftest/arm64: add MOPS to hwcap test
Browse files Browse the repository at this point in the history
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 <kristina.martsenko@arm.com>
Reviewed-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230509142235.3284028-12-kristina.martsenko@arm.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
  • Loading branch information
Kristina Martsenko authored and Catalin Marinas committed Jun 5, 2023
1 parent 3e1dedb commit d8a324f
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tools/testing/selftests/arm64/abi/hwcap.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,20 @@ static void cssc_sigill(void)
asm volatile(".inst 0xdac01c00" : : : "x0");
}

static void mops_sigill(void)
{
char dst[1], src[1];
register char *dstp asm ("x0") = dst;
register char *srcp asm ("x1") = src;
register long size asm ("x2") = 1;

/* CPYP [x0]!, [x1]!, x2! */
asm volatile(".inst 0x1d010440"
: "+r" (dstp), "+r" (srcp), "+r" (size)
:
: "cc", "memory");
}

static void rng_sigill(void)
{
asm volatile("mrs x0, S3_3_C2_C4_0" : : : "x0");
Expand Down Expand Up @@ -209,6 +223,14 @@ static const struct hwcap_data {
.cpuinfo = "cssc",
.sigill_fn = cssc_sigill,
},
{
.name = "MOPS",
.at_hwcap = AT_HWCAP2,
.hwcap_bit = HWCAP2_MOPS,
.cpuinfo = "mops",
.sigill_fn = mops_sigill,
.sigill_reliable = true,
},
{
.name = "RNG",
.at_hwcap = AT_HWCAP2,
Expand Down

0 comments on commit d8a324f

Please sign in to comment.