Lines Matching refs:fpu
89 tsk->thread.fpu.last_cpu = ~0; in task_disable_lazy_fpu_restore()
95 cpu == new->thread.fpu.last_cpu; in fpu_lazy_restore()
232 static inline void fpu_fxsave(struct fpu *fpu) in fpu_fxsave() argument
235 asm volatile( "fxsave %[fx]" : [fx] "=m" (fpu->state->fxsave)); in fpu_fxsave()
237 asm volatile("fxsaveq %[fx]" : [fx] "=m" (fpu->state->fxsave)); in fpu_fxsave()
261 : "=m" (fpu->state->fxsave) in fpu_fxsave()
262 : [fx] "R" (&fpu->state->fxsave)); in fpu_fxsave()
270 static inline int fpu_save_init(struct fpu *fpu) in fpu_save_init() argument
273 fpu_xsave(fpu); in fpu_save_init()
278 if (!(fpu->state->xsave.xsave_hdr.xstate_bv & XSTATE_FP)) in fpu_save_init()
281 fpu_fxsave(fpu); in fpu_save_init()
284 : [fx] "=m" (fpu->state->fsave)); in fpu_save_init()
296 if (unlikely(fpu->state->fxsave.swd & X87_FSW_ES)) { in fpu_save_init()
305 return fpu_save_init(&tsk->thread.fpu); in __save_init_fpu()
308 static inline int fpu_restore_checking(struct fpu *fpu) in fpu_restore_checking() argument
311 return fpu_xrstor_checking(&fpu->state->xsave); in fpu_restore_checking()
313 return fxrstor_checking(&fpu->state->fxsave); in fpu_restore_checking()
315 return frstor_checking(&fpu->state->fsave); in fpu_restore_checking()
330 : : [addr] "m" (tsk->thread.fpu.has_fpu)); in restore_fpu_checking()
333 return fpu_restore_checking(&tsk->thread.fpu); in restore_fpu_checking()
343 return tsk->thread.fpu.has_fpu; in __thread_has_fpu()
349 tsk->thread.fpu.has_fpu = 0; in __thread_clear_has_fpu()
356 tsk->thread.fpu.has_fpu = 1; in __thread_set_has_fpu()
437 fpu_switch_t fpu; in switch_fpu_prepare() local
443 fpu.preload = tsk_used_math(new) && in switch_fpu_prepare()
450 old->thread.fpu.last_cpu = cpu; in switch_fpu_prepare()
453 old->thread.fpu.has_fpu = 0; in switch_fpu_prepare()
456 if (fpu.preload) { in switch_fpu_prepare()
459 prefetch(new->thread.fpu.state); in switch_fpu_prepare()
465 if (fpu.preload) { in switch_fpu_prepare()
468 fpu.preload = 0; in switch_fpu_prepare()
470 prefetch(new->thread.fpu.state); in switch_fpu_prepare()
474 return fpu; in switch_fpu_prepare()
483 static inline void switch_fpu_finish(struct task_struct *new, fpu_switch_t fpu) in switch_fpu_finish() argument
485 if (fpu.preload) { in switch_fpu_finish()
535 xsave_state_booting(&tsk->thread.fpu.state->xsave, -1); in __save_fpu()
537 xsave_state(&tsk->thread.fpu.state->xsave, -1); in __save_fpu()
539 fpu_fxsave(&tsk->thread.fpu); in __save_fpu()
548 return tsk->thread.fpu.state->fxsave.cwd; in get_fpu_cwd()
550 return (unsigned short)tsk->thread.fpu.state->fsave.cwd; in get_fpu_cwd()
557 return tsk->thread.fpu.state->fxsave.swd; in get_fpu_swd()
559 return (unsigned short)tsk->thread.fpu.state->fsave.swd; in get_fpu_swd()
566 return tsk->thread.fpu.state->fxsave.mxcsr; in get_fpu_mxcsr()
572 static bool fpu_allocated(struct fpu *fpu) in fpu_allocated() argument
574 return fpu->state != NULL; in fpu_allocated()
577 static inline int fpu_alloc(struct fpu *fpu) in fpu_alloc() argument
579 if (fpu_allocated(fpu)) in fpu_alloc()
581 fpu->state = kmem_cache_alloc(task_xstate_cachep, GFP_KERNEL); in fpu_alloc()
582 if (!fpu->state) in fpu_alloc()
584 WARN_ON((unsigned long)fpu->state & 15); in fpu_alloc()
588 static inline void fpu_free(struct fpu *fpu) in fpu_free() argument
590 if (fpu->state) { in fpu_free()
591 kmem_cache_free(task_xstate_cachep, fpu->state); in fpu_free()
592 fpu->state = NULL; in fpu_free()
599 memset(&dst->thread.fpu.state->xsave, 0, xstate_size); in fpu_copy()
602 struct fpu *dfpu = &dst->thread.fpu; in fpu_copy()
603 struct fpu *sfpu = &src->thread.fpu; in fpu_copy()