Jeremy Fitzhardinge | 1353ebb | 2007-05-02 19:27:12 +0200 | [diff] [blame] | 1 | /* |
Jeremy Fitzhardinge | 1353ebb | 2007-05-02 19:27:12 +0200 | [diff] [blame] | 2 | * Copyright (C) 1994 Linus Torvalds |
| 3 | * |
| 4 | * Cyrix stuff, June 1998 by: |
| 5 | * - Rafael R. Reilova (moved everything from head.S), |
| 6 | * <rreilova@ececs.uc.edu> |
| 7 | * - Channing Corn (tests & fixes), |
| 8 | * - Andrew D. Balsa (code cleanup). |
| 9 | */ |
| 10 | #include <linux/init.h> |
| 11 | #include <linux/utsname.h> |
Josh Triplett | 91eb1b7 | 2007-07-31 00:39:20 -0700 | [diff] [blame] | 12 | #include <asm/bugs.h> |
Jeremy Fitzhardinge | 1353ebb | 2007-05-02 19:27:12 +0200 | [diff] [blame] | 13 | #include <asm/processor.h> |
Dave Jones | 7ebad70 | 2008-01-30 13:30:39 +0100 | [diff] [blame] | 14 | #include <asm/processor-flags.h> |
Ingo Molnar | 952f07e | 2015-04-26 16:56:05 +0200 | [diff] [blame] | 15 | #include <asm/fpu/internal.h> |
Jeremy Fitzhardinge | 1353ebb | 2007-05-02 19:27:12 +0200 | [diff] [blame] | 16 | #include <asm/msr.h> |
| 17 | #include <asm/paravirt.h> |
| 18 | #include <asm/alternative.h> |
Borislav Petkov | 62a67e1 | 2016-10-24 19:38:43 +0200 | [diff] [blame] | 19 | #include <asm/pgtable.h> |
Laura Abbott | d116365 | 2017-05-08 15:58:11 -0700 | [diff] [blame] | 20 | #include <asm/set_memory.h> |
Jeremy Fitzhardinge | 1353ebb | 2007-05-02 19:27:12 +0200 | [diff] [blame] | 21 | |
Jeremy Fitzhardinge | 1353ebb | 2007-05-02 19:27:12 +0200 | [diff] [blame] | 22 | void __init check_bugs(void) |
| 23 | { |
| 24 | identify_boot_cpu(); |
Borislav Petkov | 55a36b6 | 2013-04-08 17:57:44 +0200 | [diff] [blame] | 25 | |
Borislav Petkov | 62a67e1 | 2016-10-24 19:38:43 +0200 | [diff] [blame] | 26 | if (!IS_ENABLED(CONFIG_SMP)) { |
| 27 | pr_info("CPU: "); |
| 28 | print_cpu_info(&boot_cpu_data); |
| 29 | } |
| 30 | |
| 31 | #ifdef CONFIG_X86_32 |
Borislav Petkov | 55a36b6 | 2013-04-08 17:57:44 +0200 | [diff] [blame] | 32 | /* |
| 33 | * Check whether we are able to run this kernel safely on SMP. |
| 34 | * |
| 35 | * - i386 is no longer supported. |
| 36 | * - In order to run on anything without a TSC, we need to be |
| 37 | * compiled for a i486. |
| 38 | */ |
| 39 | if (boot_cpu_data.x86 < 4) |
| 40 | panic("Kernel requires i486+ for 'invlpg' and other features"); |
| 41 | |
Miklos Vajna | bfe4bb1 | 2008-05-17 22:48:13 +0200 | [diff] [blame] | 42 | init_utsname()->machine[1] = |
| 43 | '0' + (boot_cpu_data.x86 > 6 ? 6 : boot_cpu_data.x86); |
Jeremy Fitzhardinge | 1353ebb | 2007-05-02 19:27:12 +0200 | [diff] [blame] | 44 | alternative_instructions(); |
Suresh Siddha | 304bced | 2012-08-24 14:13:02 -0700 | [diff] [blame] | 45 | |
Ingo Molnar | 4d16409 | 2015-04-22 13:44:25 +0200 | [diff] [blame] | 46 | fpu__init_check_bugs(); |
Borislav Petkov | 62a67e1 | 2016-10-24 19:38:43 +0200 | [diff] [blame] | 47 | #else /* CONFIG_X86_64 */ |
| 48 | alternative_instructions(); |
| 49 | |
| 50 | /* |
| 51 | * Make sure the first 2MB area is not mapped by huge pages |
| 52 | * There are typically fixed size MTRRs in there and overlapping |
| 53 | * MTRRs into large pages causes slow downs. |
| 54 | * |
| 55 | * Right now we don't do that with gbpages because there seems |
| 56 | * very little benefit for that case. |
| 57 | */ |
| 58 | if (!direct_gbpages) |
| 59 | set_memory_4k((unsigned long)__va(0), 1); |
| 60 | #endif |
Jeremy Fitzhardinge | 1353ebb | 2007-05-02 19:27:12 +0200 | [diff] [blame] | 61 | } |