mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
MIPS: Basic MSA context switching support
This patch adds support for context switching the MSA vector registers. These 128 bit vector registers are aliased with the FP registers - an FP register accesses the least significant bits of the vector register with which it is aliased (ie. the register with the same index). Due to both this & the requirement that the scalar FPU must be 64-bit (FR=1) if enabled at the same time as MSA the kernel will enable MSA & scalar FP at the same time for tasks which use MSA. If we restore the MSA vector context then we might as well enable the scalar FPU since the reason it was left disabled was to allow for lazy FP context restoring - but we just restored the FP context as it's a subset of the vector context. If we restore the FP context and have previously used MSA then we have to restore the whole vector context anyway (see comment in enable_restore_fp_context for details) so similarly we might as well enable MSA. Thus if a task does not use MSA then it will continue to behave as without this patch - the scalar FP context will be saved & restored as usual. But if a task executes an MSA instruction then it will save & restore the vector context forever more. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/6431/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
This commit is contained in:
parent
a5e9a69e2c
commit
1db1af84d6
10 changed files with 275 additions and 34 deletions
|
@ -32,6 +32,7 @@
|
|||
#include <asm/cpu.h>
|
||||
#include <asm/dsp.h>
|
||||
#include <asm/fpu.h>
|
||||
#include <asm/msa.h>
|
||||
#include <asm/pgtable.h>
|
||||
#include <asm/mipsregs.h>
|
||||
#include <asm/processor.h>
|
||||
|
@ -65,6 +66,8 @@ void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long sp)
|
|||
clear_used_math();
|
||||
clear_fpu_owner();
|
||||
init_dsp();
|
||||
clear_thread_flag(TIF_MSA_CTX_LIVE);
|
||||
disable_msa();
|
||||
regs->cp0_epc = pc;
|
||||
regs->regs[29] = sp;
|
||||
}
|
||||
|
@ -89,7 +92,9 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
|
|||
|
||||
preempt_disable();
|
||||
|
||||
if (is_fpu_owner())
|
||||
if (is_msa_enabled())
|
||||
save_msa(p);
|
||||
else if (is_fpu_owner())
|
||||
save_fp(p);
|
||||
|
||||
if (cpu_has_dsp)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue