From: Linus Torvalds Date: Thu, 21 Oct 2010 20:34:32 +0000 (-0700) Subject: Merge branch 'x86-fpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git... X-Git-Tag: firefly_0821_release~7613^2~3729 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=b6f7e38dbb310557fe890b04b1a376c93f638c3b;p=firefly-linux-kernel-4.4.55.git Merge branch 'x86-fpu-for-linus' of git://git./linux/kernel/git/tip/linux-2.6-tip * 'x86-fpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: x86, fpu: Merge fpu_save_init() x86-32, fpu: Rewrite fpu_save_init() x86, fpu: Remove PSHUFB_XMM5_* macros x86, fpu: Remove unnecessary ifdefs from i387 code. x86-32, fpu: Remove math_emulate stub x86-64, fpu: Simplify constraints for fxsave/fxtstor x86-64, fpu: Fix %cs value in convert_from_fxsr() x86-64, fpu: Disable preemption when using TS_USEDFPU x86, fpu: Merge __save_init_fpu() x86, fpu: Merge tolerant_fwait() x86, fpu: Merge fpu_init() x86: Use correct type for %cr4 x86, xsave: Disable xsave in i387 emulation mode Fixed up fxsaveq-induced conflict in arch/x86/include/asm/i387.h --- b6f7e38dbb310557fe890b04b1a376c93f638c3b diff --cc arch/x86/include/asm/i387.h index 70f105b352ee,70626ed96cb5..4aa2bb3b242a --- a/arch/x86/include/asm/i387.h +++ b/arch/x86/include/asm/i387.h @@@ -174,57 -140,26 +140,30 @@@ static inline void fpu_fxsave(struct fp /* Using "rex64; fxsave %0" is broken because, if the memory operand uses any extended registers for addressing, a second REX prefix will be generated (to the assembler, rex64 followed by semicolon - is a separate instruction), and hence the 64-bitness is lost. - Using "fxsaveq %0" would be the ideal choice, but is only supported - starting with gas 2.16. - asm volatile("fxsaveq %0" - : "=m" (fpu->state->fxsave)); - Using, as a workaround, the properly prefixed form below isn't + is a separate instruction), and hence the 64-bitness is lost. */ ++ +#ifdef CONFIG_AS_FXSAVEQ + /* Using "fxsaveq %0" would be the ideal choice, but is only supported + starting with gas 2.16. */ + __asm__ __volatile__("fxsaveq %0" + : "=m" (fpu->state->fxsave)); - #elif 0 ++#else + /* Using, as a workaround, the properly prefixed form below isn't accepted by any binutils version so far released, complaining that the same type of prefix is used twice if an extended register is - needed for addressing (fix submitted to mainline 2005-11-21). */ - __asm__ __volatile__("rex64/fxsave %0" - : "=m" (fpu->state->fxsave)); - #else - /* This, however, we can work around by forcing the compiler to select + needed for addressing (fix submitted to mainline 2005-11-21). + asm volatile("rex64/fxsave %0" + : "=m" (fpu->state->fxsave)); + This, however, we can work around by forcing the compiler to select an addressing mode that doesn't require extended registers. */ - __asm__ __volatile__("rex64/fxsave (%1)" - : "=m" (fpu->state->fxsave) - : "cdaSDb" (&fpu->state->fxsave)); + asm volatile("rex64/fxsave (%[fx])" + : "=m" (fpu->state->fxsave) + : [fx] "R" (&fpu->state->fxsave)); +#endif } - static inline void fpu_save_init(struct fpu *fpu) - { - if (use_xsave()) - fpu_xsave(fpu); - else - fpu_fxsave(fpu); - - fpu_clear(fpu); - } - - static inline void __save_init_fpu(struct task_struct *tsk) - { - fpu_save_init(&tsk->thread.fpu); - task_thread_info(tsk)->status &= ~TS_USEDFPU; - } - #else /* CONFIG_X86_32 */ - #ifdef CONFIG_MATH_EMULATION - extern void finit_soft_fpu(struct i387_soft_struct *soft); - #else - static inline void finit_soft_fpu(struct i387_soft_struct *soft) {} - #endif - - static inline void tolerant_fwait(void) - { - asm volatile("fnclex ; fwait"); - } - /* perform fxrstor iff the processor has extended states, otherwise frstor */ static inline int fxrstor_checking(struct i387_fxsave_struct *fx) {