Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Zeng Heng and committed by
Will Deacon
82e7882b fd49cf08

+30
+30
tools/testing/selftests/arm64/abi/hwcap.c
··· 34 34 */ 35 35 typedef void (*sig_fn)(void); 36 36 37 + static void atomics_sigill(void) 38 + { 39 + /* STADD W0, [SP] */ 40 + asm volatile(".inst 0xb82003ff" : : : ); 41 + } 42 + 37 43 static void crc32_sigill(void) 38 44 { 39 45 asm volatile("crc32w w0, w0, w1"); ··· 237 231 asm volatile(".inst 0x658aa000" : : : "z0"); 238 232 } 239 233 234 + static void uscat_sigbus(void) 235 + { 236 + /* unaligned atomic access */ 237 + asm volatile("ADD x1, sp, #2" : : : ); 238 + /* STADD W0, [X1] */ 239 + asm volatile(".inst 0xb820003f" : : : ); 240 + } 241 + 240 242 static const struct hwcap_data { 241 243 const char *name; 242 244 unsigned long at_hwcap; ··· 289 275 .hwcap_bit = HWCAP_ILRCPC, 290 276 .cpuinfo = "ilrcpc", 291 277 .sigill_fn = ilrcpc_sigill, 278 + }, 279 + { 280 + .name = "LSE", 281 + .at_hwcap = AT_HWCAP, 282 + .hwcap_bit = HWCAP_ATOMICS, 283 + .cpuinfo = "atomics", 284 + .sigill_fn = atomics_sigill, 285 + }, 286 + { 287 + .name = "LSE2", 288 + .at_hwcap = AT_HWCAP, 289 + .hwcap_bit = HWCAP_USCAT, 290 + .cpuinfo = "uscat", 291 + .sigill_fn = atomics_sigill, 292 + .sigbus_fn = uscat_sigbus, 293 + .sigbus_reliable = true, 292 294 }, 293 295 { 294 296 .name = "MOPS",