target/arm: Support SME2 in gdbstub
cover target/arm: Support SME2 in gdbstub
This patchseries adds SME2 support to the gdbstub. This is fairly straightforward as the only thing we need to do is expose the new ZT0 register in the XML in the way that gdb documents that we should.
Patch 2 is a simple "check reads and writes" test case along the lines of our existing SME tests. I don't think there are any specific gdb version requirements here because the XML should be enough for gdb to know it's a 64 byte vector. (I also did a little manual testing with a program that reads and writes the ZT0 value in guest code to confirm that gdb interactions do the right thing.)
thanks
-- PMM
Peter Maydell (2):
target/arm: Implement SME2 support in gdbstub tests/tcg/aarch64: Add test case for SME2 gdbstub registers
target/arm/cpu.h | 1 + target/arm/internals.h | 3 + target/arm/gdbstub.c | 7 +++ target/arm/gdbstub64.c | 76 ++++++++++++++++++++++++++ tests/tcg/aarch64/Makefile.target | 9 ++- tests/tcg/aarch64/gdbstub/test-sme2.py | 41 ++++++++++++++ 6 files changed, 136 insertions(+), 1 deletion(-) create mode 100644 tests/tcg/aarch64/gdbstub/test-sme2.py
Signature · 1 line
2.43.0
PATCH 1/2 target/arm: Implement SME2 support in gdbstub
For SME2, we need to expose the new ZT0 register in the gdbstub XML. gdb documents that the requirements are:
Quoted 7 lines
The ‘org.gnu.gdb.aarch64.sme2’ feature is optional. If present, then the ‘org.gnu.gdb.aarch64.sme’ feature must also be present. The ‘org.gnu.gdb.aarch64.sme2’ feature should contain the following:
- ZT0 is a register of 512 bits (64 bytes). It is defined as a vector of bytes.
Implement this.
--- target/arm/cpu.h | 1 + target/arm/internals.h | 3 ++ target/arm/gdbstub.c | 7 ++++ target/arm/gdbstub64.c | 76 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 87 insertions(+)
target/arm/cpu.h +1 -0
@@ -939,6 +939,7 @@ struct ArchCPU {DynamicGDBFeatureInfo dyn_sysreg_feature;DynamicGDBFeatureInfo dyn_svereg_feature;DynamicGDBFeatureInfo dyn_smereg_feature; +DynamicGDBFeatureInfo dyn_sme2reg_feature;DynamicGDBFeatureInfo dyn_m_systemreg_feature;DynamicGDBFeatureInfo dyn_m_secextreg_feature;
target/arm/internals.h +3 -0
@@ -1715,10 +1715,13 @@ static inline uint64_t pmu_counter_mask(CPUARMState *env)GDBFeature *arm_gen_dynamic_svereg_feature (CPUState *cpu,int base_reg);GDBFeature *arm_gen_dynamic_smereg_feature (CPUState *cpu,int base_reg); +GDBFeature *arm_gen_dynamic_sme2reg_feature (CPUState *cpu,int base_reg);int aarch64_gdb_get_sve_reg (CPUState *cs,GByteArray *buf,int reg);int aarch64_gdb_set_sve_reg (CPUState *cs,uint8_t *buf,int reg);int aarch64_gdb_get_sme_reg (CPUState *cs,GByteArray *buf,int reg);int aarch64_gdb_set_sme_reg (CPUState *cs,uint8_t *buf,int reg); +int aarch64_gdb_get_sme2_reg (CPUState *cs,GByteArray *buf,int reg); +int aarch64_gdb_set_sme2_reg (CPUState *cs,uint8_t *buf,int reg);int aarch64_gdb_get_fpu_reg (CPUState *cs,GByteArray *buf,int reg);int aarch64_gdb_set_fpu_reg (CPUState *cs,uint8_t *buf,int reg);int aarch64_gdb_get_pauth_reg (CPUState *cs,GByteArray *buf,int reg);
target/arm/gdbstub.c +7 -0
@@ -554,6 +554,13 @@ void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu)arm_gen_dynamic_smereg_feature (cs, cs->gdb_num_regs);gdb_register_coprocessor (cs, aarch64_gdb_get_sme_reg, aarch64_gdb_set_sme_reg, sme_feature,0 ); +if (isar_feature_aa64_sme2 (&cpu->isar)) { +GDBFeature *sme2_feature = +arm_gen_dynamic_sme2reg_feature (cs, cs->gdb_num_regs); +gdb_register_coprocessor (cs, aarch64_gdb_get_sme2_reg, + aarch64_gdb_set_sme2_reg, + sme2_feature,0 ); + } }/* * Note that we report pauth information via the feature name
target/arm/gdbstub64.c +76 -0
88 lines not on this page · raw message
Signature · 1 line
2.43.0
Re: [PATCH 1/2] target/arm: Implement SME2 support in gdbstub
Quoted 8 lines · Peter Maydell
For SME2, we need to expose the new ZT0 register in the gdbstub XML. gdb documents that the requirements are:
Quoted 5 lines
The ‘org.gnu.gdb.aarch64.sme2’ feature is optional. If present, then the ‘org.gnu.gdb.aarch64.sme’ feature must also be present. The ‘org.gnu.gdb.aarch64.sme2’ feature should contain the following:
Quoted 6 lines
Quoted 2 lines
- ZT0 is a register of 512 bits (64 bytes). It is defined as a vector of bytes.
Implement this.
Signed-off-by Peter Maydell <[email protected]>
The size of ZT0 is fixed at 512 bits.
There's no need for the xml to be dynamically generated.
r~
Re: [PATCH 1/2] target/arm: Implement SME2 support in gdbstub
Quoted 13 lines · Richard Henderson
Quoted 11 lines · Peter Maydell
For SME2, we need to expose the new ZT0 register in the gdbstub XML. gdb documents that the requirements are:
Quoted 7 lines
The ‘org.gnu.gdb.aarch64.sme2’ feature is optional. If present, then the ‘org.gnu.gdb.aarch64.sme’ feature must also be present. The ‘org.gnu.gdb.aarch64.sme2’ feature should contain the following:
- ZT0 is a register of 512 bits (64 bytes). It is defined as a vector of bytes.
Quoted 6 lines
Quoted 3 lines
Implement this.
Signed-off-by Peter Maydell <[email protected]>The size of ZT0 is fixed at 512 bits.
There's no need for the xml to be dynamically generated.
I suppose not. GDB upstream dynamically generates the XML, though, so there's no upstream XML file for us to use.
-- PMM
PATCH 2/2 tests/tcg/aarch64: Add test case for SME2 gdbstub registers
In reply to Peter MaydellTest the SME2 register exposure over gdbstub, in the same way we already do for SME.
--- tests/tcg/aarch64/Makefile.target | 9 +++++- tests/tcg/aarch64/gdbstub/test-sme2.py | 41 ++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 tests/tcg/aarch64/gdbstub/test-sme2.py
tests/tcg/aarch64/Makefile.target +8 -1
@@ -164,7 +164,14 @@ run-gdbstub-sysregs-sme-tile-slice: sysregs "selected gdb ($(GDB)) does not support SME ZA tile slices") endif -EXTRA_RUNS += run-gdbstub-sysregs-sme run-gdbstub-sysregs-sme-tile-slice +run-gdbstub-sysregs-sme2: sysregs + $(call run-test, $@, $(GDB_SCRIPT) \ + --gdb $(GDB) \ + --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ + --bin $< --test $(AARCH64_SRC)/gdbstub/test-sme2.py, \ + gdbstub SME ZA tile slice support) + +EXTRA_RUNS += run-gdbstub-sysregs-sme run-gdbstub-sysregs-sme-tile-slice run-gdbstub-sysregs-sme2 endif
tests/tcg/aarch64/gdbstub/test-sme2.py new file +41 -0
41 lines not on this page · raw message
Signature · 1 line
2.43.0
Re: [PATCH 2/2] tests/tcg/aarch64: Add test case for SME2 gdbstub registers
Quoted 9 lines · Peter Maydell
Test the SME2 register exposure over gdbstub, in the same way we already do for SME.
Signed-off-by Peter Maydell<[email protected]>--- tests/tcg/aarch64/Makefile.target | 9 +++++- tests/tcg/aarch64/gdbstub/test-sme2.py | 41 ++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-)create mode 100644
tests/tcg/aarch64/gdbstub/test-sme2.py
r~
Re: [PATCH 2/2] tests/tcg/aarch64: Add test case for SME2 gdbstub registers
In reply to Peter MaydellQuoted 37 lines · Peter Maydell
Test the SME2 register exposure over gdbstub, in the same way we already do for SME.
Signed-off-by Peter Maydell <[email protected]>--- tests/tcg/aarch64/Makefile.target | 9 +++++- tests/tcg/aarch64/gdbstub/test-sme2.py | 41 ++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 tests/tcg/aarch64/gdbstub/test-sme2.pytests/tcg/aarch64/Makefile.target +8
-1@@ -164,7 +164,14 @@ run-gdbstub-sysregs-sme-tile-slice: sysregs "selected gdb ($(GDB)) does not support SME ZA tile slices") endif -EXTRA_RUNS += run-gdbstub-sysregs-sme run-gdbstub-sysregs-sme-tile-slice +run-gdbstub-sysregs-sme2: sysregs + $(call run-test, $@, $(GDB_SCRIPT) \ + --gdb $(GDB) \ + --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ + --bin $< --test $(AARCH64_SRC)/gdbstub/test-sme2.py, \ + gdbstub SME ZA tile slice support) + +EXTRA_RUNS += run-gdbstub-sysregs-sme run-gdbstub-sysregs-sme-tile-slice run-gdbstub-sysregs-sme2 endiftests/tcg/aarch64/gdbstub/test-sme2.py new file +0
-0
tests/tcg/aarch64/gdbstub/test-sme2.py line 2
Quoted 2 lines
tests/tcg/aarch64/gdbstub/test-sme2.py new file +2
-0@@ -0,0 +1,41 @@ +# +# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
This is obviously wrong -- I used the SME test case as an initial template, but forgot to edit the copyright line :-/
Will fix in v2.
Quoted 6 lines
tests/tcg/aarch64/gdbstub/test-sme2.py new file +6
-0+# +# SPDX-License-Identifier: GPL-2.0-or-later + +# +# Test the SME registers are visible and changeable via gdbstub +#
tests/tcg/aarch64/gdbstub/test-sme2.py line 18
Quoted 10 lines
tests/tcg/aarch64/gdbstub/test-sme2.py new file +10
-0+# This is launched via tests/guest-debug/run-test.py +# + +import argparse +import gdb +from test_gdbstub import main, report + +MAGIC = 0x01020304 +BASIC_ZA_TEST = 0 +TILE_SLICE_TEST = 0
These constants and the argparse import aren't needed for this simple test case.
-- PMM
Quoted 4 lines · Peter Maydell
This patchseries adds SME2 support to the gdbstub. This is fairly straightforward as the only thing we need to do is expose the new ZT0 register in the XML in the way that gdb documents that we should.
We're also missing TPIDR2.
According to gdb/features/aarch64-tls.c, "org.gnu.gdb.aarch64.tls" should contain 2 registers, tpidr and tpidr2. Apparently the second is optional, and we should have been providing the "tls" with just tpidr all along.
r~