Lines Matching full:fpu
5 #include <asm/fpu/xstate.h>
6 #include <asm/trace/fpu.h>
8 /* Functions related to FPU context tracking */
11 * The in-register FPU state for an FPU context on a CPU is assumed to be
12 * valid if the fpu->last_cpu matches the CPU, and the fpu_fpregs_owner_ctx
13 * matches the FPU.
15 * If the FPU register state is valid, the kernel can skip restoring the
16 * FPU state from memory.
18 * Any code that clobbers the FPU registers or updates the in-memory
19 * FPU state for a task MUST let the rest of the kernel know that the
20 * FPU registers are no longer valid for this task.
23 * (with preemption disabled), FPU for the current task, or a task that
31 static inline void __fpu_invalidate_fpregs_state(struct fpu *fpu) in __fpu_invalidate_fpregs_state() argument
33 fpu->last_cpu = -1; in __fpu_invalidate_fpregs_state()
36 static inline int fpregs_state_valid(struct fpu *fpu, unsigned int cpu) in fpregs_state_valid() argument
38 return fpu == this_cpu_read(fpu_fpregs_owner_ctx) && cpu == fpu->last_cpu; in fpregs_state_valid()
41 static inline void fpregs_deactivate(struct fpu *fpu) in fpregs_deactivate() argument
44 trace_x86_fpu_regs_deactivated(fpu); in fpregs_deactivate()
47 static inline void fpregs_activate(struct fpu *fpu) in fpregs_activate() argument
49 __this_cpu_write(fpu_fpregs_owner_ctx, fpu); in fpregs_activate()
50 trace_x86_fpu_regs_activated(fpu); in fpregs_activate()
56 struct fpu *fpu = ¤t->thread.fpu; in fpregs_restore_userregs() local
62 if (!fpregs_state_valid(fpu, cpu)) { in fpregs_restore_userregs()
70 * not up to date in current->thread.fpu.xsave state. in fpregs_restore_userregs()
74 restore_fpregs_from_fpstate(fpu->fpstate, XFEATURE_MASK_FPSTATE); in fpregs_restore_userregs()
76 fpregs_activate(fpu); in fpregs_restore_userregs()
77 fpu->last_cpu = cpu; in fpregs_restore_userregs()