Subject: Re: [PATCH v11 06/40] arm64/sme: Provide ABI documentation for SME

From: Catalin Marinas <[email-masked]>
Date: Thu, 10 Feb 2022 18:32:46 +0000

On Mon, Feb 07, 2022 at 03:20:35PM +0000, Mark Brown wrote:
> diff --git a/Documentation/arm64/sme.rst b/Documentation/arm64/sme.rst
> new file mode 100644
> index 000000000000..15df3157c592
> --- /dev/null
> +++ b/Documentation/arm64/sme.rst
[...]
> +3.  Sharing of streaming and non-streaming mode SVE state
> +---------------------------------------------------------
> +
> +It is implementation defined which if any parts of the SVE state are shared
> +between streaming and non-streaming modes.  When switching between modes
> +via software interfaces such as ptrace if no register content is provided as
> +part of switching no state will be assumed to be shared and everything will
> +be zeroed.

Is there anything other than ptrace() here? I read the sigreturn() case
below but did not say anything about changing PSTATE.SM via the
sigcontext. I guess it's similar to ptrace().

> +4.  System call behaviour
> +-------------------------
> +
> +* On syscall PSTATE.ZA is preserved, if PSTATE.ZA==1 then the contents of the
> +  ZA matrix are preserved.

Sorry if this was discussed. What is the rationale for preserving the ZA
registers on syscall? We don't do this for the top part of the Z
registers.

> +* On syscall PSTATE.SM will be cleared and the SVE registers will be handled
> +  as normal.

What does that mean? Is this as per the sve.rst doc (unspecified but
zeroed in practice)?

> +* Neither the SVE registers nor ZA are used to pass arguments to or receive
> +  results from any syscall.
> +
> +* On creation fork() or clone() the newly created process will have PSTATE.SM
> +  and PSTATE.ZA cleared.

This looks slightly inconsistent with the first bullet point on ZA being
preserved on syscalls. Why do these differ?

[...]
> +References
> +==========
> +
> +[1] arch/arm64/include/uapi/asm/sigcontext.h
> +    AArch64 Linux signal ABI definitions
> +
> +[2] arch/arm64/include/uapi/asm/ptrace.h
> +    AArch64 Linux ptrace ABI definitions
> +
> +[3] Documentation/arm64/cpu-feature-registers.rst
> +
> +[4] ARM IHI0055C
> +    http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055c/IHI0055C_beta_aapcs64.pdf
> +    http://infocenter.arm.com/help/topic/com.arm.doc.subset.swdev.abi/index.html
> +    Procedure Call Standard for the ARM 64-bit Architecture (AArch64)

The second link no longer works. I also couldn't find any reference to
[4] but there's a lot of text to scan, so I may have missed it.

-- 
Catalin

_______________________________________________
linux-arm-kernel mailing list
[email-masked]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel