mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-28 05:24:47 +08:00
x86, fpu: Extend the use of static_cpu_has_safe
It may be necessary to save and restore the FPU context during EFI runtime
system services calls. However, this may happen during boot and before
alternatives have run. Thus, we need to use static_cpu_has_safe instead.
The rationale behind the use of static_cpu_has_safe is the same as in
commit 5f8c421814
("x86, fpu: Use static_cpu_has_safe
before alternatives") by Borislav Petkov.
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
Cc: Borislav Petkov <bp@suse.de>
This commit is contained in:
parent
62fa6e69a4
commit
c6b4069192
@ -87,22 +87,22 @@ static inline int is_x32_frame(void)
|
|||||||
|
|
||||||
static __always_inline __pure bool use_eager_fpu(void)
|
static __always_inline __pure bool use_eager_fpu(void)
|
||||||
{
|
{
|
||||||
return static_cpu_has(X86_FEATURE_EAGER_FPU);
|
return static_cpu_has_safe(X86_FEATURE_EAGER_FPU);
|
||||||
}
|
}
|
||||||
|
|
||||||
static __always_inline __pure bool use_xsaveopt(void)
|
static __always_inline __pure bool use_xsaveopt(void)
|
||||||
{
|
{
|
||||||
return static_cpu_has(X86_FEATURE_XSAVEOPT);
|
return static_cpu_has_safe(X86_FEATURE_XSAVEOPT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static __always_inline __pure bool use_xsave(void)
|
static __always_inline __pure bool use_xsave(void)
|
||||||
{
|
{
|
||||||
return static_cpu_has(X86_FEATURE_XSAVE);
|
return static_cpu_has_safe(X86_FEATURE_XSAVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static __always_inline __pure bool use_fxsr(void)
|
static __always_inline __pure bool use_fxsr(void)
|
||||||
{
|
{
|
||||||
return static_cpu_has(X86_FEATURE_FXSR);
|
return static_cpu_has_safe(X86_FEATURE_FXSR);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void fx_finit(struct i387_fxsave_struct *fx)
|
static inline void fx_finit(struct i387_fxsave_struct *fx)
|
||||||
@ -293,7 +293,7 @@ static inline int restore_fpu_checking(struct task_struct *tsk)
|
|||||||
/* AMD K7/K8 CPUs don't save/restore FDP/FIP/FOP unless an exception
|
/* AMD K7/K8 CPUs don't save/restore FDP/FIP/FOP unless an exception
|
||||||
is pending. Clear the x87 state here by setting it to fixed
|
is pending. Clear the x87 state here by setting it to fixed
|
||||||
values. "m" is a random variable that should be in L1 */
|
values. "m" is a random variable that should be in L1 */
|
||||||
if (unlikely(static_cpu_has(X86_FEATURE_FXSAVE_LEAK))) {
|
if (unlikely(static_cpu_has_safe(X86_FEATURE_FXSAVE_LEAK))) {
|
||||||
asm volatile(
|
asm volatile(
|
||||||
"fnclex\n\t"
|
"fnclex\n\t"
|
||||||
"emms\n\t"
|
"emms\n\t"
|
||||||
|
Loading…
Reference in New Issue
Block a user