arm64/sve: Rework SVE access trap to convert state in registers
authorMark Brown <broonie@kernel.org>
Fri, 12 Mar 2021 19:03:13 +0000 (19:03 +0000)
committerCatalin Marinas <catalin.marinas@arm.com>
Thu, 8 Apr 2021 16:43:43 +0000 (17:43 +0100)
commitcccb78ce89c45a4414db712be4986edfb92434bd
tree24b69da4e9de7f3ce673594cee5284fa1dad8414
parent68f638a432dff4ed3e053cde2bd23ed36b4c057c
arm64/sve: Rework SVE access trap to convert state in registers

When we enable SVE usage in userspace after taking a SVE access trap we
need to ensure that the portions of the register state that are not
shared with the FPSIMD registers are zeroed. Currently we do this by
forcing the FPSIMD registers to be saved to the task struct and converting
them there. This is wasteful in the common case where the task state is
loaded into the registers and we will immediately return to userspace
since we can initialise the SVE state directly in registers instead of
accessing multiple copies of the register state in memory.

Instead in that common case do the conversion in the registers and
update the task metadata so that we can return to userspace without
spilling the register state to memory unless there is some other reason
to do so.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210312190313.24598-1-broonie@kernel.org
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/include/asm/fpsimd.h
arch/arm64/kernel/entry-fpsimd.S
arch/arm64/kernel/fpsimd.c