Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 95971
b: refs/heads/master
c: bc1a34f
h: refs/heads/master
i:
  95969: b676269
  95967: f350952
v: v3
  • Loading branch information
Andrea Arcangeli authored and Avi Kivity committed May 4, 2008
1 parent d34eccd commit b1c2b51
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b4f14abd95cd8d42f08438f1c4ec3eafe41054ee
refs/heads/master: bc1a34f1bf354fabc03e3f465620c80e510d0e8f
11 changes: 10 additions & 1 deletion trunk/arch/x86/kvm/x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -3703,10 +3703,19 @@ void fx_init(struct kvm_vcpu *vcpu)
{
unsigned after_mxcsr_mask;

/*
* Touch the fpu the first time in non atomic context as if
* this is the first fpu instruction the exception handler
* will fire before the instruction returns and it'll have to
* allocate ram with GFP_KERNEL.
*/
if (!used_math())
fx_save(&vcpu->arch.host_fx_image);

/* Initialize guest FPU by resetting ours and saving into guest's */
preempt_disable();
fx_save(&vcpu->arch.host_fx_image);
fpu_init();
fx_finit();
fx_save(&vcpu->arch.guest_fx_image);
fx_restore(&vcpu->arch.host_fx_image);
preempt_enable();
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/asm-x86/kvm_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ static inline void fx_restore(struct i387_fxsave_struct *image)
asm("fxrstor (%0)":: "r" (image));
}

static inline void fpu_init(void)
static inline void fx_finit(void)
{
asm("finit");
}
Expand Down

0 comments on commit b1c2b51

Please sign in to comment.