]> 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)
commit570d3f0c0dd730683d42e5c8548a42967e3acabf
tree84f8fac05bacd87e4e448acec0562305c927fbc0
parentdb368f41fbf0d1c8c2dad08959953d8143044898
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: 522f8e0a16fd ("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