]> www.infradead.org Git - users/jedix/linux-maple.git/commit
arm64/fpsimd: Clarify the purpose of using last in fpsimd_save()
authorMark Brown <broonie@kernel.org>
Mon, 24 Jan 2022 16:11:15 +0000 (16:11 +0000)
committerMarc Zyngier <maz@kernel.org>
Tue, 8 Feb 2022 14:43:22 +0000 (14:43 +0000)
commit432110cd83caa655c646ec5d8ca6a9e9afb9ccba
tree73f6c4c20db5821c36c5582bbb7fe9f40f855c45
parent01a244decc760b1ae2caa045647d79ff431bf37b
arm64/fpsimd: Clarify the purpose of using last in fpsimd_save()

When saving the floating point context in fpsimd_save() we always reference
the state using last-> rather than using current->. Looking at the FP code
in isolation the reason for this is not entirely obvious, it's done because
when KVM is running it will bind the guest context and rely on the host
writing out the guest state on context switch away from the guest.

There's a slight trick here in that KVM still uses TIF_FOREIGN_FPSTATE and
TIF_SVE to communicate what needs to be saved, it maintains those flags
and restores them when it is done running the guest so that the normal
restore paths function when we return back to userspace.

Add a comment to explain this to help future readers work out what's going
on a bit faster.

Signed-off-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20220124161115.115200-1-broonie@kernel.org
arch/arm64/kernel/fpsimd.c