aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/process.c
diff options
context:
space:
mode:
authorCyril Bur <cyrilbur@gmail.com>2016-02-29 01:53:49 -0500
committerMichael Ellerman <mpe@ellerman.id.au>2016-03-02 07:34:49 -0500
commit8792468da5e12e77e76e1edf081acf0392abb331 (patch)
treee9fa424443bdba64726ccade9e5e169dd10c76ba /arch/powerpc/kernel/process.c
parentde2a20aa7237b45d3c14a2505804a8daa95a8f53 (diff)
powerpc: Add the ability to save FPU without giving it up
This patch adds the ability to be able to save the FPU registers to the thread struct without giving up (disabling the facility) next time the process returns to userspace. This patch optimises the thread copy path (as a result of a fork() or clone()) so that the parent thread can return to userspace with hot registers avoiding a possibly pointless reload of FPU register state. Signed-off-by: Cyril Bur <cyrilbur@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/kernel/process.c')
-rw-r--r--arch/powerpc/kernel/process.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 29da07fb3b4a..a7e5061187e8 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -133,6 +133,16 @@ void __msr_check_and_clear(unsigned long bits)
133EXPORT_SYMBOL(__msr_check_and_clear); 133EXPORT_SYMBOL(__msr_check_and_clear);
134 134
135#ifdef CONFIG_PPC_FPU 135#ifdef CONFIG_PPC_FPU
136void __giveup_fpu(struct task_struct *tsk)
137{
138 save_fpu(tsk);
139 tsk->thread.regs->msr &= ~MSR_FP;
140#ifdef CONFIG_VSX
141 if (cpu_has_feature(CPU_FTR_VSX))
142 tsk->thread.regs->msr &= ~MSR_VSX;
143#endif
144}
145
136void giveup_fpu(struct task_struct *tsk) 146void giveup_fpu(struct task_struct *tsk)
137{ 147{
138 check_if_tm_restore_required(tsk); 148 check_if_tm_restore_required(tsk);
@@ -459,7 +469,7 @@ void save_all(struct task_struct *tsk)
459 msr_check_and_set(msr_all_available); 469 msr_check_and_set(msr_all_available);
460 470
461 if (usermsr & MSR_FP) 471 if (usermsr & MSR_FP)
462 __giveup_fpu(tsk); 472 save_fpu(tsk);
463 473
464 if (usermsr & MSR_VEC) 474 if (usermsr & MSR_VEC)
465 __giveup_altivec(tsk); 475 __giveup_altivec(tsk);