Skip to content

Commit 72e3019

Browse files
jgoulyctmarinas
authored andcommitted
kselftest/arm64: add FEAT_LSE128 to hwcap test
Add test of a 128-bit atomic instruction for FEAT_LSE128. Signed-off-by: Joey Gouly <joey.gouly@arm.com> Cc: Will Deacon <will@kernel.org> Link: https://lore.kernel.org/r/20231003124544.858804-3-joey.gouly@arm.com [catalin.marinas@arm.com: reordered lse128_sigill() alphabetically] Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent 94d0657 commit 72e3019

File tree

1 file changed

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

1 file changed

+21
-0
lines changed

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,20 @@ static void lrcpc_sigill(void)
8181
asm volatile(".inst 0xb8bfc3e0" : : : );
8282
}
8383

84+
static void lse128_sigill(void)
85+
{
86+
u64 __attribute__ ((aligned (16))) mem[2] = { 10, 20 };
87+
register u64 *memp asm ("x0") = mem;
88+
register u64 val0 asm ("x1") = 5;
89+
register u64 val1 asm ("x2") = 4;
90+
91+
/* SWPP X1, X2, [X0] */
92+
asm volatile(".inst 0x19228001"
93+
: "+r" (memp), "+r" (val0), "+r" (val1)
94+
:
95+
: "cc", "memory");
96+
}
97+
8498
static void mops_sigill(void)
8599
{
86100
char dst[1], src[1];
@@ -390,6 +404,13 @@ static const struct hwcap_data {
390404
.sigbus_fn = uscat_sigbus,
391405
.sigbus_reliable = true,
392406
},
407+
{
408+
.name = "LSE128",
409+
.at_hwcap = AT_HWCAP2,
410+
.hwcap_bit = HWCAP2_LSE128,
411+
.cpuinfo = "lse128",
412+
.sigill_fn = lse128_sigill,
413+
},
393414
{
394415
.name = "MOPS",
395416
.at_hwcap = AT_HWCAP2,

0 commit comments

Comments
 (0)