powerpcspe: Unconditionally save an restore SPEFSCR on task switch

The SPEFSCR is not guarded by the SPV bit in MSR, it's just another SPR.
Protect processes from other tasks setting the SPEFSCR for their own needs.
This commit is contained in:
Justin Hibbits 2018-07-30 17:03:15 +00:00
parent 8e36389535
commit 9b8d0a4615
2 changed files with 10 additions and 0 deletions

View File

@ -208,6 +208,8 @@ ASSYM(PCB_CDSCR, PCB_CDSCR);
ASSYM(PCB_AIM_USR_VSID, offsetof(struct pcb, pcb_cpu.aim.usr_vsid));
ASSYM(PCB_BOOKE_DBCR0, offsetof(struct pcb, pcb_cpu.booke.dbcr0));
ASSYM(PCB_VSCR, offsetof(struct pcb, pcb_vec.vscr));
ASSYM(TD_LOCK, offsetof(struct thread, td_lock));
ASSYM(TD_PROC, offsetof(struct thread, td_proc));
ASSYM(TD_PCB, offsetof(struct thread, td_pcb));

View File

@ -113,6 +113,10 @@ ENTRY(cpu_switch)
bl save_vec
.L2:
#if defined(__SPE__)
mfspr %r3,SPR_SPEFSCR
stw %r3,PCB_VSCR(%r17)
#endif
mr %r3,%r14 /* restore old thread ptr */
bl pmap_deactivate /* Deactivate the current pmap */
@ -163,6 +167,10 @@ blocked_loop:
bl enable_vec
.L4:
#if defined(__SPE__)
lwz %r3,PCB_VSCR(%r17)
mtspr SPR_SPEFSCR,%r3
#endif
/* thread to restore is in r3 */
mr %r3,%r17 /* Recover PCB ptr */
lmw %r12,PCB_CONTEXT(%r3) /* Load the non-volatile GP regs */