]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: Ensure guest's FPU state is loaded when accessing for emulation
authorSean Christopherson <sean.j.christopherson@intel.com>
Fri, 17 Jan 2020 19:30:50 +0000 (11:30 -0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 27 Jan 2020 18:59:47 +0000 (19:59 +0100)
commit6dc9daca8f4f0a79a335635b9899696ebe57bd6a
tree7dbb5c447670451bb8d118c05df4a3eb48759d35
parent4cac352fa81e1848117cd40013a7709540fc33fe
KVM: x86: Ensure guest's FPU state is loaded when accessing for emulation

Lock the FPU regs and reload the current thread's FPU state, which holds
the guest's FPU state, to the CPU registers if necessary prior to
accessing guest FPU state as part of emulation.  kernel_fpu_begin() can
be called from softirq context, therefore KVM must ensure softirqs are
disabled (locking the FPU regs disables softirqs) when touching CPU FPU
state.

Note, for all intents and purposes this reverts commit 6e5857fb05741
("x86,kvm: remove KVM emulator get_fpu / put_fpu"), but at the time it
was applied, removing get/put_fpu() was correct.  The re-introduction
of {get,put}_fpu() is necessitated by the deferring of FPU state load.

Fixes: 3454afaecf56f ("x86/fpu: Defer FPU state load until return to userspace")
Cc: stable@vger.kernel.org
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/emulate.c