diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2021-10-15 03:16:23 +0200 |
---|---|---|
committer | Borislav Petkov <bp@suse.de> | 2021-10-20 15:27:28 +0200 |
commit | b579d0c3750eedc0dee433edaba88206a8e4348a (patch) | |
tree | 10c4b551b2d369e89095b16587bf181add984160 /arch/x86/kernel/fpu/xstate.c | |
parent | d06241f52cfe4a0580856ef2cfac90dc7f752cae (diff) | |
download | linux-b579d0c3750eedc0dee433edaba88206a8e4348a.tar.bz2 |
x86/fpu: Make os_xrstor_booting() private
It's only required in the xstate init code.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20211015011539.455836597@linutronix.de
Diffstat (limited to 'arch/x86/kernel/fpu/xstate.c')
-rw-r--r-- | arch/x86/kernel/fpu/xstate.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c index 1f5a66a38671..b712c06cbbfb 100644 --- a/arch/x86/kernel/fpu/xstate.c +++ b/arch/x86/kernel/fpu/xstate.c @@ -351,6 +351,29 @@ static void __init print_xstate_offset_size(void) } /* + * This function is called only during boot time when x86 caps are not set + * up and alternative can not be used yet. + */ +static __init void os_xrstor_booting(struct xregs_state *xstate) +{ + u64 mask = xfeatures_mask_fpstate(); + u32 lmask = mask; + u32 hmask = mask >> 32; + int err; + + if (cpu_feature_enabled(X86_FEATURE_XSAVES)) + XSTATE_OP(XRSTORS, xstate, lmask, hmask, err); + else + XSTATE_OP(XRSTOR, xstate, lmask, hmask, err); + + /* + * We should never fault when copying from a kernel buffer, and the FPU + * state we set at boot time should be valid. + */ + WARN_ON_FPU(err); +} + +/* * All supported features have either init state all zeros or are * handled in setup_init_fpu() individually. This is an explicit * feature list and does not use XFEATURE_MASK*SUPPORTED to catch |