Skip to content

Commit 7a2f671

Browse files
brooniectmarinas
authored andcommitted
kselftest/arm64: Verify the GCS hwcap
Add coverage of the GCS hwcap to the hwcap selftest, using a read of GCSPR_EL0 to generate SIGILL without having to worry about enabling GCS. Reviewed-by: Thiago Jung Bauermann <[email protected]> Tested-by: Thiago Jung Bauermann <[email protected]> Signed-off-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent 5d8b172 commit 7a2f671

File tree

1 file changed

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

1 file changed

+19
-0
lines changed

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,17 @@ static void fpmr_sigill(void)
9898
asm volatile("mrs x0, S3_3_C4_C4_2" : : : "x0");
9999
}
100100

101+
static void gcs_sigill(void)
102+
{
103+
unsigned long *gcspr;
104+
105+
asm volatile(
106+
"mrs %0, S3_3_C2_C5_1"
107+
: "=r" (gcspr)
108+
:
109+
: "cc");
110+
}
111+
101112
static void ilrcpc_sigill(void)
102113
{
103114
/* LDAPUR W0, [SP, #8] */
@@ -534,6 +545,14 @@ static const struct hwcap_data {
534545
.sigill_fn = fpmr_sigill,
535546
.sigill_reliable = true,
536547
},
548+
{
549+
.name = "GCS",
550+
.at_hwcap = AT_HWCAP,
551+
.hwcap_bit = HWCAP_GCS,
552+
.cpuinfo = "gcs",
553+
.sigill_fn = gcs_sigill,
554+
.sigill_reliable = true,
555+
},
537556
{
538557
.name = "JSCVT",
539558
.at_hwcap = AT_HWCAP,

0 commit comments

Comments
 (0)