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: Avi Kivity <avi@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
This commit is contained in:
Avi Kivity 2010-01-21 15:31:45 +02:00 коммит произвёл Marcelo Tosatti
Родитель ab344828eb
Коммит 2608d7a12f
1 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -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();
@ -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;