aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/kernel/process.c')
-rw-r--r--arch/powerpc/kernel/process.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 8fc4de0d22b4..7a84c9f1778e 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -101,21 +101,8 @@ static void check_if_tm_restore_required(struct task_struct *tsk)
101 } 101 }
102} 102}
103 103
104static bool tm_active_with_fp(struct task_struct *tsk)
105{
106 return MSR_TM_ACTIVE(tsk->thread.regs->msr) &&
107 (tsk->thread.ckpt_regs.msr & MSR_FP);
108}
109
110static bool tm_active_with_altivec(struct task_struct *tsk)
111{
112 return MSR_TM_ACTIVE(tsk->thread.regs->msr) &&
113 (tsk->thread.ckpt_regs.msr & MSR_VEC);
114}
115#else 104#else
116static inline void check_if_tm_restore_required(struct task_struct *tsk) { } 105static inline void check_if_tm_restore_required(struct task_struct *tsk) { }
117static inline bool tm_active_with_fp(struct task_struct *tsk) { return false; }
118static inline bool tm_active_with_altivec(struct task_struct *tsk) { return false; }
119#endif /* CONFIG_PPC_TRANSACTIONAL_MEM */ 106#endif /* CONFIG_PPC_TRANSACTIONAL_MEM */
120 107
121bool strict_msr_control; 108bool strict_msr_control;
@@ -252,7 +239,7 @@ EXPORT_SYMBOL(enable_kernel_fp);
252 239
253static int restore_fp(struct task_struct *tsk) 240static int restore_fp(struct task_struct *tsk)
254{ 241{
255 if (tsk->thread.load_fp || tm_active_with_fp(tsk)) { 242 if (tsk->thread.load_fp) {
256 load_fp_state(&current->thread.fp_state); 243 load_fp_state(&current->thread.fp_state);
257 current->thread.load_fp++; 244 current->thread.load_fp++;
258 return 1; 245 return 1;
@@ -334,8 +321,7 @@ EXPORT_SYMBOL_GPL(flush_altivec_to_thread);
334 321
335static int restore_altivec(struct task_struct *tsk) 322static int restore_altivec(struct task_struct *tsk)
336{ 323{
337 if (cpu_has_feature(CPU_FTR_ALTIVEC) && 324 if (cpu_has_feature(CPU_FTR_ALTIVEC) && (tsk->thread.load_vec)) {
338 (tsk->thread.load_vec || tm_active_with_altivec(tsk))) {
339 load_vr_state(&tsk->thread.vr_state); 325 load_vr_state(&tsk->thread.vr_state);
340 tsk->thread.used_vr = 1; 326 tsk->thread.used_vr = 1;
341 tsk->thread.load_vec++; 327 tsk->thread.load_vec++;
@@ -497,13 +483,14 @@ void giveup_all(struct task_struct *tsk)
497 if (!tsk->thread.regs) 483 if (!tsk->thread.regs)
498 return; 484 return;
499 485
486 check_if_tm_restore_required(tsk);
487
500 usermsr = tsk->thread.regs->msr; 488 usermsr = tsk->thread.regs->msr;
501 489
502 if ((usermsr & msr_all_available) == 0) 490 if ((usermsr & msr_all_available) == 0)
503 return; 491 return;
504 492
505 msr_check_and_set(msr_all_available); 493 msr_check_and_set(msr_all_available);
506 check_if_tm_restore_required(tsk);
507 494
508 WARN_ON((usermsr & MSR_VSX) && !((usermsr & MSR_FP) && (usermsr & MSR_VEC))); 495 WARN_ON((usermsr & MSR_VSX) && !((usermsr & MSR_FP) && (usermsr & MSR_VEC)));
509 496