Re: [PATCH v14 16/39] arm64/sme: Implement traps and syscall handling for SME

Catalin Marinas
2022-04-22T16:28:13Z

On Tue, Apr 19, 2022 at 12:22:24PM +0100, Mark Brown wrote:
> By default all SME operations in userspace will trap. When this happens
> we allocate storage space for the SME register state, set up the SVE
> registers and disable traps. We do not need to initialize ZA since the
> architecture guarantees that it will be zeroed when enabled and when we
> trap ZA is disabled.
>
> On syscall we exit streaming mode if we were previously in it and ensure
> that all but the lower 128 bits of the registers are zeroed while
> preserving the state of ZA. This follows the aarch64 PCS for SME, ZA
> state is preserved over a function call and streaming mode is exited.
> Since the traps for SME do not distinguish between streaming mode SVE
> and ZA usage if ZA is in use rather than reenabling traps we instead
> zero the parts of the SVE registers not shared with FPSIMD and leave SME
> enabled, this simplifies handling SME traps. If ZA is not in use then we
> reenable SME traps and fall through to normal handling of SVE.
>
> Signed-off-by: Mark Brown <broonie@kernel.org>

Re-adding my reviewed-by following the update.

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>