Skip to content

Commit 3eb1b41

Browse files
brooniectmarinas
authored andcommitted
kselftest/arm64: Add coverage of SME 2 and 2.1 hwcaps
Add the hwcaps defined by SME 2 and 2.1 to the hwcaps test. Signed-off-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent 4e1aa1a commit 3eb1b41

File tree

1 file changed

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

1 file changed

+115
-0
lines changed

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

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,78 @@ static void sme_sigill(void)
5050
asm volatile(".inst 0x04bf5800" : : : "x0");
5151
}
5252

53+
static void sme2_sigill(void)
54+
{
55+
/* SMSTART ZA */
56+
asm volatile("msr S0_3_C4_C5_3, xzr" : : : );
57+
58+
/* ZERO ZT0 */
59+
asm volatile(".inst 0xc0480001" : : : );
60+
61+
/* SMSTOP */
62+
asm volatile("msr S0_3_C4_C6_3, xzr" : : : );
63+
}
64+
65+
static void sme2p1_sigill(void)
66+
{
67+
/* SMSTART SM */
68+
asm volatile("msr S0_3_C4_C3_3, xzr" : : : );
69+
70+
/* BFCLAMP { Z0.H - Z1.H }, Z0.H, Z0.H */
71+
asm volatile(".inst 0xc120C000" : : : );
72+
73+
/* SMSTOP */
74+
asm volatile("msr S0_3_C4_C6_3, xzr" : : : );
75+
}
76+
77+
static void smei16i32_sigill(void)
78+
{
79+
/* SMSTART */
80+
asm volatile("msr S0_3_C4_C7_3, xzr" : : : );
81+
82+
/* SMOPA ZA0.S, P0/M, P0/M, Z0.B, Z0.B */
83+
asm volatile(".inst 0xa0800000" : : : );
84+
85+
/* SMSTOP */
86+
asm volatile("msr S0_3_C4_C6_3, xzr" : : : );
87+
}
88+
89+
static void smebi32i32_sigill(void)
90+
{
91+
/* SMSTART */
92+
asm volatile("msr S0_3_C4_C7_3, xzr" : : : );
93+
94+
/* BMOPA ZA0.S, P0/M, P0/M, Z0.B, Z0.B */
95+
asm volatile(".inst 0x80800008" : : : );
96+
97+
/* SMSTOP */
98+
asm volatile("msr S0_3_C4_C6_3, xzr" : : : );
99+
}
100+
101+
static void smeb16b16_sigill(void)
102+
{
103+
/* SMSTART */
104+
asm volatile("msr S0_3_C4_C7_3, xzr" : : : );
105+
106+
/* BFADD ZA.H[W0, 0], {Z0.H-Z1.H} */
107+
asm volatile(".inst 0xC1E41C00" : : : );
108+
109+
/* SMSTOP */
110+
asm volatile("msr S0_3_C4_C6_3, xzr" : : : );
111+
}
112+
113+
static void smef16f16_sigill(void)
114+
{
115+
/* SMSTART */
116+
asm volatile("msr S0_3_C4_C7_3, xzr" : : : );
117+
118+
/* FADD ZA.H[W0, 0], { Z0.H-Z1.H } */
119+
asm volatile(".inst 0xc1a41C00" : : : );
120+
121+
/* SMSTOP */
122+
asm volatile("msr S0_3_C4_C6_3, xzr" : : : );
123+
}
124+
53125
static void sve_sigill(void)
54126
{
55127
/* RDVL x0, #0 */
@@ -158,6 +230,49 @@ static const struct hwcap_data {
158230
.sigill_fn = sme_sigill,
159231
.sigill_reliable = true,
160232
},
233+
{
234+
.name = "SME2",
235+
.at_hwcap = AT_HWCAP2,
236+
.hwcap_bit = HWCAP2_SME2,
237+
.cpuinfo = "sme2",
238+
.sigill_fn = sme2_sigill,
239+
.sigill_reliable = true,
240+
},
241+
{
242+
.name = "SME 2.1",
243+
.at_hwcap = AT_HWCAP2,
244+
.hwcap_bit = HWCAP2_SME2P1,
245+
.cpuinfo = "sme2p1",
246+
.sigill_fn = sme2p1_sigill,
247+
},
248+
{
249+
.name = "SME I16I32",
250+
.at_hwcap = AT_HWCAP2,
251+
.hwcap_bit = HWCAP2_SME_I16I32,
252+
.cpuinfo = "smei16i32",
253+
.sigill_fn = smei16i32_sigill,
254+
},
255+
{
256+
.name = "SME BI32I32",
257+
.at_hwcap = AT_HWCAP2,
258+
.hwcap_bit = HWCAP2_SME_BI32I32,
259+
.cpuinfo = "smebi32i32",
260+
.sigill_fn = smebi32i32_sigill,
261+
},
262+
{
263+
.name = "SME B16B16",
264+
.at_hwcap = AT_HWCAP2,
265+
.hwcap_bit = HWCAP2_SME_B16B16,
266+
.cpuinfo = "smeb16b16",
267+
.sigill_fn = smeb16b16_sigill,
268+
},
269+
{
270+
.name = "SME F16F16",
271+
.at_hwcap = AT_HWCAP2,
272+
.hwcap_bit = HWCAP2_SME_F16F16,
273+
.cpuinfo = "smef16f16",
274+
.sigill_fn = smef16f16_sigill,
275+
},
161276
{
162277
.name = "SVE",
163278
.at_hwcap = AT_HWCAP,

0 commit comments

Comments
 (0)