powerpc: Add the ability to save Altivec without giving it up

This patch adds the ability to be able to save the VEC registers to the
thread struct without giving up (disabling the facility) next time the
process returns to userspace.

This patch builds on a previous optimisation for the FPU registers in the
thread copy path to avoid a possibly pointless reload of VEC state.

Signed-off-by: Cyril Bur <cyrilbur@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:
Cyril Bur 2016-02-29 17:53:50 +11:00 committed by Michael Ellerman
parent 8792468da5
commit 6f515d842e
3 changed files with 17 additions and 22 deletions

View file

@ -213,6 +213,16 @@ static int restore_fp(struct task_struct *tsk) { return 0; }
#ifdef CONFIG_ALTIVEC
#define loadvec(thr) ((thr).load_vec)
static void __giveup_altivec(struct task_struct *tsk)
{
save_altivec(tsk);
tsk->thread.regs->msr &= ~MSR_VEC;
#ifdef CONFIG_VSX
if (cpu_has_feature(CPU_FTR_VSX))
tsk->thread.regs->msr &= ~MSR_VSX;
#endif
}
void giveup_altivec(struct task_struct *tsk)
{
check_if_tm_restore_required(tsk);
@ -472,7 +482,7 @@ void save_all(struct task_struct *tsk)
save_fpu(tsk);
if (usermsr & MSR_VEC)
__giveup_altivec(tsk);
save_altivec(tsk);
if (usermsr & MSR_VSX)
__giveup_vsx(tsk);