1 From eaa5a990191d204ba0f9d35dbe5505ec2cdd1460 Mon Sep 17 00:00:00 2001
2 From: "H.J. Lu" <hjl.tools@gmail.com>
3 Date: Fri, 26 Jul 2013 09:11:56 -0700
4 Subject: x86, fpu: correct the asm constraints for fxsave, unbreak mxcsr.daz
6 From: "H.J. Lu" <hjl.tools@gmail.com>
8 commit eaa5a990191d204ba0f9d35dbe5505ec2cdd1460 upstream.
10 GCC will optimize mxcsr_feature_mask_init in arch/x86/kernel/i387.c:
12 memset(&fx_scratch, 0, sizeof(struct i387_fxsave_struct));
13 asm volatile("fxsave %0" : : "m" (fx_scratch));
14 mask = fx_scratch.mxcsr_mask;
20 memset(&fx_scratch, 0, sizeof(struct i387_fxsave_struct));
21 asm volatile("fxsave %0" : : "m" (fx_scratch));
24 since asm statement doesn’t say it will update fx_scratch. As the
25 result, the DAZ bit will be cleared. This patch fixes it. This bug
26 dates back to at least kernel 2.6.12.
28 Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
29 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
32 arch/x86/kernel/i387.c | 2 +-
33 1 file changed, 1 insertion(+), 1 deletion(-)
35 --- a/arch/x86/kernel/i387.c
36 +++ b/arch/x86/kernel/i387.c
37 @@ -51,7 +51,7 @@ void __cpuinit mxcsr_feature_mask_init(v
40 memset(&fx_scratch, 0, sizeof(struct i387_fxsave_struct));
41 - asm volatile("fxsave %0" : : "m" (fx_scratch));
42 + asm volatile("fxsave %0" : "+m" (fx_scratch));
43 mask = fx_scratch.mxcsr_mask;