]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - arch/x86/kernel/cpu/bugs.c
Merge tag 'for-linus-4.15-rc7-tag' of git://git.kernel.org/pub/scm/linux/kernel/git...
[mirror_ubuntu-bionic-kernel.git] / arch / x86 / kernel / cpu / bugs.c
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Copyright (C) 1994 Linus Torvalds
4 *
5 * Cyrix stuff, June 1998 by:
6 * - Rafael R. Reilova (moved everything from head.S),
7 * <rreilova@ececs.uc.edu>
8 * - Channing Corn (tests & fixes),
9 * - Andrew D. Balsa (code cleanup).
10 */
11 #include <linux/init.h>
12 #include <linux/utsname.h>
13 #include <asm/bugs.h>
14 #include <asm/processor.h>
15 #include <asm/processor-flags.h>
16 #include <asm/fpu/internal.h>
17 #include <asm/msr.h>
18 #include <asm/paravirt.h>
19 #include <asm/alternative.h>
20 #include <asm/pgtable.h>
21 #include <asm/set_memory.h>
22
23 void __init check_bugs(void)
24 {
25 identify_boot_cpu();
26
27 if (!IS_ENABLED(CONFIG_SMP)) {
28 pr_info("CPU: ");
29 print_cpu_info(&boot_cpu_data);
30 }
31
32 #ifdef CONFIG_X86_32
33 /*
34 * Check whether we are able to run this kernel safely on SMP.
35 *
36 * - i386 is no longer supported.
37 * - In order to run on anything without a TSC, we need to be
38 * compiled for a i486.
39 */
40 if (boot_cpu_data.x86 < 4)
41 panic("Kernel requires i486+ for 'invlpg' and other features");
42
43 init_utsname()->machine[1] =
44 '0' + (boot_cpu_data.x86 > 6 ? 6 : boot_cpu_data.x86);
45 alternative_instructions();
46
47 fpu__init_check_bugs();
48 #else /* CONFIG_X86_64 */
49 alternative_instructions();
50
51 /*
52 * Make sure the first 2MB area is not mapped by huge pages
53 * There are typically fixed size MTRRs in there and overlapping
54 * MTRRs into large pages causes slow downs.
55 *
56 * Right now we don't do that with gbpages because there seems
57 * very little benefit for that case.
58 */
59 if (!direct_gbpages)
60 set_memory_4k((unsigned long)__va(0), 1);
61 #endif
62 }