aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-mips/fpu.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-mips/fpu.h')
-rw-r--r--include/asm-mips/fpu.h25
1 files changed, 7 insertions, 18 deletions
diff --git a/include/asm-mips/fpu.h b/include/asm-mips/fpu.h
index 4e12d1f9534f..b414a7d9db43 100644
--- a/include/asm-mips/fpu.h
+++ b/include/asm-mips/fpu.h
@@ -68,8 +68,6 @@ do { \
68 /* We don't care about the c0 hazard here */ \ 68 /* We don't care about the c0 hazard here */ \
69} while (0) 69} while (0)
70 70
71#define __fpu_enabled() (read_c0_status() & ST0_CU1)
72
73#define enable_fpu() \ 71#define enable_fpu() \
74do { \ 72do { \
75 if (cpu_has_fpu) \ 73 if (cpu_has_fpu) \
@@ -102,14 +100,19 @@ static inline void __own_fpu(void)
102 set_thread_flag(TIF_USEDFPU); 100 set_thread_flag(TIF_USEDFPU);
103} 101}
104 102
105static inline void own_fpu(int restore) 103static inline void own_fpu_inatomic(int restore)
106{ 104{
107 preempt_disable();
108 if (cpu_has_fpu && !__is_fpu_owner()) { 105 if (cpu_has_fpu && !__is_fpu_owner()) {
109 __own_fpu(); 106 __own_fpu();
110 if (restore) 107 if (restore)
111 _restore_fp(current); 108 _restore_fp(current);
112 } 109 }
110}
111
112static inline void own_fpu(int restore)
113{
114 preempt_disable();
115 own_fpu_inatomic(restore);
113 preempt_enable(); 116 preempt_enable();
114} 117}
115 118
@@ -162,18 +165,4 @@ static inline fpureg_t *get_fpu_regs(struct task_struct *tsk)
162 return tsk->thread.fpu.fpr; 165 return tsk->thread.fpu.fpr;
163} 166}
164 167
165static inline void enable_fp_in_kernel(void)
166{
167 set_thread_flag(TIF_ALLOW_FP_IN_KERNEL);
168 /* make sure CU1 and FPU ownership are consistent */
169 if (!__is_fpu_owner() && __fpu_enabled())
170 __disable_fpu();
171}
172
173static inline void disable_fp_in_kernel(void)
174{
175 BUG_ON(!__is_fpu_owner() && __fpu_enabled());
176 clear_thread_flag(TIF_ALLOW_FP_IN_KERNEL);
177}
178
179#endif /* _ASM_FPU_H */ 168#endif /* _ASM_FPU_H */