Skip to content

Commit

Permalink
KVM: Allow kvm_load_guest_fpu() even when !vcpu->fpu_active
Browse files Browse the repository at this point in the history
This allows accessing the guest fpu from the instruction emulator, as well as
being symmetric with kvm_put_guest_fpu().

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
  • Loading branch information
Avi Kivity authored and Marcelo Tosatti committed Mar 1, 2010
1 parent ab34482 commit 2608d7a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions arch/x86/kvm/x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -4239,7 +4239,8 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
preempt_disable();

kvm_x86_ops->prepare_guest_switch(vcpu);
kvm_load_guest_fpu(vcpu);
if (vcpu->fpu_active)
kvm_load_guest_fpu(vcpu);

local_irq_disable();

Expand Down Expand Up @@ -5285,7 +5286,7 @@ EXPORT_SYMBOL_GPL(fx_init);

void kvm_load_guest_fpu(struct kvm_vcpu *vcpu)
{
if (!vcpu->fpu_active || vcpu->guest_fpu_loaded)
if (vcpu->guest_fpu_loaded)
return;

vcpu->guest_fpu_loaded = 1;
Expand Down

0 comments on commit 2608d7a

Please sign in to comment.