]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit4c360c4eeae25489c414c353f9bc4dccc5b4bd12
tree84f8fac05bacd87e4e448acec0562305c927fbc0
parent4ff01d5cabe7a4de1c34d016cd2ea9e875cd54b9
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: 6080b5459fe8 ("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