]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.0.90/x86-fpu-correct-the-asm-constraints-for-fxsave-unbreak-mxcsr.daz.patch
drop queue-4.14/mips-make-sure-dt-memory-regions-are-valid.patch
[thirdparty/kernel/stable-queue.git] / releases / 3.0.90 / x86-fpu-correct-the-asm-constraints-for-fxsave-unbreak-mxcsr.daz.patch
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
5
6 From: "H.J. Lu" <hjl.tools@gmail.com>
7
8 commit eaa5a990191d204ba0f9d35dbe5505ec2cdd1460 upstream.
9
10 GCC will optimize mxcsr_feature_mask_init in arch/x86/kernel/i387.c:
11
12 memset(&fx_scratch, 0, sizeof(struct i387_fxsave_struct));
13 asm volatile("fxsave %0" : : "m" (fx_scratch));
14 mask = fx_scratch.mxcsr_mask;
15 if (mask == 0)
16 mask = 0x0000ffbf;
17
18 to
19
20 memset(&fx_scratch, 0, sizeof(struct i387_fxsave_struct));
21 asm volatile("fxsave %0" : : "m" (fx_scratch));
22 mask = 0x0000ffbf;
23
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.
27
28 Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
29 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
30
31 ---
32 arch/x86/kernel/i387.c | 2 +-
33 1 file changed, 1 insertion(+), 1 deletion(-)
34
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
38 clts();
39 if (cpu_has_fxsr) {
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;
44 if (mask == 0)
45 mask = 0x0000ffbf;