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) ...@@ -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)) #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 */ #else /* !CONFIG_IPIPE */
#define __ipipe_tsc_update() do { } while(0) #define __ipipe_tsc_update() do { } while(0)
......
...@@ -94,11 +94,29 @@ static void __ipipe_halt_root(void) ...@@ -94,11 +94,29 @@ static void __ipipe_halt_root(void)
cpu_do_idle(); 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 */ #else /* !CONFIG_IPIPE */
static void __ipipe_halt_root(void) static void __ipipe_halt_root(void)
{ {
cpu_do_idle(); cpu_do_idle();
} }
static inline void disable_fpsimd(void)
{ }
#endif /* !CONFIG_IPIPE */ #endif /* !CONFIG_IPIPE */
/* /*
...@@ -352,15 +370,19 @@ static void tls_thread_switch(struct task_struct *next) ...@@ -352,15 +370,19 @@ static void tls_thread_switch(struct task_struct *next)
/* /*
* Thread switching. * Thread switching.
*/ */
struct task_struct *__switch_to(struct task_struct *prev, static struct task_struct *__do_switch_to(struct task_struct *prev,
struct task_struct *next) struct task_struct *next,
bool lazy_fpu)
{ {
struct task_struct *last; struct task_struct *last;
unsigned long flags; unsigned long flags;
flags = hard_cond_local_irq_save(); flags = hard_cond_local_irq_save();
fpsimd_thread_switch(next); if (lazy_fpu)
tls_thread_switch(next); disable_fpsimd();
else
fpsimd_thread_switch(next);
tls_thread_switch(next);
hw_breakpoint_thread_switch(next); hw_breakpoint_thread_switch(next);
contextidr_thread_switch(next); contextidr_thread_switch(next);
...@@ -377,6 +399,20 @@ struct task_struct *__switch_to(struct task_struct *prev, ...@@ -377,6 +399,20 @@ struct task_struct *__switch_to(struct task_struct *prev,
return last; 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) unsigned long get_wchan(struct task_struct *p)
{ {
struct stackframe frame; 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