]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.7.7/x86-boot-initialize-fpu-and-x86_feature_always-even-if-we-don-t-have-cpuid.patch
fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 4.7.7 / x86-boot-initialize-fpu-and-x86_feature_always-even-if-we-don-t-have-cpuid.patch
1 From 05fb3c199bb09f5b85de56cc3ede194ac95c5e1f Mon Sep 17 00:00:00 2001
2 From: Andy Lutomirski <luto@kernel.org>
3 Date: Wed, 28 Sep 2016 16:06:33 -0700
4 Subject: x86/boot: Initialize FPU and X86_FEATURE_ALWAYS even if we don't have CPUID
5
6 From: Andy Lutomirski <luto@kernel.org>
7
8 commit 05fb3c199bb09f5b85de56cc3ede194ac95c5e1f upstream.
9
10 Otherwise arch_task_struct_size == 0 and we die. While we're at it,
11 set X86_FEATURE_ALWAYS, too.
12
13 Reported-by: David Saggiorato <david@saggiorato.net>
14 Tested-by: David Saggiorato <david@saggiorato.net>
15 Signed-off-by: Andy Lutomirski <luto@kernel.org>
16 Cc: Borislav Petkov <bp@alien8.de>
17 Cc: Brian Gerst <brgerst@gmail.com>
18 Cc: Dave Hansen <dave@sr71.net>
19 Cc: Denys Vlasenko <dvlasenk@redhat.com>
20 Cc: H. Peter Anvin <hpa@zytor.com>
21 Cc: Josh Poimboeuf <jpoimboe@redhat.com>
22 Cc: Linus Torvalds <torvalds@linux-foundation.org>
23 Cc: Peter Zijlstra <peterz@infradead.org>
24 Cc: Thomas Gleixner <tglx@linutronix.de>
25 Fixes: aaeb5c01c5b ("x86/fpu, sched: Introduce CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT and use it on x86")
26 Link: http://lkml.kernel.org/r/8de723afbf0811071185039f9088733188b606c9.1475103911.git.luto@kernel.org
27 Signed-off-by: Ingo Molnar <mingo@kernel.org>
28 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
29
30 ---
31 arch/x86/kernel/cpu/common.c | 29 ++++++++++++++---------------
32 1 file changed, 14 insertions(+), 15 deletions(-)
33
34 --- a/arch/x86/kernel/cpu/common.c
35 +++ b/arch/x86/kernel/cpu/common.c
36 @@ -804,21 +804,20 @@ static void __init early_identify_cpu(st
37 identify_cpu_without_cpuid(c);
38
39 /* cyrix could have cpuid enabled via c_identify()*/
40 - if (!have_cpuid_p())
41 - return;
42 -
43 - cpu_detect(c);
44 - get_cpu_vendor(c);
45 - get_cpu_cap(c);
46 -
47 - if (this_cpu->c_early_init)
48 - this_cpu->c_early_init(c);
49 -
50 - c->cpu_index = 0;
51 - filter_cpuid_features(c, false);
52 -
53 - if (this_cpu->c_bsp_init)
54 - this_cpu->c_bsp_init(c);
55 + if (have_cpuid_p()) {
56 + cpu_detect(c);
57 + get_cpu_vendor(c);
58 + get_cpu_cap(c);
59 +
60 + if (this_cpu->c_early_init)
61 + this_cpu->c_early_init(c);
62 +
63 + c->cpu_index = 0;
64 + filter_cpuid_features(c, false);
65 +
66 + if (this_cpu->c_bsp_init)
67 + this_cpu->c_bsp_init(c);
68 + }
69
70 setup_force_cpu_cap(X86_FEATURE_ALWAYS);
71 fpu__init_system(c);