1*126fe040SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0 */ 2*126fe040SThomas Gleixner #ifndef __X86_KERNEL_FPU_XSTATE_H 3*126fe040SThomas Gleixner #define __X86_KERNEL_FPU_XSTATE_H 4*126fe040SThomas Gleixner 5*126fe040SThomas Gleixner #include <asm/cpufeature.h> 6*126fe040SThomas Gleixner #include <asm/fpu/xstate.h> 7*126fe040SThomas Gleixner 8*126fe040SThomas Gleixner static inline void xstate_init_xcomp_bv(struct xregs_state *xsave, u64 mask) 9*126fe040SThomas Gleixner { 10*126fe040SThomas Gleixner /* 11*126fe040SThomas Gleixner * XRSTORS requires these bits set in xcomp_bv, or it will 12*126fe040SThomas Gleixner * trigger #GP: 13*126fe040SThomas Gleixner */ 14*126fe040SThomas Gleixner if (cpu_feature_enabled(X86_FEATURE_XSAVES)) 15*126fe040SThomas Gleixner xsave->header.xcomp_bv = mask | XCOMP_BV_COMPACTED_FORMAT; 16*126fe040SThomas Gleixner } 17*126fe040SThomas Gleixner 18*126fe040SThomas Gleixner #endif 19