bugs.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  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>
  12. #include <asm/bugs.h>
  13. #include <asm/processor.h>
  14. #include <asm/processor-flags.h>
  15. #include <asm/fpu/internal.h>
  16. #include <asm/msr.h>
  17. #include <asm/paravirt.h>
  18. #include <asm/alternative.h>
  19. #include <asm/pgtable.h>
  20. #include <asm/cacheflush.h>
  21. void __init check_bugs(void)
  22. {
  23. identify_boot_cpu();
  24. if (!IS_ENABLED(CONFIG_SMP)) {
  25. pr_info("CPU: ");
  26. print_cpu_info(&boot_cpu_data);
  27. }
  28. #ifdef CONFIG_X86_32
  29. /*
  30. * Check whether we are able to run this kernel safely on SMP.
  31. *
  32. * - i386 is no longer supported.
  33. * - In order to run on anything without a TSC, we need to be
  34. * compiled for a i486.
  35. */
  36. if (boot_cpu_data.x86 < 4)
  37. panic("Kernel requires i486+ for 'invlpg' and other features");
  38. init_utsname()->machine[1] =
  39. '0' + (boot_cpu_data.x86 > 6 ? 6 : boot_cpu_data.x86);
  40. alternative_instructions();
  41. fpu__init_check_bugs();
  42. #else /* CONFIG_X86_64 */
  43. alternative_instructions();
  44. /*
  45. * Make sure the first 2MB area is not mapped by huge pages
  46. * There are typically fixed size MTRRs in there and overlapping
  47. * MTRRs into large pages causes slow downs.
  48. *
  49. * Right now we don't do that with gbpages because there seems
  50. * very little benefit for that case.
  51. */
  52. if (!direct_gbpages)
  53. set_memory_4k((unsigned long)__va(0), 1);
  54. #endif
  55. }