x86/fpu changes for v4.4
Subsystems (5)
Linus,
Please pull the latest x86-fpu-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-fpu-for-linus
# HEAD: 158ecc39185b885420e5136b803b29be2bbec7fb x86/fpu: Fixup uninitialized feature_name warning
There are two main areas of changes:
- Rework of the extended FPU state code to robustify the kernel's usage of cpuid provided xstate sizes - and related changes. (Dave Hansen)
- math emulation enhancements: new modern FPU instructions support, with testcases, plus cleanups. (Denys Vlasnko)
Thanks,
Ingo
------------------>
Borislav Petkov (1):
x86/fpu: Fixup uninitialized feature_name warning
Dave Hansen (15):
x86/fpu: Print xfeature buffer size in decimal x86/fpu: Move XSAVE-disabling code to a helper x86/fpu: Remove XSTATE_RESERVE
x86/fpu: Remove partial LWP support definitions x86/fpu: Rename XSAVE macros
x86/fpu: Rename XFEATURES_NR_MAX
x86/fpu: Rework XSTATE_* macros to remove magic '2' x86/fpu: Remove 'xfeature_nr'
x86/fpu: Add xfeature_enabled() helper instead of test_bit() x86/fpu/mpx: Rework MPX 'xstate' types
x86/fpu: Rework YMM definition
x86/fpu: Add C structures for AVX-512 state components x86/fpu: Correct and check XSAVE xstate size calculations x86/fpu: Check to ensure increasing-offset xstate offsets x86/fpu: Check CPU-provided sizes against struct declarations
Denys Vlasenko (7):
x86/fpu/math-emu: Remove !NO_UNDOC_CODE x86/fpu/math-emu, selftests: Add tests for FCMOV and FCOMI insns x86/fpu/math-emu: Remove define layer for undocumented opcodes x86/fpu/math-emu: Add support for F[U]COMI[P] insns x86/fpu/math-emu: Add support for FCMOVcc insns x86/fpu/math-emu, selftests: Add test for FISTTP instructions x86/fpu/math-emu: Add support for FISTTP instructions
arch/x86/crypto/camellia_aesni_avx2_glue.c | 3 +- arch/x86/crypto/camellia_aesni_avx_glue.c | 3 +- arch/x86/crypto/cast5_avx_glue.c | 3 +- arch/x86/crypto/cast6_avx_glue.c | 3 +- arch/x86/crypto/chacha20_glue.c | 2 +- arch/x86/crypto/poly1305_glue.c | 2 +- arch/x86/crypto/serpent_avx2_glue.c | 3 +- arch/x86/crypto/serpent_avx_glue.c | 3 +- arch/x86/crypto/sha1_ssse3_glue.c | 2 +- arch/x86/crypto/sha256_ssse3_glue.c | 2 +- arch/x86/crypto/sha512_ssse3_glue.c | 2 +- arch/x86/crypto/twofish_avx_glue.c | 2 +- arch/x86/include/asm/fpu/types.h | 148 +++++++---- arch/x86/include/asm/fpu/xstate.h | 15 +- arch/x86/include/asm/trace/mpx.h | 7 +- arch/x86/kernel/fpu/init.c | 18 +- arch/x86/kernel/fpu/regset.c | 4 +- arch/x86/kernel/fpu/signal.c | 6 +- arch/x86/kernel/fpu/xstate.c | 398 +++++++++++++++++++++++++---- arch/x86/kernel/traps.c | 4 +- arch/x86/kvm/cpuid.c | 4 +- arch/x86/kvm/x86.c | 27 +- arch/x86/kvm/x86.h | 6 +- arch/x86/math-emu/fpu_aux.c | 70 +++++ arch/x86/math-emu/fpu_entry.c | 96 +++---- arch/x86/math-emu/fpu_proto.h | 12 + arch/x86/math-emu/load_store.c | 63 ++++- arch/x86/math-emu/reg_compare.c | 128 ++++++++++ arch/x86/mm/mpx.c | 15 +- tools/testing/selftests/x86/Makefile | 5 +- tools/testing/selftests/x86/test_FCMOV.c | 93 +++++++ tools/testing/selftests/x86/test_FCOMI.c | 331 ++++++++++++++++++++++++ tools/testing/selftests/x86/test_FISTTP.c | 137 ++++++++++ 33 files changed, 1374 insertions(+), 243 deletions(-) create mode 100644 tools/testing/selftests/x86/test_FCMOV.c create mode 100644 tools/testing/selftests/x86/test_FCOMI.c create mode 100644 tools/testing/selftests/x86/test_FISTTP.c
arch/x86/crypto/camellia_aesni_avx2_glue.c +2 -1
@@ -567,7 +567,8 @@ static int __init camellia_aesni_init(void)return -ENODEV ; } -if (!cpu_has_xfeatures (XSTATE_SSE |XSTATE_YMM , &feature_name)) { +if (!cpu_has_xfeatures (XFEATURE_MASK_SSE |XFEATURE_MASK_YMM , + &feature_name)) {pr_info ("CPU feature '%s' is not supported.\n" , feature_name);return -ENODEV ; }
arch/x86/crypto/camellia_aesni_avx_glue.c +2 -1
@@ -554,7 +554,8 @@ static int __init camellia_aesni_init(void) {const char *feature_name; -if (!cpu_has_xfeatures (XSTATE_SSE |XSTATE_YMM , &feature_name)) { +if (!cpu_has_xfeatures (XFEATURE_MASK_SSE |XFEATURE_MASK_YMM , + &feature_name)) {pr_info ("CPU feature '%s' is not supported.\n" , feature_name);return -ENODEV ; }
arch/x86/crypto/cast5_avx_glue.c +2 -1
@@ -469,7 +469,8 @@ static int __init cast5_init(void) {const char *feature_name; -if (!cpu_has_xfeatures (XSTATE_SSE |XSTATE_YMM , &feature_name)) { +if (!cpu_has_xfeatures (XFEATURE_MASK_SSE |XFEATURE_MASK_YMM , + &feature_name)) {pr_info ("CPU feature '%s' is not supported.\n" , feature_name);return -ENODEV ; }
arch/x86/crypto/cast6_avx_glue.c +2 -1
@@ -591,7 +591,8 @@ static int __init cast6_init(void) {const char *feature_name; -if (!cpu_has_xfeatures (XSTATE_SSE |XSTATE_YMM , &feature_name)) { +if (!cpu_has_xfeatures (XFEATURE_MASK_SSE |XFEATURE_MASK_YMM , + &feature_name)) {pr_info ("CPU feature '%s' is not supported.\n" , feature_name);return -ENODEV ; }
arch/x86/crypto/chacha20_glue.c +1 -1
@@ -130,7 +130,7 @@ static int __init chacha20_simd_mod_init(void)#ifdef CONFIG_AS_AVX2 chacha20_use_avx2 = cpu_has_avx && cpu_has_avx2 && -cpu_has_xfeatures (XSTATE_SSE |XSTATE_YMM ,NULL ); +cpu_has_xfeatures (XFEATURE_MASK_SSE |XFEATURE_MASK_YMM ,NULL );#endif return crypto_register_alg (&alg); }
arch/x86/crypto/poly1305_glue.c +1 -1
@@ -184,7 +184,7 @@ static int __init poly1305_simd_mod_init(void)#ifdef CONFIG_AS_AVX2 poly1305_use_avx2 = cpu_has_avx && cpu_has_avx2 && -cpu_has_xfeatures (XSTATE_SSE |XSTATE_YMM ,NULL ); +cpu_has_xfeatures (XFEATURE_MASK_SSE |XFEATURE_MASK_YMM ,NULL ); alg.descsize =sizeof (struct poly1305_simd_desc_ctx );if (poly1305_use_avx2) alg.descsize +=10 *sizeof (u32);
arch/x86/crypto/serpent_avx2_glue.c +2 -1
@@ -542,7 +542,8 @@ static int __init init(void)pr_info ("AVX2 instructions are not detected.\n" );return -ENODEV ; } -if (!cpu_has_xfeatures (XSTATE_SSE |XSTATE_YMM , &feature_name)) { +if (!cpu_has_xfeatures (XFEATURE_MASK_SSE |XFEATURE_MASK_YMM , + &feature_name)) {pr_info ("CPU feature '%s' is not supported.\n" , feature_name);return -ENODEV ; }
arch/x86/crypto/serpent_avx_glue.c +2 -1
@@ -597,7 +597,8 @@ static int __init serpent_init(void) {const char *feature_name; -if (!cpu_has_xfeatures (XSTATE_SSE |XSTATE_YMM , &feature_name)) { +if (!cpu_has_xfeatures (XFEATURE_MASK_SSE |XFEATURE_MASK_YMM , + &feature_name)) {pr_info ("CPU feature '%s' is not supported.\n" , feature_name);return -ENODEV ; }
arch/x86/crypto/sha1_ssse3_glue.c +1 -1
@@ -121,7 +121,7 @@ static struct shash_alg alg = {#ifdef CONFIG_AS_AVX static bool __init avx_usable (void ) { -if (!cpu_has_xfeatures (XSTATE_SSE |XSTATE_YMM ,NULL )) { +if (!cpu_has_xfeatures (XFEATURE_MASK_SSE |XFEATURE_MASK_YMM ,NULL )) {if (cpu_has_avx)pr_info ("AVX detected but unusable.\n" );return false;
arch/x86/crypto/sha256_ssse3_glue.c +1 -1
@@ -130,7 +130,7 @@ static struct shash_alg algs[] = { {#ifdef CONFIG_AS_AVX static bool __init avx_usable (void ) { -if (!cpu_has_xfeatures (XSTATE_SSE |XSTATE_YMM ,NULL )) { +if (!cpu_has_xfeatures (XFEATURE_MASK_SSE |XFEATURE_MASK_YMM ,NULL )) {if (cpu_has_avx)pr_info ("AVX detected but unusable.\n" );return false;
arch/x86/crypto/sha512_ssse3_glue.c +1 -1
@@ -129,7 +129,7 @@ static struct shash_alg algs[] = { {#ifdef CONFIG_AS_AVX static bool __init avx_usable (void ) { -if (!cpu_has_xfeatures (XSTATE_SSE |XSTATE_YMM ,NULL )) { +if (!cpu_has_xfeatures (XFEATURE_MASK_SSE |XFEATURE_MASK_YMM ,NULL )) {if (cpu_has_avx)pr_info ("AVX detected but unusable.\n" );return false;
arch/x86/crypto/twofish_avx_glue.c +1 -1
@@ -558,7 +558,7 @@ static int __init twofish_init(void) {const char *feature_name; -if (!cpu_has_xfeatures (XSTATE_SSE |XSTATE_YMM , &feature_name)) { +if (!cpu_has_xfeatures (XFEATURE_MASK_SSE |XFEATURE_MASK_YMM , &feature_name)) {pr_info ("CPU feature '%s' is not supported.\n" , feature_name);return -ENODEV ; }
arch/x86/include/asm/fpu/types.h +103 -45
195 lines not on this page · raw message
arch/x86/include/asm/fpu/xstate.h +10 -5
@@ -6,7 +6,7 @@#include <linux/uaccess.h> /* Bit 63 of XCR0 is reserved for future expansion */ -#define XSTATE_EXTEND_MASK (~(XSTATE_FPSSE | (1ULL << 63))) +#define XFEATURE_MASK_EXTEND (~(XFEATURE_MASK_FPSSE | (1ULL << 63)))#define XSTATE_CPUID 0x0000000d
@@ -19,14 +19,18 @@#define XSAVE_YMM_OFFSET (XSAVE_HDR_SIZE + XSAVE_HDR_OFFSET)/* Supported features which support lazy state saving */ -#define XSTATE_LAZY (XSTATE_FP | XSTATE_SSE | XSTATE_YMM \ - | XSTATE_OPMASK | XSTATE_ZMM_Hi256 | XSTATE_Hi16_ZMM) +#define XFEATURE_MASK_LAZY (XFEATURE_MASK_FP | \ + XFEATURE_MASK_SSE | \ + XFEATURE_MASK_YMM | \ + XFEATURE_MASK_OPMASK | \ + XFEATURE_MASK_ZMM_Hi256 | \ + XFEATURE_MASK_Hi16_ZMM)/* Supported features which require eager state saving */ -#define XSTATE_EAGER (XSTATE_BNDREGS | XSTATE_BNDCSR) +#define XFEATURE_MASK_EAGER (XFEATURE_MASK_BNDREGS | XFEATURE_MASK_BNDCSR)/* All currently supported features */ -#define XCNTXT_MASK (XSTATE_LAZY | XSTATE_EAGER) +#define XCNTXT_MASK (XFEATURE_MASK_LAZY | XFEATURE_MASK_EAGER)#ifdef CONFIG_X86_64 #define REX_PREFIX "0x48, "
@@ -40,6 +44,7 @@ extern u64 xstate_fx_sw_bytes[USER_XSTATE_FX_SW_WORDS];extern void update_regset_xstate_info (unsigned int size,u64 xstate_mask); +void fpu__xstate_clear_all_cpu_caps (void );void *get_xsave_addr (struct xregs_state *xsave,int xstate);const void *get_xsave_field_ptr (int xstate_field);
arch/x86/include/asm/trace/mpx.h +4 -3
@@ -11,7 +11,7 @@ TRACE_EVENT(mpx_bounds_register_exception, TP_PROTO(void *addr_referenced, - const struct bndreg *bndreg), + const struct mpx_bndreg *bndreg), TP_ARGS(addr_referenced, bndreg), TP_STRUCT__entry(
@@ -44,7 +44,7 @@ TRACE_EVENT(mpx_bounds_register_exception, TRACE_EVENT(bounds_exception_mpx, - TP_PROTO(const struct bndcsr *bndcsr), + TP_PROTO(const struct mpx_bndcsr *bndcsr), TP_ARGS(bndcsr), TP_STRUCT__entry(
@@ -116,7 +116,8 @@ TRACE_EVENT(mpx_new_bounds_table,/* * This gets used outside of MPX-specific code, so we need a stub. */ -static inline void trace_bounds_exception_mpx (const struct bndcsr *bndcsr) +static inline +void trace_bounds_exception_mpx (const struct mpx_bndcsr *bndcsr) { }
arch/x86/kernel/fpu/init.c +4 -14
@@ -290,11 +290,11 @@ static void __init fpu__init_system_ctx_switch(void)if (cpu_has_xsaveopt && eagerfpu !=DISABLE ) eagerfpu =ENABLE ; -if (xfeatures_mask &XSTATE_EAGER ) { +if (xfeatures_mask &XFEATURE_MASK_EAGER ) {if (eagerfpu ==DISABLE ) {pr_err ("x86/fpu: eagerfpu switching disabled, disabling the following xstate features: 0x%llx.\n" , - xfeatures_mask &XSTATE_EAGER ); - xfeatures_mask &= ~XSTATE_EAGER ; + xfeatures_mask &XFEATURE_MASK_EAGER ); + xfeatures_mask &= ~XFEATURE_MASK_EAGER ; }else { eagerfpu =ENABLE ; }
@@ -354,17 +354,7 @@ static int __init x86_noxsave_setup(char *s)if (strlen (s))return 0 ; -setup_clear_cpu_cap (X86_FEATURE_XSAVE ); -setup_clear_cpu_cap (X86_FEATURE_XSAVEOPT ); -setup_clear_cpu_cap (X86_FEATURE_XSAVEC ); -setup_clear_cpu_cap (X86_FEATURE_XSAVES ); -setup_clear_cpu_cap (X86_FEATURE_AVX ); -setup_clear_cpu_cap (X86_FEATURE_AVX2 ); -setup_clear_cpu_cap (X86_FEATURE_AVX512F ); -setup_clear_cpu_cap (X86_FEATURE_AVX512PF ); -setup_clear_cpu_cap (X86_FEATURE_AVX512ER ); -setup_clear_cpu_cap (X86_FEATURE_AVX512CD ); -setup_clear_cpu_cap (X86_FEATURE_MPX ); +fpu__xstate_clear_all_cpu_caps ();return 1 ; }
arch/x86/kernel/fpu/regset.c +2 -2
@@ -66,7 +66,7 @@ int xfpregs_set(struct task_struct *target, const struct user_regset *regset,* presence of FP and SSE state. */ if (cpu_has_xsave) - fpu->state.xsave.header.xfeatures |=XSTATE_FPSSE ; + fpu->state.xsave.header.xfeatures |=XFEATURE_MASK_FPSSE ;return ret; }
@@ -326,7 +326,7 @@ int fpregs_set(struct task_struct *target, const struct user_regset *regset,* presence of FP. */ if (cpu_has_xsave) - fpu->state.xsave.header.xfeatures |=XSTATE_FP ; + fpu->state.xsave.header.xfeatures |=XFEATURE_MASK_FP ;return ret; }
arch/x86/kernel/fpu/signal.c +3 -3
@@ -107,7 +107,7 @@ static inline int save_xstate_epilog(void __user *buf, int ia32_frame)* header as well as change any contents in the memory layout. * xrestore as part of sigreturn will capture all the changes. */ - xfeatures |=XSTATE_FPSSE ; + xfeatures |=XFEATURE_MASK_FPSSE ; err |=__put_user (xfeatures, (__u32 *)&x->header.xfeatures);
@@ -207,7 +207,7 @@ sanitize_restored_xstate(struct task_struct *tsk,* layout and not enabled by the OS. */ if (fx_only) - header->xfeatures =XSTATE_FPSSE ; + header->xfeatures =XFEATURE_MASK_FPSSE ;else header->xfeatures &= (xfeatures_mask & xfeatures); }
@@ -230,7 +230,7 @@ static inline int copy_user_to_fpregs_zeroing(void __user *buf, u64 xbv, int fx_ {if (use_xsave ()) {if ((unsigned long )buf %64 || fx_only) { -u64 init_bv = xfeatures_mask & ~XSTATE_FPSSE ; +u64 init_bv = xfeatures_mask & ~XFEATURE_MASK_FPSSE ;copy_kernel_to_xregs (&init_fpstate.xsave, init_bv);return copy_user_to_fxregs (buf); }else {
arch/x86/kernel/fpu/xstate.c +345 -53
511 lines not on this page · raw message
arch/x86/kernel/traps.c +2 -2
@@ -361,7 +361,7 @@ dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code) dotraplinkage void do_bounds(struct pt_regs *regs, long error_code) { -const struct bndcsr *bndcsr; +const struct mpx_bndcsr *bndcsr;siginfo_t *info;RCU_LOCKDEP_WARN (!rcu_is_watching (),"entry code didn't wake RCU" );
@@ -384,7 +384,7 @@ dotraplinkage void do_bounds(struct pt_regs *regs, long error_code)* which is all zeros which indicates MPX was not * responsible for the exception. */ - bndcsr =get_xsave_field_ptr (XSTATE_BNDCSR ); + bndcsr =get_xsave_field_ptr (XFEATURE_MASK_BNDCSR );if (!bndcsr) goto exit_trap;
arch/x86/kvm/cpuid.c +2 -2
@@ -30,7 +30,7 @@ static u32 xstate_required_size(u64 xstate_bv, bool compacted)int feature_bit =0 ;u32 ret =XSAVE_HDR_SIZE +XSAVE_HDR_OFFSET ; - xstate_bv &=XSTATE_EXTEND_MASK ; + xstate_bv &=XFEATURE_MASK_EXTEND ;while (xstate_bv) {if (xstate_bv &0x1 ) {u32 eax, ebx, ecx, edx, offset;
@@ -51,7 +51,7 @@ u64 kvm_supported_xcr0(void)u64 xcr0 =KVM_SUPPORTED_XCR0 & host_xcr0;if (!kvm_x86_ops->mpx_supported ()) - xcr0 &= ~(XSTATE_BNDREGS |XSTATE_BNDCSR ); + xcr0 &= ~(XFEATURE_MASK_BNDREGS |XFEATURE_MASK_BNDCSR );return xcr0; }
arch/x86/kvm/x86.c +14 -13
@@ -662,9 +662,9 @@ static int __kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr)/* Only support XCR_XFEATURE_ENABLED_MASK(xcr0) now */ if (index !=XCR_XFEATURE_ENABLED_MASK )return 1 ; -if (!(xcr0 &XSTATE_FP )) +if (!(xcr0 &XFEATURE_MASK_FP ))return 1 ; -if ((xcr0 &XSTATE_YMM ) && !(xcr0 &XSTATE_SSE )) +if ((xcr0 &XFEATURE_MASK_YMM ) && !(xcr0 &XFEATURE_MASK_SSE ))return 1 ;/*
@@ -672,23 +672,24 @@ static int __kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr)* saving. However, xcr0 bit 0 is always set, even if the * emulated CPU does not support XSAVE (see fx_init). */ - valid_bits = vcpu->arch.guest_supported_xcr0 |XSTATE_FP ; + valid_bits = vcpu->arch.guest_supported_xcr0 |XFEATURE_MASK_FP ;if (xcr0 & ~valid_bits)return 1 ; -if ((!(xcr0 &XSTATE_BNDREGS )) != (!(xcr0 &XSTATE_BNDCSR ))) +if ((!(xcr0 &XFEATURE_MASK_BNDREGS )) != + (!(xcr0 &XFEATURE_MASK_BNDCSR )))return 1 ; -if (xcr0 &XSTATE_AVX512 ) { -if (!(xcr0 &XSTATE_YMM )) +if (xcr0 &XFEATURE_MASK_AVX512 ) { +if (!(xcr0 &XFEATURE_MASK_YMM ))return 1 ; -if ((xcr0 &XSTATE_AVX512 ) !=XSTATE_AVX512 ) +if ((xcr0 &XFEATURE_MASK_AVX512 ) !=XFEATURE_MASK_AVX512 )return 1 ; }kvm_put_guest_xcr0 (vcpu); vcpu->arch.xcr0 = xcr0; -if ((xcr0 ^ old_xcr0) &XSTATE_EXTEND_MASK ) +if ((xcr0 ^ old_xcr0) &XFEATURE_MASK_EXTEND )kvm_update_cpuid (vcpu);return 0 ; }
@@ -2906,7 +2907,7 @@ static void fill_xsave(u8 *dest, struct kvm_vcpu *vcpu)* Copy each region from the possibly compacted offset to the * non-compacted offset. */ - valid = xstate_bv & ~XSTATE_FPSSE ; + valid = xstate_bv & ~XFEATURE_MASK_FPSSE ;while (valid) {u64 feature = valid & -valid;int index =fls64 (feature) -1 ;
@@ -2944,7 +2945,7 @@ static void load_xsave(struct kvm_vcpu *vcpu, u8 *src)* Copy each region from the non-compacted offset to the * possibly compacted offset. */ - valid = xstate_bv & ~XSTATE_FPSSE ; + valid = xstate_bv & ~XFEATURE_MASK_FPSSE ;while (valid) {u64 feature = valid & -valid;int index =fls64 (feature) -1 ;
@@ -2972,7 +2973,7 @@ static void kvm_vcpu_ioctl_x86_get_xsave(struct kvm_vcpu *vcpu, &vcpu->arch.guest_fpu.state.fxsave, sizeof(struct fxregs_state)); *(u64 *)&guest_xsave->region[XSAVE_HDR_OFFSET /sizeof (u32)] = -XSTATE_FPSSE ; +XFEATURE_MASK_FPSSE ; } }
@@ -2992,7 +2993,7 @@ static int kvm_vcpu_ioctl_x86_set_xsave(struct kvm_vcpu *vcpu,return -EINVAL ;load_xsave (vcpu, (u8 *)guest_xsave->region); }else { -if (xstate_bv & ~XSTATE_FPSSE ) +if (xstate_bv & ~XFEATURE_MASK_FPSSE )return -EINVAL ;memcpy (&vcpu->arch.guest_fpu.state.fxsave, guest_xsave->region,sizeof (struct fxregs_state ));
@@ -7001,7 +7002,7 @@ static void fx_init(struct kvm_vcpu *vcpu)/* * Ensure guest xcr0 is valid for loading */ - vcpu->arch.xcr0 =XSTATE_FP ; + vcpu->arch.xcr0 =XFEATURE_MASK_FP ; vcpu->arch.cr0 |=X86_CR0_ET ; }
arch/x86/kvm/x86.h +3 -3
@@ -180,9 +180,9 @@ int kvm_mtrr_get_msr(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata);bool kvm_mtrr_check_gfn_range_consistency (struct kvm_vcpu *vcpu,gfn_t gfn,int page_num); -#define KVM_SUPPORTED_XCR0 (XSTATE_FP | XSTATE_SSE | XSTATE_YMM \ - | XSTATE_BNDREGS | XSTATE_BNDCSR \ - | XSTATE_AVX512) +#define KVM_SUPPORTED_XCR0 (XFEATURE_MASK_FP | XFEATURE_MASK_SSE \ + | XFEATURE_MASK_YMM | XFEATURE_MASK_BNDREGS \ + | XFEATURE_MASK_BNDCSR | XFEATURE_MASK_AVX512)extern u64 host_xcr0;extern u64 kvm_supported_xcr0 (void );
arch/x86/math-emu/fpu_aux.c +70 -0
76 lines not on this page · raw message
arch/x86/math-emu/fpu_entry.c +31 -65
116 lines not on this page · raw message
arch/x86/math-emu/fpu_proto.h +12 -0
@@ -46,6 +46,14 @@ extern void fstsw_(void);extern void fp_nop (void );extern void fld_i_ (void );extern void fxch_i (void ); +extern void fcmovb (void ); +extern void fcmove (void ); +extern void fcmovbe (void ); +extern void fcmovu (void ); +extern void fcmovnb (void ); +extern void fcmovne (void ); +extern void fcmovnbe (void ); +extern void fcmovnu (void );extern void ffree_ (void );extern void ffreep (void );extern void fst_i_ (void );
@@ -108,6 +116,10 @@ extern void fcompp(void);extern void fucom_ (void );extern void fucomp (void );extern void fucompp (void ); +extern void fcomi_ (void ); +extern void fcomip (void ); +extern void fucomi_ (void ); +extern void fucomip (void );/* reg_constant.c */ extern void fconst (void );/* reg_ld_str.c */
arch/x86/math-emu/load_store.c +51 -12
115 lines not on this page · raw message
arch/x86/math-emu/reg_compare.c +128 -0
143 lines not on this page · raw message
arch/x86/mm/mpx.c +8 -7
@@ -237,7 +237,8 @@ static int mpx_insn_decode(struct insn *insn,*/ siginfo_t *mpx_generate_siginfo (struct pt_regs *regs) { -const struct bndreg *bndregs, *bndreg; +const struct mpx_bndreg_state *bndregs; +const struct mpx_bndreg *bndreg;siginfo_t *info =NULL ;struct insn insn;uint8_t bndregno;
@@ -258,13 +259,13 @@ siginfo_t *mpx_generate_siginfo(struct pt_regs *regs) goto err_out; }/* get bndregs field from current task's xsave area */ - bndregs =get_xsave_field_ptr (XSTATE_BNDREGS ); + bndregs =get_xsave_field_ptr (XFEATURE_MASK_BNDREGS );if (!bndregs) { err = -EINVAL ; goto err_out; }/* now go select the individual register in the set of 4 */ - bndreg = &bndregs[bndregno]; + bndreg = &bndregs->bndreg[bndregno]; info =kzalloc (sizeof (*info),GFP_KERNEL );if (!info) {
@@ -306,7 +307,7 @@ siginfo_t *mpx_generate_siginfo(struct pt_regs *regs)static __user void *mpx_get_bounds_dir (void ) { -const struct bndcsr *bndcsr; +const struct mpx_bndcsr *bndcsr;if (!cpu_feature_enabled (X86_FEATURE_MPX ))return MPX_INVALID_BOUNDS_DIR ;
@@ -315,7 +316,7 @@ static __user void *mpx_get_bounds_dir(void)* The bounds directory pointer is stored in a register * only accessible if we first do an xsave. */ - bndcsr =get_xsave_field_ptr (XSTATE_BNDCSR ); + bndcsr =get_xsave_field_ptr (XFEATURE_MASK_BNDCSR );if (!bndcsr)return MPX_INVALID_BOUNDS_DIR ;
@@ -489,10 +490,10 @@ static int allocate_bt(struct mm_struct *mm, long __user *bd_entry)static int do_mpx_bt_fault (void ) {unsigned long bd_entry, bd_base; -const struct bndcsr *bndcsr; +const struct mpx_bndcsr *bndcsr;struct mm_struct *mm = current->mm; - bndcsr =get_xsave_field_ptr (XSTATE_BNDCSR ); + bndcsr =get_xsave_field_ptr (XFEATURE_MASK_BNDCSR );if (!bndcsr)return -EINVAL ;/*
tools/testing/selftests/x86/Makefile +3 -2
@@ -5,7 +5,8 @@ include ../lib.mk .PHONY: all all_32 all_64 warn_32bit_failure clean TARGETS_C_BOTHBITS := single_step_syscall sysret_ss_attrs ldt_gdt syscall_nt -TARGETS_C_32BIT_ONLY := entry_from_vm86 syscall_arg_fault sigreturn +TARGETS_C_32BIT_ONLY := entry_from_vm86 syscall_arg_fault sigreturn \ + test_FCMOV test_FCOMI test_FISTTP TARGETS_C_32BIT_ALL := $(TARGETS_C_BOTHBITS) $(TARGETS_C_32BIT_ONLY) BINARIES_32 := $(TARGETS_C_32BIT_ALL:%=%_32)
@@ -35,7 +36,7 @@ all_64: $(BINARIES_64) $(RM) $(BINARIES_32) $(BINARIES_64) $(TARGETS_C_32BIT_ALL:%=%_32): %_32: %.c - $(CC) -m32 -o $@ $(CFLAGS) $(EXTRA_CFLAGS) $^ -lrt -ldl + $(CC) -m32 -o $@ $(CFLAGS) $(EXTRA_CFLAGS) $^ -lrt -ldl -lm $(TARGETS_C_BOTHBITS:%=%_64): %_64: %.c $(CC) -m64 -o $@ $(CFLAGS) $(EXTRA_CFLAGS) $^ -lrt -ldl
tools/testing/selftests/x86/test_FCMOV.c new file +93 -0
93 lines not on this page · raw message
tools/testing/selftests/x86/test_FCOMI.c new file +331 -0
331 lines not on this page · raw message
tools/testing/selftests/x86/test_FISTTP.c new file +137 -0
137 lines not on this page · raw message