summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/process.c
diff options
context:
space:
mode:
authorCyril Bur <cyrilbur@gmail.com>2016-02-29 17:53:49 +1100
committerMichael Ellerman <mpe@ellerman.id.au>2016-03-02 23:34:49 +1100
commit8792468da5e12e77e76e1edf081acf0392abb331 (patch)
treee9fa424443bdba64726ccade9e5e169dd10c76ba /arch/powerpc/kernel/process.c
parentde2a20aa7237b45d3c14a2505804a8daa95a8f53 (diff)
downloadop-kernel-dev-8792468da5e12e77e76e1edf081acf0392abb331.zip
op-kernel-dev-8792468da5e12e77e76e1edf081acf0392abb331.tar.gz
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 29da07f..a7e5061 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)
EXPORT_SYMBOL(__msr_check_and_clear);
#ifdef CONFIG_PPC_FPU
+void __giveup_fpu(struct task_struct *tsk)
+{
+ save_fpu(tsk);
+ tsk->thread.regs->msr &= ~MSR_FP;
+#ifdef CONFIG_VSX
+ if (cpu_has_feature(CPU_FTR_VSX))
+ tsk->thread.regs->msr &= ~MSR_VSX;
+#endif
+}
+
void giveup_fpu(struct task_struct *tsk)
{
check_if_tm_restore_required(tsk);
@@ -459,7 +469,7 @@ void save_all(struct task_struct *tsk)
msr_check_and_set(msr_all_available);
if (usermsr & MSR_FP)
- __giveup_fpu(tsk);
+ save_fpu(tsk);
if (usermsr & MSR_VEC)
__giveup_altivec(tsk);
OpenPOWER on IntegriCloud