From: Ingo Molnar Date: Sat, 25 Apr 2015 06:27:44 +0000 (+0200) Subject: x86/fpu: Do CLTS fpu__init_system() X-Git-Tag: v4.2-rc1~170^2~141 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=530b37e43ce3f0bb9969308c0a64901b442f8e0a;p=karo-tx-linux.git x86/fpu: Do CLTS fpu__init_system() mxcsr_feature_mask_init() depends on TS being cleared, as it executes an FXSAVE instruction. After later changes we will move the TS setup into fpu__init_cpu(), which will interact with this - so clear the TS flag explicitly. Reviewed-by: Borislav Petkov Cc: Andy Lutomirski Cc: Dave Hansen Cc: Fenghua Yu Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Oleg Nesterov Cc: Peter Zijlstra Cc: Thomas Gleixner Signed-off-by: Ingo Molnar --- diff --git a/arch/x86/kernel/fpu/init.c b/arch/x86/kernel/fpu/init.c index 2752b4bae854..567e7e6cdc6b 100644 --- a/arch/x86/kernel/fpu/init.c +++ b/arch/x86/kernel/fpu/init.c @@ -213,6 +213,13 @@ void fpu__init_system(void) /* The FPU has to be operational for some of the later FPU init activities: */ fpu__init_cpu(); + /* + * But don't leave CR0::TS set yet, as some of the FPU setup methods depend + * on being able to execute FPU instructions that will fault on a set TS, + * such as the FXSAVE in mxcsr_feature_mask_init(). + */ + clts(); + /* * Set up the legacy init FPU context. (xstate init might overwrite this * with a more modern format, if the CPU supports it.)