public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2 00/17] SME support for AArch64 gdb/gdbserver on Linux
@ 2023-05-19 10:24 Luis Machado
  2023-05-19 10:24 ` [PATCH v2 01/17] [gdb/aarch64] Fix register fetch/store order for native AArch64 Linux Luis Machado
                   ` (16 more replies)
  0 siblings, 17 replies; 27+ messages in thread
From: Luis Machado @ 2023-05-19 10:24 UTC (permalink / raw)
  To: gdb-patches

The following series enables SME 1 (Scalable Matrix Extension) support for
AArch64 gdb and gdbserver.

SME expands on SVE by having a variable-sized matrix (ZA) of dimensions
SVL x SVL bytes.

The first few patches and some intermediate ones refactor the code and fix
issues prior to enabling SME support, and thus could go in independently.

I've kept them in the series as they are closely/logically related.

Ezra Sitorus (1):
  [binutils/aarch64] sme: Core file support

Luis Machado (16):
  [gdb/aarch64] Fix register fetch/store order for native AArch64 Linux
  [gdb/aarch64] refactor: Rename SVE-specific files
  [gdb/gdbserver] refactor: Simplify SVE interface to read/write
    registers
  [gdb/aarch64] sve: Fix return command when using V registers in a
    SVE-enabled target
  [gdb/aarch64] sme: Enable SME registers and pseudo-registers
  [gdbserver/aarch64] refactor: Adjust expedited registers dynamically
  [gdbserver/aarch64] sme: Add support for SME
  [gdb/aarch64] sve: Fix signal frame z/v register restore
  [gdb/aarch64] sme: Signal frame support
  [gdb/aarch64] sme: Fixup sigframe gdbarch when vg/svg changes
  [gdb/aarch64] sme: Support TPIDR2 signal frame context
  [gdb/generic] corefile/bug: Use thread-specific gdbarch when dumping
    register state to core files
  [gdb/generic] corefile/bug: Fixup (gcore) core file target description
    reading order
  [gdb/aarch64] sme: Core file support for Linux
  [gdb/testsuite] sme: Add SVE/SME testcases
  [gdb/docs] sme: Document SME registers and features

 bfd/elf-bfd.h                                 |   4 +
 bfd/elf.c                                     |  58 +
 gdb/Makefile.in                               |   6 +-
 gdb/NEWS                                      |  11 +
 gdb/aarch64-linux-nat.c                       | 179 ++--
 gdb/aarch64-linux-tdep.c                      | 951 ++++++++++++++---
 gdb/aarch64-tdep.c                            | 724 ++++++++++++-
 gdb/aarch64-tdep.h                            |  47 +
 gdb/arch/aarch64-scalable-linux.c             |  55 +
 gdb/arch/aarch64-scalable-linux.h             |  53 +
 gdb/arch/aarch64.c                            |   5 +
 gdb/arch/aarch64.h                            |  57 +-
 gdb/configure.nat                             |   2 +-
 gdb/configure.tgt                             |   1 +
 gdb/corelow.c                                 |  24 +-
 gdb/doc/gdb.texinfo                           | 249 +++++
 gdb/features/aarch64-sme.c                    |  63 ++
 gdb/linux-tdep.c                              |  18 +-
 gdb/nat/aarch64-scalable-linux-ptrace.c       | 993 ++++++++++++++++++
 gdb/nat/aarch64-scalable-linux-ptrace.h       | 156 +++
 ....h => aarch64-scalable-linux-sigcontext.h} |  73 +-
 gdb/nat/aarch64-sve-linux-ptrace.c            | 392 -------
 gdb/nat/aarch64-sve-linux-ptrace.h            |  72 --
 gdb/testsuite/gdb.arch/aarch64-sme-core-0.exp |  18 +
 gdb/testsuite/gdb.arch/aarch64-sme-core-1.exp |  18 +
 gdb/testsuite/gdb.arch/aarch64-sme-core-2.exp |  18 +
 gdb/testsuite/gdb.arch/aarch64-sme-core-3.exp |  18 +
 gdb/testsuite/gdb.arch/aarch64-sme-core-4.exp |  18 +
 gdb/testsuite/gdb.arch/aarch64-sme-core.c     | 361 +++++++
 .../gdb.arch/aarch64-sme-core.exp.tcl         | 167 +++
 .../gdb.arch/aarch64-sme-regs-available-0.exp |  18 +
 .../gdb.arch/aarch64-sme-regs-available-1.exp |  18 +
 .../gdb.arch/aarch64-sme-regs-available-2.exp |  18 +
 .../gdb.arch/aarch64-sme-regs-available-3.exp |  18 +
 .../gdb.arch/aarch64-sme-regs-available-4.exp |  18 +
 .../gdb.arch/aarch64-sme-regs-available.c     | 184 ++++
 .../aarch64-sme-regs-available.exp.tcl        | 194 ++++
 .../gdb.arch/aarch64-sme-regs-sigframe-0.exp  |  18 +
 .../gdb.arch/aarch64-sme-regs-sigframe-1.exp  |  18 +
 .../gdb.arch/aarch64-sme-regs-sigframe-2.exp  |  18 +
 .../gdb.arch/aarch64-sme-regs-sigframe-3.exp  |  18 +
 .../gdb.arch/aarch64-sme-regs-sigframe-4.exp  |  18 +
 .../gdb.arch/aarch64-sme-regs-sigframe.c      | 368 +++++++
 .../aarch64-sme-regs-sigframe.exp.tcl         | 156 +++
 .../aarch64-sme-regs-unavailable-0.exp        |  18 +
 .../aarch64-sme-regs-unavailable-1.exp        |  18 +
 .../aarch64-sme-regs-unavailable-2.exp        |  18 +
 .../aarch64-sme-regs-unavailable-3.exp        |  18 +
 .../aarch64-sme-regs-unavailable-4.exp        |  18 +
 .../gdb.arch/aarch64-sme-regs-unavailable.c   | 154 +++
 .../aarch64-sme-regs-unavailable.exp.tcl      | 162 +++
 gdb/testsuite/gdb.arch/aarch64-sme-sanity.c   | 249 +++++
 gdb/testsuite/gdb.arch/aarch64-sme-sanity.exp |  72 ++
 gdb/testsuite/lib/aarch64.exp                 | 372 +++++++
 gdb/testsuite/lib/gdb.exp                     |  63 ++
 gdb/tramp-frame.c                             |   1 +
 gdb/tramp-frame.h                             |  12 +
 gdbserver/Makefile.in                         |   2 +-
 gdbserver/configure.srv                       |   3 +-
 gdbserver/linux-aarch64-low.cc                | 100 +-
 gdbserver/linux-aarch64-tdesc.cc              |  28 +-
 gdbserver/server.h                            |   2 +-
 62 files changed, 6509 insertions(+), 694 deletions(-)
 create mode 100644 gdb/arch/aarch64-scalable-linux.c
 create mode 100644 gdb/arch/aarch64-scalable-linux.h
 create mode 100644 gdb/features/aarch64-sme.c
 create mode 100644 gdb/nat/aarch64-scalable-linux-ptrace.c
 create mode 100644 gdb/nat/aarch64-scalable-linux-ptrace.h
 rename gdb/nat/{aarch64-sve-linux-sigcontext.h => aarch64-scalable-linux-sigcontext.h} (78%)
 delete mode 100644 gdb/nat/aarch64-sve-linux-ptrace.c
 delete mode 100644 gdb/nat/aarch64-sve-linux-ptrace.h
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-sme-core-0.exp
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-sme-core-1.exp
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-sme-core-2.exp
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-sme-core-3.exp
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-sme-core-4.exp
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-sme-core.c
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-sme-core.exp.tcl
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-sme-regs-available-0.exp
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-sme-regs-available-1.exp
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-sme-regs-available-2.exp
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-sme-regs-available-3.exp
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-sme-regs-available-4.exp
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-sme-regs-available.c
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-sme-regs-available.exp.tcl
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe-0.exp
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe-1.exp
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe-2.exp
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe-3.exp
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe-4.exp
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe.c
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-sme-regs-sigframe.exp.tcl
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-0.exp
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-1.exp
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-2.exp
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-3.exp
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable-4.exp
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable.c
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-sme-regs-unavailable.exp.tcl
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-sme-sanity.c
 create mode 100644 gdb/testsuite/gdb.arch/aarch64-sme-sanity.exp
 create mode 100644 gdb/testsuite/lib/aarch64.exp

-- 
2.25.1


^ permalink raw reply	[flat|nested] 27+ messages in thread
* [PATCH 17/17] [gdb/docs] sme: Document SME registers and features
@ 2023-04-11  4:26 Luis Machado
  2023-04-17 17:19 ` [PATCH,v3 " Luis Machado
  0 siblings, 1 reply; 27+ messages in thread
From: Luis Machado @ 2023-04-11  4:26 UTC (permalink / raw)
  To: gdb-patches

Provide documentation for the SME feature and other information that
should be useful for users that need to debug a SME-capable target.
---
 gdb/NEWS            | 11 ++++++++
 gdb/doc/gdb.texinfo | 68 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 79 insertions(+)

diff --git a/gdb/NEWS b/gdb/NEWS
index 10a1a70fa52..48a82172f0e 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -3,6 +3,17 @@
 
 *** Changes since GDB 13
 
+* GDB now supports the AArch64 Scalable Matrix Extension (SME), which includes
+  a new matrix register named ZA, a new thread register TPIDR2 and a new vector
+  length register SVG (streaming vector granule).  GDB also supports tracking
+  ZA state across signal frames.  
+
+  Some features are still under development or are dependent on ABI specs that
+  are still in alpha stage.  For example, manual function calls with ZA state
+  don't have any special handling, and tracking of SVG changes based on
+  DWARF information is still not implemented, but there are plans to do so in
+  the future.
+
 * GDB now has some support for integer types larger than 64 bits.
 
 * Removed targets and native configurations
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 2d5358a792b..f84e05fbed2 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -26038,6 +26038,61 @@ but the lengths of the @code{z} and @code{p} registers will not change.  This
 is a known limitation of @value{GDBN} and does not affect the execution of the
 target process.
 
+@subsubsection AArch64 SME.
+@cindex AArch64 SME.
+
+When @value{GDBN} is debugging the AArch64 architecture, if the Scalable Matrix
+Extension (SME) is present, then @value{GDBN} will provide the @code{za}
+register.  @value{GDBN} will also provide the  @code{svg} pseudo register and
+the @code{svcr} pseudo register.
+
+The @code{za} register is a 2-dimensional vector of bytes with a size of svl
+x svl, where svl is the streaming vector length.
+
+The @code{svg} vector is the streaming vector granule for the current thread
+and represents the number of 64-bit chunks in one dimension of the @code{za}
+register.
+
+The @code{svcr} register (streaming vector control register) is a status
+register that holds two state bits: @code{SM} in bit 0 and @code{ZA} in bit 1.
+
+If the @code{SM} bit is 1, it means the current thread is in streaming
+mode, and the SVE registers will have their sizes based on the @code{svg}
+register.  If the @code{SM} bit is 0, the current thread is not in streaming
+mode, and the SVE registers have sizes based on the @code{vg} register.
+
+If the @code{ZA} bit is 1, it means the @code{ZA} state, and therefore the
+@code{za} register, is being used and has meaningful contents.  If the
+@code{ZA} bit is 0, the ZA state is unavailable and the contents of the
+@code{za} register are undefined.
+
+If the @code{ZA} state is 0, the @code{za} register and its pseudo registers
+will read as <unavailable>.
+
+If the streaming vector length changes, then the @code{svg} register will be
+updated,  as well as the @code{za} register.
+
+The possible values for @code{svg} are 2, 4, 8, 16, 32.  These numbers
+correspond to streaming vector length values of 16 bytes, 32 bytes, 64 bytes,
+128 bytes and 256 bytes.
+
+The minimum size of the @code{za} register is there 16 x 16 bytes, and the
+maximum size is 256 x 256 bytes.  The size of the @code{za} register is the
+size of all the SVE @code{z} registers combined.
+
+The @code{za} register can also be referenced using tiles and tile slices.
+
+There is a fixed number of @code{za} tile pseudo registers (32). They are:
+za0b, za0h, za1h, zas0, zas1, zas2, zas3, zad0, zad1, zad2, zad3, zad4, zad5.
+
+The tile slice pseudo registers are numerous.  For a minimum streaming vector
+length of 16 bytes, there are 5 x 32 pseudo registers.  For the maximum
+streaming vector length of 256 bytes, there are 5 x 512 pseudo registers.
+
+The tile slice pseudo registers have the following naming pattern:
+
+za<tile number><orientation><slice number>.
+
 @subsubsection AArch64 Pointer Authentication.
 @cindex AArch64 Pointer Authentication.
 @anchor{AArch64 PAC}
@@ -48030,6 +48085,19 @@ This restriction may be lifted in the future.
 Extra registers are allowed in this feature, but they will not affect
 @value{GDBN}.
 
+The @samp{org.gnu.gdb.aarch64.sme} feature is optional.  If present,
+it should contain registers @samp{za}, @samp{svg} and @samp{svcr}.
+
+@samp{za} is a vector of bytes of size svl x svl.  @samp{svg} is a 64-bit
+pseudo register containing the number of 64-bit chunks in svl.  @samp{svcr}
+is a 64-bit state register containing bits 0 (SM) and 1 (ZA).
+
+The rest of the unused bits of @samp{svcr} are undefined and reserved.  They
+should not be used and may be defined by future extensions of the architecture.
+
+Extra registers are allowed in this feature, but they will not affect
+@value{GDBN}.
+
 @node ARC Features
 @subsection ARC Features
 @cindex target descriptions, ARC Features
-- 
2.25.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2023-06-30 12:11 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-19 10:24 [PATCH v2 00/17] SME support for AArch64 gdb/gdbserver on Linux Luis Machado
2023-05-19 10:24 ` [PATCH v2 01/17] [gdb/aarch64] Fix register fetch/store order for native AArch64 Linux Luis Machado
2023-05-19 10:24 ` [PATCH v2 02/17] [gdb/aarch64] refactor: Rename SVE-specific files Luis Machado
2023-05-19 10:24 ` [PATCH v2 03/17] [gdb/gdbserver] refactor: Simplify SVE interface to read/write registers Luis Machado
2023-05-19 10:24 ` [PATCH v2 04/17] [gdb/aarch64] sve: Fix return command when using V registers in a SVE-enabled target Luis Machado
2023-05-19 10:24 ` [PATCH v2 05/17] [gdb/aarch64] sme: Enable SME registers and pseudo-registers Luis Machado
2023-05-19 10:24 ` [PATCH v2 06/17] [gdbserver/aarch64] refactor: Adjust expedited registers dynamically Luis Machado
2023-05-19 10:24 ` [PATCH v2 07/17] [gdbserver/aarch64] sme: Add support for SME Luis Machado
2023-05-19 10:24 ` [PATCH v2 08/17] [gdb/aarch64] sve: Fix signal frame z/v register restore Luis Machado
2023-05-19 10:25 ` [PATCH v2 09/17] [gdb/aarch64] sme: Signal frame support Luis Machado
2023-05-19 10:25 ` [PATCH v2 10/17] [gdb/aarch64] sme: Fixup sigframe gdbarch when vg/svg changes Luis Machado
2023-05-19 10:25 ` [PATCH v2 11/17] [gdb/aarch64] sme: Support TPIDR2 signal frame context Luis Machado
2023-05-19 10:25 ` [PATCH v2 12/17] [binutils/aarch64] sme: Core file support Luis Machado
2023-05-19 10:25 ` [PATCH v2 13/17] [gdb/generic] corefile/bug: Use thread-specific gdbarch when dumping register state to core files Luis Machado
2023-05-19 10:25 ` [PATCH v2 14/17] [gdb/generic] corefile/bug: Fixup (gcore) core file target description reading order Luis Machado
2023-05-19 10:25 ` [PATCH v2 15/17] [gdb/aarch64] sme: Core file support for Linux Luis Machado
2023-05-19 10:25 ` [PATCH v2 16/17] [gdb/testsuite] sme: Add SVE/SME testcases Luis Machado
2023-05-19 10:25 ` [PATCH v3 17/17] [gdb/docs] sme: Document SME registers and features Luis Machado
2023-05-19 11:20   ` Eli Zaretskii
2023-06-30 12:10     ` Luis Machado
  -- strict thread matches above, loose matches on Subject: below --
2023-04-11  4:26 [PATCH " Luis Machado
2023-04-17 17:19 ` [PATCH,v3 " Luis Machado
2023-04-22  9:21   ` Eli Zaretskii
2023-04-26 15:00     ` Luis Machado
2023-04-26 16:11       ` Eli Zaretskii
2023-04-27  8:35         ` Luis Machado
2023-04-27  9:10           ` Eli Zaretskii
2023-04-27  9:12             ` Luis Machado

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).