Skip to content

Commit e7012ba

Browse files
[lldb][AArch64] Add isAArch64SMEFA64 check to SME testing (#68094)
FEAT_SME_FA64 (smefa64 in Linux cpuinfo) allows the use of the full A64 instruction set while in streaming SVE mode. See https://developer.arm.com/documentation/ddi0616/latest/ for details. This means for example if we want to write to the ffr register during or use floating point registers while in streaming mode, we need this extension. I initially was using QEMU which has it by default, and switched to Arm's FVP which does not. So this change adds a more strict check and converts most of the tests to use that. It would be possible in some cases to avoid the offending instructions but it would be a lot of effort and liable to fail randomly as the C library changes. It is also my assumption that the majority of systems will have smefa64 as QEMU has chosen to have. If I turn out to be wrong, we can make the effort to get the tests working without smefa64. `isAArch64SME` remains for some tests, which are as follows: * `test_aarch64_dynamic_regset_config` merely checks for the presence of a register set, which appears for any SME system not just one with smefa64. * `test_aarch64_dynamic_regset_config_sme_za_disabled` only needs the ZA register and does not enter streaming mode. * `test_sme_not_present` tests for the absence of the SME register set, so must be skipped if any form of SME is present. * Various tests in `TestSVERegisters.py` need to know if SME is present at all to generate an expected SVCR value. Earlier in the callstack something else checked `isAArch64SMEFA64` already. * `TestAArch64LinuxTLSRegisters.py` needs to test the `tpidr2` register if any form of SME is present. msr/mrs instructions are used to do this and are allowed even if smefa64 is not present.
1 parent d8abce1 commit e7012ba

File tree

8 files changed

+37
-14
lines changed

8 files changed

+37
-14
lines changed

lldb/packages/Python/lldbsuite/test/lldbtest.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,6 +1271,14 @@ def isAArch64SVE(self):
12711271
def isAArch64SME(self):
12721272
return self.isAArch64() and "sme" in self.getCPUInfo()
12731273

1274+
def isAArch64SMEFA64(self):
1275+
# smefa64 allows the use of the full A64 instruction set in streaming
1276+
# mode. This is required by certain test programs to setup register
1277+
# state.
1278+
return self.isAArch64SME() and set(["sme", "smefa64"]).issuperset(
1279+
set(self.getCPUInfo())
1280+
)
1281+
12741282
def isAArch64MTE(self):
12751283
return self.isAArch64() and "mte" in self.getCPUInfo()
12761284

lldb/test/API/commands/register/register/aarch64_dynamic_regset/TestArm64DynamicRegsets.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ def make_za_value(self, vl, generator):
142142
def test_aarch64_dynamic_regset_config_sme(self):
143143
"""Test AArch64 Dynamic Register sets configuration, but only SME
144144
registers."""
145-
if not self.isAArch64SME():
146-
self.skipTest("SME must be present.")
145+
if not self.isAArch64SMEFA64():
146+
self.skipTest("SME and the smefa64 extension must be present")
147147

148148
register_sets = self.setup_register_config_test("sme")
149149

lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_dynamic_resize/TestSVEThreadedDynamic.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,11 @@ def run_sve_test(self, mode):
108108
if (mode == Mode.SVE) and not self.isAArch64SVE():
109109
self.skipTest("SVE registers must be supported.")
110110

111-
if (mode == Mode.SSVE) and not self.isAArch64SME():
112-
self.skipTest("Streaming SVE registers must be supported.")
111+
if (mode == Mode.SSVE) and not self.isAArch64SMEFA64():
112+
self.skipTest(
113+
"Streaming SVE registers must be supported and the "
114+
"smefa64 extension must be present."
115+
)
113116

114117
self.build_for_mode(mode)
115118

@@ -201,8 +204,11 @@ def test_ssve_registers_dynamic_config(self):
201204

202205
def setup_svg_test(self, mode):
203206
# Even when running in SVE mode, we need access to SVG for these tests.
204-
if not self.isAArch64SME():
205-
self.skipTest("Streaming SVE registers must be present.")
207+
if not self.isAArch64SMEFA64():
208+
self.skipTest(
209+
"Streaming SVE registers must be present and the "
210+
"smefa64 extension must be present."
211+
)
206212

207213
self.build_for_mode(mode)
208214

lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_static_config/TestSVERegisters.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,11 @@ def skip_if_needed(self, mode):
8585
if (mode == Mode.SVE) and not self.isAArch64SVE():
8686
self.skipTest("SVE registers must be supported.")
8787

88-
if (mode == Mode.SSVE) and not self.isAArch64SME():
89-
self.skipTest("SSVE registers must be supported.")
88+
if (mode == Mode.SSVE) and not self.isAArch64SMEFA64():
89+
self.skipTest(
90+
"SSVE registers must be supported and the smefa64 "
91+
"extension must be present."
92+
)
9093

9194
def sve_registers_configuration_impl(self, mode):
9295
self.skip_if_needed(mode)

lldb/test/API/commands/register/register/aarch64_sve_simd_registers/TestSVESIMDRegisters.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,11 @@ def skip_if_needed(self, mode):
4141
if (mode == Mode.SVE) and not self.isAArch64SVE():
4242
self.skipTest("SVE registers must be supported.")
4343

44-
if (mode == Mode.SSVE) and not self.isAArch64SME():
45-
self.skipTest("SSVE registers must be supported.")
44+
if (mode == Mode.SSVE) and not self.isAArch64SMEFA64():
45+
self.skipTest(
46+
"SSVE registers must be supported and the smefa64 "
47+
"extension must be present."
48+
)
4649

4750
def make_simd_value(self, n):
4851
pad = " ".join(["0x00"] * 7)

lldb/test/API/commands/register/register/aarch64_za_register/za_dynamic_resize/TestZAThreadedDynamic.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ def check_disabled_za_register(self, svg):
6565
self.expect("register read za", substrs=[self.gen_za_value(svg, lambda r: 0)])
6666

6767
def za_test_impl(self, enable_za):
68-
if not self.isAArch64SME():
69-
self.skipTest("SME must be present.")
68+
# Although the test program doesn't obviously do any operations that
69+
# would need smefa64, calls to libc functions like memset may do.
70+
if not self.isAArch64SMEFA64():
71+
self.skipTest("SME and the sm3fa64 extension must be present")
7072

7173
self.build()
7274
supported_vg = self.get_supported_vg()

lldb/test/API/commands/register/register/aarch64_za_register/za_dynamic_resize/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ void set_za_register(int svl, int value_offset) {
2929
// you have. So setting one that didn't exist would actually set one that did.
3030
// That's why we need the streaming vector length here.
3131
for (int i = 0; i < svl; ++i) {
32+
// This may involve instructions that require the smefa64 extension.
3233
memset(data, i + value_offset, MAX_VL_BYTES);
3334
// Each one of these loads a VL sized row of ZA.
3435
asm volatile("mov w12, %w0\n\t"

lldb/test/API/commands/register/register/aarch64_za_register/za_save_restore/TestZARegisterSaveRestore.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ def check_za_disabled(self, vl):
106106
self.expect("register read za", substrs=[self.make_za_value(vl, lambda row: 0)])
107107

108108
def za_expr_test_impl(self, sve_mode, za_state, swap_start_vl):
109-
if not self.isAArch64SME():
110-
self.skipTest("SME must be present.")
109+
if not self.isAArch64SMEFA64():
110+
self.skipTest("SME and the smefa64 extension must be present.")
111111

112112
supported_svg = self.get_supported_svg()
113113
if len(supported_svg) < 2:

0 commit comments

Comments
 (0)