arm64: KVM: Only force FPEXC32_EL2.EN if trapping FPSIMD
authorMarc Zyngier <marc.zyngier@arm.com>
Thu, 23 Aug 2018 10:51:43 +0000 (11:51 +0100)
committerChristoffer Dall <christoffer.dall@arm.com>
Fri, 7 Sep 2018 13:05:50 +0000 (15:05 +0200)
commit7d14919c0d475a795c0127631ac8ecb2b0f31831
tree84f8fac05bacd87e4e448acec0562305c927fbc0
parent694556d54f354d3fe43bb2e61fd6103cca2638a4
arm64: KVM: Only force FPEXC32_EL2.EN if trapping FPSIMD

If trapping FPSIMD in the context of an AArch32 guest, it is critical
to set FPEXC32_EL2.EN to 1 so that the trapping is taken to EL2 and
not EL1.

Conversely, it is just as critical *not* to set FPEXC32_EL2.EN to 1
if we're not going to trap FPSIMD, as we then corrupt the existing
VFP state.

Moving the call to __activate_traps_fpsimd32 to the point where we
know for sure that we are going to trap ensures that we don't set that
bit spuriously.

Fixes: e6b673b741ea ("KVM: arm64: Optimise FPSIMD handling to reduce guest/host thrashing")
Cc: stable@vger.kernel.org # v4.18
Cc: Dave Martin <dave.martin@arm.com>
Reported-by: Alexander Graf <agraf@suse.de>
Tested-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Christoffer Dall <christoffer.dall@arm.com>
arch/arm64/kvm/hyp/switch.c