Commit 685659ee authored by yu liu's avatar yu liu Committed by Avi Kivity

powerpc/e500: Save SPEFCSR in flush_spe_to_thread()

giveup_spe() saves the SPE state which is protected by MSR[SPE].
However, modifying SPEFSCR does not trap when MSR[SPE]=0.
And since SPEFSCR is already saved/restored in _switch(),
not all the callers want to save SPEFSCR again.
Thus, saving SPEFSCR should not belong to giveup_spe().

This patch moves SPEFSCR saving to flush_spe_to_thread(),
and cleans up the caller that needs to save SPEFSCR accordingly.
Signed-off-by: default avatarLiu Yu <yu.liu@freescale.com>
Acked-by: default avatarKumar Gala <galak@kernel.crashing.org>
Signed-off-by: default avatarScott Wood <scottwood@freescale.com>
Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
parent a22a2dac
...@@ -792,8 +792,6 @@ _GLOBAL(giveup_spe) ...@@ -792,8 +792,6 @@ _GLOBAL(giveup_spe)
evmwumiaa evr6, evr6, evr6 /* evr6 <- ACC = 0 * 0 + ACC */ evmwumiaa evr6, evr6, evr6 /* evr6 <- ACC = 0 * 0 + ACC */
li r4,THREAD_ACC li r4,THREAD_ACC
evstddx evr6, r4, r3 /* save off accumulator */ evstddx evr6, r4, r3 /* save off accumulator */
mfspr r6,SPRN_SPEFSCR
stw r6,THREAD_SPEFSCR(r3) /* save spefscr register value */
beq 1f beq 1f
lwz r4,_MSR-STACK_FRAME_OVERHEAD(r5) lwz r4,_MSR-STACK_FRAME_OVERHEAD(r5)
lis r3,MSR_SPE@h lis r3,MSR_SPE@h
......
...@@ -213,6 +213,7 @@ void flush_spe_to_thread(struct task_struct *tsk) ...@@ -213,6 +213,7 @@ void flush_spe_to_thread(struct task_struct *tsk)
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
BUG_ON(tsk != current); BUG_ON(tsk != current);
#endif #endif
tsk->thread.spefscr = mfspr(SPRN_SPEFSCR);
giveup_spe(tsk); giveup_spe(tsk);
} }
preempt_enable(); preempt_enable();
......
...@@ -1387,10 +1387,7 @@ void SPEFloatingPointException(struct pt_regs *regs) ...@@ -1387,10 +1387,7 @@ void SPEFloatingPointException(struct pt_regs *regs)
int code = 0; int code = 0;
int err; int err;
preempt_disable(); flush_spe_to_thread(current);
if (regs->msr & MSR_SPE)
giveup_spe(current);
preempt_enable();
spefscr = current->thread.spefscr; spefscr = current->thread.spefscr;
fpexc_mode = current->thread.fpexc_mode; fpexc_mode = current->thread.fpexc_mode;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment