diff options
author | Avi Kivity <avi@redhat.com> | 2010-01-21 08:31:45 -0500 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2010-03-01 10:36:03 -0500 |
commit | 2608d7a12fd4badfe2eac534150f0715a7fd3ff3 (patch) | |
tree | 98cccb92487d023e9519f323c91c090a43367510 | |
parent | ab344828ebe729e52949d64046adaa196f6b9dbe (diff) |
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>
-rw-r--r-- | arch/x86/kvm/x86.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index ce267d9f0305..4cf4eac03bbc 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -4239,7 +4239,8 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) | |||
4239 | preempt_disable(); | 4239 | preempt_disable(); |
4240 | 4240 | ||
4241 | kvm_x86_ops->prepare_guest_switch(vcpu); | 4241 | kvm_x86_ops->prepare_guest_switch(vcpu); |
4242 | kvm_load_guest_fpu(vcpu); | 4242 | if (vcpu->fpu_active) |
4243 | kvm_load_guest_fpu(vcpu); | ||
4243 | 4244 | ||
4244 | local_irq_disable(); | 4245 | local_irq_disable(); |
4245 | 4246 | ||
@@ -5285,7 +5286,7 @@ EXPORT_SYMBOL_GPL(fx_init); | |||
5285 | 5286 | ||
5286 | void kvm_load_guest_fpu(struct kvm_vcpu *vcpu) | 5287 | void kvm_load_guest_fpu(struct kvm_vcpu *vcpu) |
5287 | { | 5288 | { |
5288 | if (!vcpu->fpu_active || vcpu->guest_fpu_loaded) | 5289 | if (vcpu->guest_fpu_loaded) |
5289 | return; | 5290 | return; |
5290 | 5291 | ||
5291 | vcpu->guest_fpu_loaded = 1; | 5292 | vcpu->guest_fpu_loaded = 1; |