Commit d13acede authored by Philippe Gerum's avatar Philippe Gerum
Browse files

arm64/ipipe: enable lazy/eager fpsimd switch mode

parent e4b6552f
......@@ -239,6 +239,9 @@ static inline unsigned long __ipipe_ffnz(unsigned long ul)
#define __ipipe_root_tick_p(regs) (!arch_irqs_disabled_flags(regs->pstate))
struct task_struct *ipipe_switch_to(struct task_struct *prev,
struct task_struct *next);
#else /* !CONFIG_IPIPE */
#define __ipipe_tsc_update() do { } while(0)
......
......@@ -94,11 +94,29 @@ static void __ipipe_halt_root(void)
cpu_do_idle();
}
}
#define FPSIMD_EN (0x3 << 20)
static inline void disable_fpsimd(void)
{
unsigned long cpacr;
__asm__ __volatile__("mrs %0, cpacr_el1": "=r"(cpacr));
cpacr &= ~FPSIMD_EN;
__asm__ __volatile__ (
"msr cpacr_el1, %0\n\t"
"isb"
: /* */ : "r"(cpacr));
}
#else /* !CONFIG_IPIPE */
static void __ipipe_halt_root(void)
{
cpu_do_idle();
}
static inline void disable_fpsimd(void)
{ }
#endif /* !CONFIG_IPIPE */
/*
......@@ -352,15 +370,19 @@ static void tls_thread_switch(struct task_struct *next)
/*
* Thread switching.
*/
struct task_struct *__switch_to(struct task_struct *prev,
struct task_struct *next)
static struct task_struct *__do_switch_to(struct task_struct *prev,
struct task_struct *next,
bool lazy_fpu)
{
struct task_struct *last;
unsigned long flags;
flags = hard_cond_local_irq_save();
fpsimd_thread_switch(next);
tls_thread_switch(next);
if (lazy_fpu)
disable_fpsimd();
else
fpsimd_thread_switch(next);
tls_thread_switch(next);
hw_breakpoint_thread_switch(next);
contextidr_thread_switch(next);
......@@ -377,6 +399,20 @@ struct task_struct *__switch_to(struct task_struct *prev,
return last;
}
struct task_struct *__switch_to(struct task_struct *prev,
struct task_struct *next)
{
return __do_switch_to(prev, next, false);
}
#ifdef CONFIG_IPIPE
struct task_struct *ipipe_switch_to(struct task_struct *prev,
struct task_struct *next)
{
return __do_switch_to(prev, next, true);
}
#endif
unsigned long get_wchan(struct task_struct *p)
{
struct stackframe frame;
......
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