Skip to content

Commit f7c4f81

Browse files
committed
[lldb][docs] Add documentation for AArch64 Linux SME only support
1 parent b6bbc4b commit f7c4f81

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

lldb/docs/use/aarch64-linux.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,75 @@ bytes.
230230
`zt0`'s value and whether it is active or not will be saved prior to
231231
expression evaluation and restored afterwards.
232232

233+
## SME Only Systems
234+
235+
AArch64 systems may have both SVE and SME (that is, `FEAT_SVE` and `FEAT_SVE`),
236+
or they can have only SME. If they only have SME, the system has the usual
237+
SVE state, but that state and SVE instructions may only be used while in
238+
streaming mode.
239+
240+
The LLDB experience is very similar to SVE+SME systems, with a few notable
241+
changes.
242+
243+
### Registers
244+
245+
When in streaming mode, registers act as they would on an SVE+SME system.
246+
Outside of streaming mode LLDB will show the `Z` registers as zero extended copies
247+
of the `V` registers.
248+
249+
Writes to `Z` registers are allowed, but these are converted to `V` register writes
250+
and so only the bottom 128-bits will be applied. Note that the size of the value
251+
written to a `Z` register must match the current streaming vector length, even if
252+
the process is in non-streaming mode.
253+
254+
It is useful for LLDB developers to know that for an SME only system,
255+
`lldb-server` describes the system as having `Z` registers with `V` registers
256+
as subsets of those registers. We do not change the representation each time
257+
the mode changes.
258+
259+
A consequence of this is that if the user writes to a `V` register while in
260+
non-streaming mode, it will be sent to `lldb-server` as a `Z` register write
261+
of a zero extended value. Then `lldb-server` will convert that back into a `V`
262+
register write with the value truncated to 128-bit.
263+
264+
In streaming mode, it will be zero extended, sent as a `Z` write and written
265+
to the real streaming SVE `Z` register without truncation.
266+
267+
`P` registers will be shown as 0s outside of streaming mode. They cannot be written
268+
to in this state.
269+
270+
The `ffr` register will also be shown as 0s outside of streaming mode. In streaming
271+
mode, use of `ffr` is forbidden so it will also show as 0s. It cannot be written
272+
to in either state.
273+
274+
(in the former, LLDB generates the fake value, in the latter, the kernel
275+
generates it)
276+
277+
The `ZA` and `ZT0` registers act as they would for an SVE+SME system.
278+
279+
Since there is no non-streaming SVE, there is non non-streaming vector length.
280+
Therefore even in non-streaming mode, the value shown in `vg` will be the
281+
streaming vector length, and be equal to the value shown for `svg`.
282+
283+
### Expression Evaluation
284+
285+
Some instructions are illegal to use in streaming mode (unless `FEAT_SMEFA64`
286+
is present). LLDB will not make any attempt to make expressions compatible
287+
with the current mode. If part of the expression is not compatible, it will
288+
result in a SIGILL that will be cleaned up as it normally would be.
289+
290+
All register, ZA and mode state will be restored as normal after an expression.
291+
292+
Note that to restore to a non-streaming state from a streaming state, LLDB uses
293+
a special part of the Linux Kernel's
294+
[SME ABI](https://docs.kernel.org/arch/arm64/sme.html). Where FPSIMD data is
295+
written to the non-existent non-streaming SVE register set, with the vector
296+
length set to 0 to cause the process to exit streaming mode.
297+
298+
This is only used for this purpose. Otherwise, in non-streaming mode FP
299+
registers are accessed using the FP register set, and in streaming mode using
300+
the streaming SVE register set.
301+
233302
## Guarded Control Stack Extension (GCS)
234303

235304
GCS support includes the following new registers:

0 commit comments

Comments
 (0)