diff options
author | Zeng Heng <zengheng4@huawei.com> | 2023-08-08 21:40:36 +0800 |
---|---|---|
committer | Will Deacon <will@kernel.org> | 2023-08-11 12:24:16 +0100 |
commit | 82e7882b141c177b1b09ae66e1b2ae791a9a3918 (patch) | |
tree | e001daa34f408bdbb645c5de3baa41a8845cc6bb /tools | |
parent | fd49cf088867f8fad7515b5424d301ca5d147070 (diff) | |
download | linux-stable-82e7882b141c177b1b09ae66e1b2ae791a9a3918.tar.gz linux-stable-82e7882b141c177b1b09ae66e1b2ae791a9a3918.tar.bz2 linux-stable-82e7882b141c177b1b09ae66e1b2ae791a9a3918.zip |
kselftest/arm64: add lse and lse2 features to hwcap test
Add the LSE and various features check in the set of hwcap tests.
As stated in the ARM manual, the LSE2 feature allows for atomic access
to unaligned memory. Therefore, for processors that only have the LSE
feature, we register .sigbus_fn to test their ability to perform
unaligned access.
Signed-off-by: Zeng Heng <zengheng4@huawei.com>
Reviewed-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230808134036.668954-6-zengheng4@huawei.com
Signed-off-by: Will Deacon <will@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/testing/selftests/arm64/abi/hwcap.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tools/testing/selftests/arm64/abi/hwcap.c b/tools/testing/selftests/arm64/abi/hwcap.c index 69234a8e8c59..112b6a219382 100644 --- a/tools/testing/selftests/arm64/abi/hwcap.c +++ b/tools/testing/selftests/arm64/abi/hwcap.c @@ -34,6 +34,12 @@ */ typedef void (*sig_fn)(void); +static void atomics_sigill(void) +{ + /* STADD W0, [SP] */ + asm volatile(".inst 0xb82003ff" : : : ); +} + static void crc32_sigill(void) { asm volatile("crc32w w0, w0, w1"); @@ -231,6 +237,14 @@ static void svebf16_sigill(void) asm volatile(".inst 0x658aa000" : : : "z0"); } +static void uscat_sigbus(void) +{ + /* unaligned atomic access */ + asm volatile("ADD x1, sp, #2" : : : ); + /* STADD W0, [X1] */ + asm volatile(".inst 0xb820003f" : : : ); +} + static const struct hwcap_data { const char *name; unsigned long at_hwcap; @@ -277,6 +291,22 @@ static const struct hwcap_data { .sigill_fn = ilrcpc_sigill, }, { + .name = "LSE", + .at_hwcap = AT_HWCAP, + .hwcap_bit = HWCAP_ATOMICS, + .cpuinfo = "atomics", + .sigill_fn = atomics_sigill, + }, + { + .name = "LSE2", + .at_hwcap = AT_HWCAP, + .hwcap_bit = HWCAP_USCAT, + .cpuinfo = "uscat", + .sigill_fn = atomics_sigill, + .sigbus_fn = uscat_sigbus, + .sigbus_reliable = true, + }, + { .name = "MOPS", .at_hwcap = AT_HWCAP2, .hwcap_bit = HWCAP2_MOPS, |