diff options
author | Rodrigo Vivi <rodrigo.vivi@intel.com> | 2021-07-13 15:51:31 -0400 |
---|---|---|
committer | Rodrigo Vivi <rodrigo.vivi@intel.com> | 2021-07-13 15:51:31 -0400 |
commit | d5bfbad214369f543958a1c6c55fa805e3f14976 (patch) | |
tree | 259bcb334acf9607d590721a5a5d3727b3dda769 /arch/riscv/include/asm/switch_to.h | |
parent | drm/i915/display/xelpd: Extend Wa_14011508470 (diff) | |
parent | Linux 5.14-rc1 (diff) | |
download | linux-dev-d5bfbad214369f543958a1c6c55fa805e3f14976.tar.xz linux-dev-d5bfbad214369f543958a1c6c55fa805e3f14976.zip |
Merge drm/drm-next into drm-intel-next
Catching up with 5.14-rc1
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Diffstat (limited to 'arch/riscv/include/asm/switch_to.h')
-rw-r--r-- | arch/riscv/include/asm/switch_to.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/arch/riscv/include/asm/switch_to.h b/arch/riscv/include/asm/switch_to.h index 407bcc96a710..0a3f4f95c555 100644 --- a/arch/riscv/include/asm/switch_to.h +++ b/arch/riscv/include/asm/switch_to.h @@ -6,6 +6,7 @@ #ifndef _ASM_RISCV_SWITCH_TO_H #define _ASM_RISCV_SWITCH_TO_H +#include <linux/jump_label.h> #include <linux/sched/task_stack.h> #include <asm/processor.h> #include <asm/ptrace.h> @@ -55,9 +56,13 @@ static inline void __switch_to_aux(struct task_struct *prev, fstate_restore(next, task_pt_regs(next)); } -extern bool has_fpu; +extern struct static_key_false cpu_hwcap_fpu; +static __always_inline bool has_fpu(void) +{ + return static_branch_likely(&cpu_hwcap_fpu); +} #else -#define has_fpu false +static __always_inline bool has_fpu(void) { return false; } #define fstate_save(task, regs) do { } while (0) #define fstate_restore(task, regs) do { } while (0) #define __switch_to_aux(__prev, __next) do { } while (0) @@ -70,7 +75,7 @@ extern struct task_struct *__switch_to(struct task_struct *, do { \ struct task_struct *__prev = (prev); \ struct task_struct *__next = (next); \ - if (has_fpu) \ + if (has_fpu()) \ __switch_to_aux(__prev, __next); \ ((last) = __switch_to(__prev, __next)); \ } while (0) |