aboutsummaryrefslogtreecommitdiff
path: root/arch/powerpc/kernel/process.c
diff options
context:
space:
mode:
authorAnton Blanchard <anton@samba.org>2015-10-29 11:44:02 +1100
committerMichael Ellerman <mpe@ellerman.id.au>2015-12-01 13:52:25 +1100
commita7d623d4d053ccb0cdfad210bced2ec25ddf69a2 (patch)
treeb1bcf400b9c53c66d483bb641f98fb6e2f270bf9 /arch/powerpc/kernel/process.c
parent98da581e0846f6d932a4bc46a55458140e20478a (diff)
powerpc: Move part of giveup_vsx into c
Move the MSR modification into c. Removing it from the assembly function will allow us to avoid costly MSR writes by batching them up. Check the FP and VMX bits before calling the relevant giveup_*() function. This makes giveup_vsx() and flush_vsx_to_thread() perform more like their sister functions, and allows us to use flush_vsx_to_thread() in the signal code. Move the check_if_tm_restore_required() check in. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/kernel/process.c')
-rw-r--r--arch/powerpc/kernel/process.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 6bcf82bed610..0cb627662ded 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -205,6 +205,25 @@ EXPORT_SYMBOL_GPL(flush_altivec_to_thread);
#endif /* CONFIG_ALTIVEC */
#ifdef CONFIG_VSX
+void giveup_vsx(struct task_struct *tsk)
+{
+ u64 oldmsr = mfmsr();
+ u64 newmsr;
+
+ check_if_tm_restore_required(tsk);
+
+ newmsr = oldmsr | (MSR_FP|MSR_VEC|MSR_VSX);
+ if (oldmsr != newmsr)
+ mtmsr_isync(newmsr);
+
+ if (tsk->thread.regs->msr & MSR_FP)
+ __giveup_fpu(tsk);
+ if (tsk->thread.regs->msr & MSR_VEC)
+ __giveup_altivec(tsk);
+ __giveup_vsx(tsk);
+}
+EXPORT_SYMBOL(giveup_vsx);
+
void enable_kernel_vsx(void)
{
WARN_ON(preemptible());
@@ -220,15 +239,6 @@ void enable_kernel_vsx(void)
}
EXPORT_SYMBOL(enable_kernel_vsx);
-void giveup_vsx(struct task_struct *tsk)
-{
- check_if_tm_restore_required(tsk);
- giveup_fpu(tsk);
- giveup_altivec(tsk);
- __giveup_vsx(tsk);
-}
-EXPORT_SYMBOL(giveup_vsx);
-
void flush_vsx_to_thread(struct task_struct *tsk)
{
if (tsk->thread.regs) {