This patch adds a test case to test SME register exposure to
a remote gdb debugging session. This test simply sets and
reads SME registers.
Signed-off-by: Vacha Bhavsar <vacha.bhavsar@oss.qualcomm.com>
---
Changes since v4:
- this patch was not present in v4, it was added based on
suggestions during the review of v4
---
configure | 6 ++
tests/tcg/aarch64/Makefile.target | 23 ++++-
tests/tcg/aarch64/gdbstub/test-sme.py | 119 ++++++++++++++++++++++++++
3 files changed, 147 insertions(+), 1 deletion(-)
create mode 100644 tests/tcg/aarch64/gdbstub/test-sme.py
diff --git a/configure b/configure
index 825057ebf1..177d3775ac 100755
--- a/configure
+++ b/configure
@@ -1837,6 +1837,12 @@ for target in $target_list; do
echo "GDB=$gdb_bin" >> $config_target_mak
fi
+ if test "${gdb_arches#*$arch}" != "$gdb_arches" && version_ge $gdb_version 14.1; then
+ echo "GDB_HAS_SME_TILES=y" >> $config_target_mak
+ else
+ echo "GDB_HAS_SME_TILES=n" >> $config_target_mak
+ fi
+
if test "${gdb_arches#*aarch64}" != "$gdb_arches" && version_ge $gdb_version 15.1; then
echo "GDB_HAS_MTE=y" >> $config_target_mak
fi
diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target
index 16ddcf4f88..1a33ef17a0 100644
--- a/tests/tcg/aarch64/Makefile.target
+++ b/tests/tcg/aarch64/Makefile.target
@@ -132,7 +132,28 @@ run-gdbstub-sve-ioctls: sve-ioctls
--bin $< --test $(AARCH64_SRC)/gdbstub/test-sve-ioctl.py, \
basic gdbstub SVE ZLEN support)
-EXTRA_RUNS += run-gdbstub-sysregs run-gdbstub-sve-ioctls
+ifneq ($(CROSS_AS_HAS_ARMV9_SME),)
+# SME gdbstub test
+ifeq ($(GDB_HAS_SME_TILES),y)
+run-gdbstub-sysregs-sme: sysregs
+ $(call run-test, $@, $(GDB_SCRIPT) \
+ --gdb $(GDB) \
+ --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
+ --bin $< --test $(AARCH64_SRC)/gdbstub/test-sme.py \
+ -- test_sme --gdb_sme_tile_support, \
+ basic gdbstub SME support)
+else
+run-gdbstub-sysregs-sme: sysregs
+ $(call run-test, $@, $(GDB_SCRIPT) \
+ --gdb $(GDB) \
+ --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
+ --bin $< --test $(AARCH64_SRC)/gdbstub/test-sme.py, \
+ basic gdbstub SME support)
+
+endif
+endif
+
+EXTRA_RUNS += run-gdbstub-sysregs run-gdbstub-sve-ioctls run-gdbstub-sysregs-sme
ifeq ($(GDB_HAS_MTE),y)
run-gdbstub-mte: mte-8
diff --git a/tests/tcg/aarch64/gdbstub/test-sme.py b/tests/tcg/aarch64/gdbstub/test-sme.py
new file mode 100644
index 0000000000..c2b9d774ae
--- /dev/null
+++ b/tests/tcg/aarch64/gdbstub/test-sme.py
@@ -0,0 +1,119 @@
+from __future__ import print_function
+#
+# Test the SME registers are visible and changeable via gdbstub
+#
+# This is launched via tests/guest-debug/run-test.py
+#
+
+import argparse
+import gdb
+from test_gdbstub import main, report
+
+MAGIC = 0x01020304
+
+def run_test():
+ "Run through the tests one by one"
+
+ frame = gdb.selected_frame()
+ rname = "za"
+ za = frame.read_register(rname)
+ report(True, "Reading %s" % rname)
+
+ for i in range(0, 16):
+ for j in range(0, 16):
+ cmd = "set $za[%d][%d] = 0x01" % (i, j)
+ gdb.execute(cmd)
+ report(True, "%s" % cmd)
+ for i in range(0, 16):
+ for j in range(0, 16):
+ reg = "$za[%d][%d]" % (i, j)
+ v = gdb.parse_and_eval(reg)
+ report(str(v.type) == "uint8_t",
+ "size of %s" % (reg))
+ report(int(v) == 0x1, "%s is 0x%x" % (reg, 0x1))
+
+def run_test_slices():
+ "Run through the tests one by one"
+
+ frame = gdb.selected_frame()
+ rname = "za"
+ za = frame.read_register(rname)
+ report(True, "Reading %s" % rname)
+
+ for i in range(0, 16):
+ for j in range(0, 16):
+ cmd = "set $za[%d][%d] = 0x01" % (i, j)
+ gdb.execute(cmd)
+ report(True, "%s" % cmd)
+ for i in range(0, 16):
+ for j in range(0, 16):
+ reg = "$za[%d][%d]" % (i, j)
+ v = gdb.parse_and_eval(reg)
+ report(str(v.type) == "uint8_t",
+ "size of %s" % (reg))
+ report(int(v) == 0x1, "%s is 0x%x" % (reg, 0x1))
+
+ for i in range(0, 4):
+ for j in range(0, 4):
+ for k in range(0, 4):
+ cmd = "set $za%dhq%d[%d] = 0x%x" % (i, j, k, MAGIC)
+ gdb.execute(cmd)
+ report(True, "%s" % cmd)
+ for j in range(0, 4):
+ for k in range(0, 4):
+ reg = "$za%dhq%d[%d]" % (i, j, k)
+ v = gdb.parse_and_eval(reg)
+ report(str(v.type) == "uint128_t",
+ "size of %s" % (reg))
+ report(int(v) == MAGIC, "%s is 0x%x" % (reg, MAGIC))
+
+ for j in range(0, 4):
+ for k in range(0, 4):
+ cmd = "set $za%dvq%d[%d] = 0x%x" % (i, j, k, MAGIC)
+ gdb.execute(cmd)
+ report(True, "%s" % cmd)
+ for j in range(0, 4):
+ for k in range(0, 4):
+ reg = "$za%dvq%d[%d]" % (i, j, k)
+ v = gdb.parse_and_eval(reg)
+ report(str(v.type) == "uint128_t",
+ "size of %s" % (reg))
+ report(int(v) == MAGIC, "%s is 0x%x" % (reg, MAGIC))
+
+ for i in range(0, 4):
+ for j in range(0, 4):
+ for k in range(0, 4):
+ cmd = "set $za%dhd%d[%d] = 0x%x" % (i, j, k, MAGIC)
+ gdb.execute(cmd)
+ report(True, "%s" % cmd)
+ for j in range(0, 4):
+ for k in range(0, 4):
+ reg = "$za%dhd%d[%d]" % (i, j, k)
+ v = gdb.parse_and_eval(reg)
+ report(str(v.type) == "uint64_t",
+ "size of %s" % (reg))
+ report(int(v) == MAGIC, "%s is 0x%x" % (reg, MAGIC))
+
+ for j in range(0, 4):
+ for k in range(0, 4):
+ cmd = "set $za%dvd%d[%d] = 0x%x" % (i, j, k, MAGIC)
+ gdb.execute(cmd)
+ report(True, "%s" % cmd)
+ for j in range(0, 4):
+ for k in range(0, 4):
+ reg = "$za%dvd%d[%d]" % (i, j, k)
+ v = gdb.parse_and_eval(reg)
+ report(str(v.type) == "uint64_t",
+ "size of %s" % (reg))
+ report(int(v) == MAGIC, "%s is 0x%x" % (reg, MAGIC))
+
+
+parser = argparse.ArgumentParser(description="A gdbstub test for SME support")
+parser.add_argument("--gdb_sme_tile_support", help="GDB support for SME tiles", \
+ action="store_true")
+args = parser.parse_args()
+
+if args.gdb_sme_tile_support:
+ main(run_test_slices, expected_arch="aarch64")
+else:
+ main(run_test, expected_arch="aarch64")
\ No newline at end of file
--
2.34.1
On Mon, 11 Aug 2025 at 20:37, Vacha Bhavsar <vacha.bhavsar@oss.qualcomm.com> wrote: > > This patch adds a test case to test SME register exposure to > a remote gdb debugging session. This test simply sets and > reads SME registers. > > Signed-off-by: Vacha Bhavsar <vacha.bhavsar@oss.qualcomm.com> > --- > Changes since v4: > - this patch was not present in v4, it was added based on > suggestions during the review of v4 > --- > configure | 6 ++ > tests/tcg/aarch64/Makefile.target | 23 ++++- > tests/tcg/aarch64/gdbstub/test-sme.py | 119 ++++++++++++++++++++++++++ > 3 files changed, 147 insertions(+), 1 deletion(-) > create mode 100644 tests/tcg/aarch64/gdbstub/test-sme.py This test fails for me: timeout -s KILL --foreground 120 /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/tests/guest-debug/run-test.py --gdb /usr/bin/gdb-multiarch --qemu /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-clang/qemu-aarch64 --qargs "" --bin sysregs --test /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/tests/tcg/aarch64/gdbstub/test-sme.py -- test_sme --gdb_sme_tile_support > run-gdbstub-sysregs-sme.out warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead. Python Exception <class 'gdb.error'>: That operation is not available on integers of more than 8 bytes. Error occurred in Python: That operation is not available on integers of more than 8 bytes. qemu-aarch64: QEMU: Terminated via GDBstub The gdb is: GNU gdb (Ubuntu 15.0.50.20240403-0ubuntu1) 15.0.50.20240403-git > diff --git a/tests/tcg/aarch64/gdbstub/test-sme.py b/tests/tcg/aarch64/gdbstub/test-sme.py > new file mode 100644 > index 0000000000..c2b9d774ae > --- /dev/null > +++ b/tests/tcg/aarch64/gdbstub/test-sme.py > @@ -0,0 +1,119 @@ > +from __future__ import print_function Alex, do we still need this line in the gdbstub test cases? We can probably assume that the gdb's python is python 3 by now, I hope... > +# > +# Test the SME registers are visible and changeable via gdbstub > +# > +# This is launched via tests/guest-debug/run-test.py > +# All new files must have an SPDX line saying what the license is. You may also wish to add a Copyright line; that's up to you/your employer. > +if args.gdb_sme_tile_support: > + main(run_test_slices, expected_arch="aarch64") > +else: > + main(run_test, expected_arch="aarch64") > \ No newline at end of file Please add the trailing newline. thanks -- PMM
Hi, We have tried to replicate this issue on our end and it seems to stem from the int casting of gdb.Value type of a 128bit integer. We have run the test with different host architectures, gdb versions and python versions both with and without the int casting. The results are as follows. gdb gdb target python host int cast status version support version architecture 16.3 --enable-targets=all 3.11.13 x86 yes pass 16.3 --enable-targets=all 3.11.13 x86 no pass 16.3 --enable-targets=all 3.10.18 x86 yes pass 16.3 --enable-targets=all 3.10.18 x86 no pass 16.3 --enable-targets=all 3.8.10 x86 yes pass 16.3 --enable-targets=all 3.8.10 x86 no pass 16.3 aarch64 3.11.0rc1 aarch64 yes pass 16.3 aarch64 3.11.0rc1 aarch64 no pass 16.3 aarch64 3.10.12 aarch64 yes pass 16.3 aarch64 3.10.12 aarch64 no pass 15.0 multiarch 3.10.12 aarch64 yes fail 15.0 multiarch 3.10.12 aarch64 no pass 15.0 multiarch 3.11.0rc1 aarch64 yes fail 15.0 multiarch 3.11.0rc1 aarch64 no pass 15.0 multiarch 3.8.10 x86 yes fail 15.0 multiarch 3.8.10 x86 no pass 15.0 multiarch 3.11.13 x86 yes fail 15.0 multiarch 3.11.13 x86 no pass 15.0 multiarch 3.10.18 x86 yes fail 15.0 multiarch 3.10.18 x86 no pass Could we get some more information about your testing environment? Thanks, Vacha On Tue, Aug 19, 2025 at 5:13 AM Peter Maydell <peter.maydell@linaro.org> wrote: > On Mon, 11 Aug 2025 at 20:37, Vacha Bhavsar > <vacha.bhavsar@oss.qualcomm.com> wrote: > > > > This patch adds a test case to test SME register exposure to > > a remote gdb debugging session. This test simply sets and > > reads SME registers. > > > > Signed-off-by: Vacha Bhavsar <vacha.bhavsar@oss.qualcomm.com> > > --- > > Changes since v4: > > - this patch was not present in v4, it was added based on > > suggestions during the review of v4 > > --- > > configure | 6 ++ > > tests/tcg/aarch64/Makefile.target | 23 ++++- > > tests/tcg/aarch64/gdbstub/test-sme.py | 119 ++++++++++++++++++++++++++ > > 3 files changed, 147 insertions(+), 1 deletion(-) > > create mode 100644 tests/tcg/aarch64/gdbstub/test-sme.py > > This test fails for me: > > timeout -s KILL --foreground 120 > /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/tests/guest-debug/run-test.py > --gdb /usr/bin/gdb-multiarch --qemu > /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-clang/qemu-aarch64 > --qargs "" --bin sysregs --test > > /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/tests/tcg/aarch64/gdbstub/test-sme.py > -- test_sme --gdb_sme_tile_support > run-gdbstub-sysregs-sme.out > warning: File transfers from remote targets can be slow. Use "set > sysroot" to access files locally instead. > Python Exception <class 'gdb.error'>: That operation is not available > on integers of more than 8 bytes. > Error occurred in Python: That operation is not available on integers > of more than 8 bytes. > qemu-aarch64: QEMU: Terminated via GDBstub > > The gdb is: > GNU gdb (Ubuntu 15.0.50.20240403-0ubuntu1) 15.0.50.20240403-git > > > diff --git a/tests/tcg/aarch64/gdbstub/test-sme.py > b/tests/tcg/aarch64/gdbstub/test-sme.py > > new file mode 100644 > > index 0000000000..c2b9d774ae > > --- /dev/null > > +++ b/tests/tcg/aarch64/gdbstub/test-sme.py > > @@ -0,0 +1,119 @@ > > +from __future__ import print_function > > Alex, do we still need this line in the gdbstub test cases? > We can probably assume that the gdb's python is python 3 > by now, I hope... > > > +# > > +# Test the SME registers are visible and changeable via gdbstub > > +# > > +# This is launched via tests/guest-debug/run-test.py > > +# > > All new files must have an SPDX line saying what the > license is. You may also wish to add a Copyright line; > that's up to you/your employer. > > > > +if args.gdb_sme_tile_support: > > + main(run_test_slices, expected_arch="aarch64") > > +else: > > + main(run_test, expected_arch="aarch64") > > \ No newline at end of file > > Please add the trailing newline. > > thanks > -- PMM >
On Fri, 22 Aug 2025 at 18:32, Vacha Bhavsar <vacha.bhavsar@oss.qualcomm.com> wrote: > > Hi, > > We have tried to replicate this issue on our end and it > seems to stem from the int casting of gdb.Value type of > a 128bit integer. We have run the test with different > host architectures, gdb versions and python versions > both with and without the int casting. The results are > as follows. > > gdb gdb target python host int cast status > version support version architecture > 16.3 --enable-targets=all 3.11.13 x86 yes pass > 16.3 --enable-targets=all 3.11.13 x86 no pass > 16.3 --enable-targets=all 3.10.18 x86 yes pass > 16.3 --enable-targets=all 3.10.18 x86 no pass > 16.3 --enable-targets=all 3.8.10 x86 yes pass > 16.3 --enable-targets=all 3.8.10 x86 no pass > > 16.3 aarch64 3.11.0rc1 aarch64 yes pass > 16.3 aarch64 3.11.0rc1 aarch64 no pass > 16.3 aarch64 3.10.12 aarch64 yes pass > 16.3 aarch64 3.10.12 aarch64 no pass > > 15.0 multiarch 3.10.12 aarch64 yes fail > 15.0 multiarch 3.10.12 aarch64 no pass > 15.0 multiarch 3.11.0rc1 aarch64 yes fail > 15.0 multiarch 3.11.0rc1 aarch64 no pass > > 15.0 multiarch 3.8.10 x86 yes fail > 15.0 multiarch 3.8.10 x86 no pass > 15.0 multiarch 3.11.13 x86 yes fail > 15.0 multiarch 3.11.13 x86 no pass > 15.0 multiarch 3.10.18 x86 yes fail > 15.0 multiarch 3.10.18 x86 no pass > > Could we get some more information about your testing environment? It's just stock Ubuntu 24.04.3 LTS on x86-64; gdb is gdb-multiarch GNU gdb (Ubuntu 15.0.50.20240403-0ubuntu1) 15.0.50.20240403-git -- PMM
Hi, It seems the test fails specifically for that version of gdb (15.0.50.20240403-git) when a gdb.Value object which is an integer of more than 8 bytes is cast to an int. This is the case when we test reading the za quadwords. To address this we have edited the test such that the int cast is not used for the za quadwords when this specific version of gdb is detected. In this case, the test is performed without int casting (which still passes). To declare this to users, we have added a warning message to be printed in this scenario above the test results in the output file run-gdbstub-sysregs-sme.out. I have sent a new version of the patch series with these changes, as well as the added spdx/copyright lines. Please let us know what you think of this approach! Thanks, Vacha On Sat, Aug 23, 2025 at 2:13 PM Peter Maydell <peter.maydell@linaro.org> wrote: > On Fri, 22 Aug 2025 at 18:32, Vacha Bhavsar > <vacha.bhavsar@oss.qualcomm.com> wrote: > > > > Hi, > > > > We have tried to replicate this issue on our end and it > > seems to stem from the int casting of gdb.Value type of > > a 128bit integer. We have run the test with different > > host architectures, gdb versions and python versions > > both with and without the int casting. The results are > > as follows. > > > > gdb gdb target python host int cast status > > version support version architecture > > 16.3 --enable-targets=all 3.11.13 x86 yes pass > > 16.3 --enable-targets=all 3.11.13 x86 no pass > > 16.3 --enable-targets=all 3.10.18 x86 yes pass > > 16.3 --enable-targets=all 3.10.18 x86 no pass > > 16.3 --enable-targets=all 3.8.10 x86 yes pass > > 16.3 --enable-targets=all 3.8.10 x86 no pass > > > > 16.3 aarch64 3.11.0rc1 aarch64 yes pass > > 16.3 aarch64 3.11.0rc1 aarch64 no pass > > 16.3 aarch64 3.10.12 aarch64 yes pass > > 16.3 aarch64 3.10.12 aarch64 no pass > > > > 15.0 multiarch 3.10.12 aarch64 yes fail > > 15.0 multiarch 3.10.12 aarch64 no pass > > 15.0 multiarch 3.11.0rc1 aarch64 yes fail > > 15.0 multiarch 3.11.0rc1 aarch64 no pass > > > > 15.0 multiarch 3.8.10 x86 yes fail > > 15.0 multiarch 3.8.10 x86 no pass > > 15.0 multiarch 3.11.13 x86 yes fail > > 15.0 multiarch 3.11.13 x86 no pass > > 15.0 multiarch 3.10.18 x86 yes fail > > 15.0 multiarch 3.10.18 x86 no pass > > > > Could we get some more information about your testing environment? > > It's just stock Ubuntu 24.04.3 LTS on x86-64; gdb is gdb-multiarch > GNU gdb (Ubuntu 15.0.50.20240403-0ubuntu1) 15.0.50.20240403-git > > -- PMM >
© 2016 - 2026 Red Hat, Inc.