[PATCH v4 0/5] gdbstub: Add support for MTE in system mode

Gustavo Romero posted 5 patches 2 months, 2 weeks ago
configure                                 |   5 +
target/arm/gdbstub64.c                    |  21 +++--
tests/guest-debug/run-test.py             |   6 ++
tests/guest-debug/test_gdbstub.py         |   5 +
tests/tcg/aarch64/Makefile.softmmu-target |  49 +++++++++-
tests/tcg/aarch64/Makefile.target         |   3 +-
tests/tcg/aarch64/gdbstub/test-mte.py     |  71 +++++++++-----
tests/tcg/aarch64/system/boot.S           |  11 +++
tests/tcg/aarch64/system/kernel.ld        |  33 ++++---
tests/tcg/aarch64/system/mte.S            | 109 ++++++++++++++++++++++
10 files changed, 266 insertions(+), 47 deletions(-)
create mode 100644 tests/tcg/aarch64/system/mte.S
[PATCH v4 0/5] gdbstub: Add support for MTE in system mode
Posted by Gustavo Romero 2 months, 2 weeks ago
This patchset makes handle_q_memtag, handle_q_isaddresstagged, and
handle_Q_memtag stubs build for system mode, allowing all GDB
'memory-tag' subcommands to work with QEMU gdbstub on aarch64 system
mode, resolving:

https://gitlab.com/qemu-project/qemu/-/issues/620

For running the tests, a GDB that supports MTE for baremetal targets is
necessary. This support has just landed GDB's master branch.

GDB can be built and installed into a /tmp directory in a simple way:
after cloning GDB's master branch, inside a build directory, configure
GDB and build it:

 $ git clone --depth 1 https://sourceware.org/git/binutils-gdb.git --branch master gdb_master && cd gdb_master
 $ mkdir build && cd build
 $ ../configure --disable-binutils --disable-ld --disable-gold --disable-gas --disable-sim --disable-gprof --disable-gprofng --with-python=python3 --enable-libctf --enable-unit-tests --prefix=/tmp/gdb --with-additional-debug-dirs=/usr/lib/debug --enable-targets=all
 $ make -j 32
 $ make install

Configure QEMU, specifying where GDB is installed. For example:

 $ cd build
 $ ../configure --target-list=aarch64-linux-user,aarch64-softmmu --disable-docs --gdb=/tmp/gdb/bin/gdb
 $ make -j 32
 $ cd..

And finally run the MTE gdbstub tests for QEMU system mode:

 $ make -C build -j 32 run-tcg-tests-aarch64-softmmu

v2:
 - Use of cpu_mmu_index() instead of arm_mmu_idx() (Richard's review)
 - Converted mte.c test to mte.S
 - Set tcr_el1, mair_el1, and sctlr_el1 in mte.S instead of in boot.S
   (Richard's review) 
 - Allowed use of argparse in test scripts to get passed arguments from
   run-test.py (Alex's review)
 - Fixed test output to be stored in run-gdbstub-mte.out instead of
   printed to stdout
 - Added detection of GDB supporting MTE in baremetal
 
v3:
 - No need of ARM_MMU_IDX_COREIDX_MASK with cpu_mmu_index()
   (Richard's review)
 - Define a symbol for mte_page instead of a whole section
   (Richard's review)

v4:
 - Better representation for MiB using M suffix in linker script
   (Phil's review)
 - Improve linker script organization (Richard's review)


Cheers,
Gustavo

Gustavo Romero (5):
  gdbstub: Use specific MMU index when probing MTE addresses
  gdbstub: Add support for MTE in system mode
  tests/guest-debug: Support passing arguments to the GDB test script
  tests/tcg/aarch64: Improve linker script organization
  tests/tcg/aarch64: Extend MTE gdbstub tests to system mode

 configure                                 |   5 +
 target/arm/gdbstub64.c                    |  21 +++--
 tests/guest-debug/run-test.py             |   6 ++
 tests/guest-debug/test_gdbstub.py         |   5 +
 tests/tcg/aarch64/Makefile.softmmu-target |  49 +++++++++-
 tests/tcg/aarch64/Makefile.target         |   3 +-
 tests/tcg/aarch64/gdbstub/test-mte.py     |  71 +++++++++-----
 tests/tcg/aarch64/system/boot.S           |  11 +++
 tests/tcg/aarch64/system/kernel.ld        |  33 ++++---
 tests/tcg/aarch64/system/mte.S            | 109 ++++++++++++++++++++++
 10 files changed, 266 insertions(+), 47 deletions(-)
 create mode 100644 tests/tcg/aarch64/system/mte.S

-- 
2.34.1
Re: [PATCH v4 0/5] gdbstub: Add support for MTE in system mode
Posted by Alex Bennée 2 months, 2 weeks ago
Gustavo Romero <gustavo.romero@linaro.org> writes:

> This patchset makes handle_q_memtag, handle_q_isaddresstagged, and
> handle_Q_memtag stubs build for system mode, allowing all GDB
> 'memory-tag' subcommands to work with QEMU gdbstub on aarch64 system
> mode, resolving:
>
> https://gitlab.com/qemu-project/qemu/-/issues/620

Queued to gdbstub/next, thanks.

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro