Commit 2608d7a1 authored by Avi Kivity's avatar Avi Kivity Committed by Marcelo Tosatti

KVM: Allow kvm_load_guest_fpu() even when !vcpu->fpu_active

This allows accessing the guest fpu from the instruction emulator, as well as
being symmetric with kvm_put_guest_fpu().
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
parent ab344828
...@@ -4239,7 +4239,8 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) ...@@ -4239,7 +4239,8 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
preempt_disable(); preempt_disable();
kvm_x86_ops->prepare_guest_switch(vcpu); kvm_x86_ops->prepare_guest_switch(vcpu);
kvm_load_guest_fpu(vcpu); if (vcpu->fpu_active)
kvm_load_guest_fpu(vcpu);
local_irq_disable(); local_irq_disable();
...@@ -5285,7 +5286,7 @@ EXPORT_SYMBOL_GPL(fx_init); ...@@ -5285,7 +5286,7 @@ EXPORT_SYMBOL_GPL(fx_init);
void kvm_load_guest_fpu(struct kvm_vcpu *vcpu) void kvm_load_guest_fpu(struct kvm_vcpu *vcpu)
{ {
if (!vcpu->fpu_active || vcpu->guest_fpu_loaded) if (vcpu->guest_fpu_loaded)
return; return;
vcpu->guest_fpu_loaded = 1; vcpu->guest_fpu_loaded = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment