From: Jack Miller <j...@codezen.org> Previously we just saved the FSCR, but only restored it in some settings, and never copied it thread to thread. This patch always restores the FSCR and formalizes new threads inheriting its setting so that later we can manipulate FSCR bits in start_thread.
Signed-off-by: Jack Miller <j...@codezen.org> Signed-off-by: Michael Neuling <mi...@neuling.org> --- This version fixes breaking the dscr_inherit_test selftest. I moved the CONFIG_ALTIVEC code around in restores_sprs() so fscr could be declared without more ifdefs. --- arch/powerpc/kernel/process.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index ea8a28f..1f7f203 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c @@ -1015,15 +1015,11 @@ static inline void save_sprs(struct thread_struct *t) static inline void restore_sprs(struct thread_struct *old_thread, struct thread_struct *new_thread) { -#ifdef CONFIG_ALTIVEC - if (cpu_has_feature(CPU_FTR_ALTIVEC) && - old_thread->vrsave != new_thread->vrsave) - mtspr(SPRN_VRSAVE, new_thread->vrsave); -#endif #ifdef CONFIG_PPC_BOOK3S_64 + u64 fscr = new_thread->fscr; if (cpu_has_feature(CPU_FTR_DSCR)) { u64 dscr = get_paca()->dscr_default; - u64 fscr = old_thread->fscr & ~FSCR_DSCR; + fscr &= ~FSCR_DSCR; if (new_thread->dscr_inherit) { dscr = new_thread->dscr; @@ -1032,9 +1028,6 @@ static inline void restore_sprs(struct thread_struct *old_thread, if (old_thread->dscr != dscr) mtspr(SPRN_DSCR, dscr); - - if (old_thread->fscr != fscr) - mtspr(SPRN_FSCR, fscr); } if (cpu_has_feature(CPU_FTR_ARCH_207S)) { @@ -1045,10 +1038,18 @@ static inline void restore_sprs(struct thread_struct *old_thread, if (old_thread->ebbrr != new_thread->ebbrr) mtspr(SPRN_EBBRR, new_thread->ebbrr); + if (old_thread->fscr != fscr) + mtspr(SPRN_FSCR, fscr); + if (old_thread->tar != new_thread->tar) mtspr(SPRN_TAR, new_thread->tar); } #endif +#ifdef CONFIG_ALTIVEC + if (cpu_has_feature(CPU_FTR_ALTIVEC) && + old_thread->vrsave != new_thread->vrsave) + mtspr(SPRN_VRSAVE, new_thread->vrsave); +#endif } struct task_struct *__switch_to(struct task_struct *prev, @@ -1486,6 +1487,9 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, } if (cpu_has_feature(CPU_FTR_HAS_PPR)) p->thread.ppr = INIT_PPR; + + if (cpu_has_feature(CPU_FTR_ARCH_207S)) + p->thread.fscr = mfspr(SPRN_FSCR); #endif kregs->nip = ppc_function_entry(f); return 0; -- 2.7.4 _______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev