Add RCpc load-acquire and various features check in the set of hwcaps.
Test log as shown below: ~~~ # RCpc load-acquire present ok 47 cpuinfo_match_RCpc load-acquire ok 48 sigill_RCpc load-acquire # RCpc load-acquire2 present ok 49 cpuinfo_match_RCpc load-acquire2 ok 50 sigill_RCpc load-acquire2 ~~~
Signed-off-by: Zeng Heng zengheng4@huawei.com --- tools/testing/selftests/arm64/abi/hwcap.c | 26 +++++++++++++++++++++++ 1 file changed, 26 insertions(+)
diff --git a/tools/testing/selftests/arm64/abi/hwcap.c b/tools/testing/selftests/arm64/abi/hwcap.c index 93333a90bf3a..ccb3f6adb68f 100644 --- a/tools/testing/selftests/arm64/abi/hwcap.c +++ b/tools/testing/selftests/arm64/abi/hwcap.c @@ -194,6 +194,18 @@ static void svebf16_sigill(void) asm volatile(".inst 0x658aa000" : : : "z0"); }
+static void lrcpc_sigill(void) +{ + /* LDAPR W0, [SP, #0] */ + asm volatile(".inst 0xb8bfc3e0" : : : ); +} + +static void ilrcpc_sigill(void) +{ + /* LDAPUR W0, [SP, #8] */ + asm volatile(".inst 0x994083e0" : : : ); +} + static const struct hwcap_data { const char *name; unsigned long at_hwcap; @@ -364,6 +376,20 @@ static const struct hwcap_data { .hwcap_bit = HWCAP2_SVE_EBF16, .cpuinfo = "sveebf16", }, + { + .name = "RCpc load-acquire", + .at_hwcap = AT_HWCAP, + .hwcap_bit = HWCAP_LRCPC, + .cpuinfo = "lrcpc", + .sigill_fn = lrcpc_sigill, + }, + { + .name = "RCpc load-acquire2", + .at_hwcap = AT_HWCAP, + .hwcap_bit = HWCAP_ILRCPC, + .cpuinfo = "ilrcpc", + .sigill_fn = ilrcpc_sigill, + }, };
static bool seen_sigill;
On Thu, Aug 03, 2023 at 03:02:31PM +0800, Zeng Heng wrote:
@@ -364,6 +376,20 @@ static const struct hwcap_data { .hwcap_bit = HWCAP2_SVE_EBF16, .cpuinfo = "sveebf16", },
- {
.name = "RCpc load-acquire",
.at_hwcap = AT_HWCAP,
.hwcap_bit = HWCAP_LRCPC,
.cpuinfo = "lrcpc",
.sigill_fn = lrcpc_sigill,
- },
The table is roughly ordered by feature name, it'd be good to keep it that way (apart from anything else it minimises merge conflicts). It'd also be good to follow the existing style and use the FEAT_ name for the feature as the display name, if there isn't one then at least something similarly all caps like the name of the ID register field?
在 2023/8/3 19:36, Mark Brown 写道:
On Thu, Aug 03, 2023 at 03:02:31PM +0800, Zeng Heng wrote:
@@ -364,6 +376,20 @@ static const struct hwcap_data { .hwcap_bit = HWCAP2_SVE_EBF16, .cpuinfo = "sveebf16", },
- {
.name = "RCpc load-acquire",
.at_hwcap = AT_HWCAP,
.hwcap_bit = HWCAP_LRCPC,
.cpuinfo = "lrcpc",
.sigill_fn = lrcpc_sigill,
- },
The table is roughly ordered by feature name, it'd be good to keep it that way (apart from anything else it minimises merge conflicts). It'd also be good to follow the existing style and use the FEAT_ name for the feature as the display name, if there isn't one then at least something similarly all caps like the name of the ID register field?
Thanks for review, and v2 would be sent later.
Zeng Heng
linux-kselftest-mirror@lists.linaro.org