arm64/sme: Don't flush SVE register state when allocating SME storage
authorMark Brown <broonie@kernel.org>
Wed, 17 Aug 2022 18:23:23 +0000 (19:23 +0100)
committerWill Deacon <will@kernel.org>
Tue, 23 Aug 2022 10:29:11 +0000 (11:29 +0100)
commit826a4fdd2ada9e5923c58bdd168f31a42e958ffc
tree99b8ee0f5ed1e99549981dd8346e9ffbf51658dc
parentea64baacbc36a0d552aec0d87107182f40211131
arm64/sme: Don't flush SVE register state when allocating SME storage

Currently when taking a SME access trap we allocate storage for the SVE
register state in order to be able to handle storage of streaming mode SVE.
Due to the original usage in a purely SVE context the SVE register state
allocation this also flushes the register state for SVE if storage was
already allocated but in the SME context this is not desirable. For a SME
access trap to be taken the task must not be in streaming mode so either
there already is SVE register state present for regular SVE mode which would
be corrupted or the task does not have TIF_SVE and the flush is redundant.

Fix this by adding a flag to sve_alloc() indicating if we are in a SVE
context and need to flush the state. Freshly allocated storage is always
zeroed either way.

Fixes: 8bd7f91c03d8 ("arm64/sme: Implement traps and syscall handling for SME")
Signed-off-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Link: https://lore.kernel.org/r/20220817182324.638214-4-broonie@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/include/asm/fpsimd.h
arch/arm64/kernel/fpsimd.c
arch/arm64/kernel/ptrace.c
arch/arm64/kernel/signal.c