cpu.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_X86_CPU_H
  3. #define _ASM_X86_CPU_H
  4. #include <linux/device.h>
  5. #include <linux/cpu.h>
  6. #include <linux/topology.h>
  7. #include <linux/nodemask.h>
  8. #include <linux/percpu.h>
  9. #include <asm/ibt.h>
  10. #ifdef CONFIG_SMP
  11. extern void prefill_possible_map(void);
  12. #else /* CONFIG_SMP */
  13. static inline void prefill_possible_map(void) {}
  14. #define cpu_physical_id(cpu) boot_cpu_physical_apicid
  15. #define cpu_acpi_id(cpu) 0
  16. #define safe_smp_processor_id() 0
  17. #endif /* CONFIG_SMP */
  18. struct x86_cpu {
  19. struct cpu cpu;
  20. };
  21. #ifdef CONFIG_HOTPLUG_CPU
  22. extern int arch_register_cpu(int num);
  23. extern void arch_unregister_cpu(int);
  24. extern void start_cpu0(void);
  25. #ifdef CONFIG_DEBUG_HOTPLUG_CPU0
  26. extern int _debug_hotplug_cpu(int cpu, int action);
  27. #endif
  28. #endif
  29. extern void ap_init_aperfmperf(void);
  30. int mwait_usable(const struct cpuinfo_x86 *);
  31. unsigned int x86_family(unsigned int sig);
  32. unsigned int x86_model(unsigned int sig);
  33. unsigned int x86_stepping(unsigned int sig);
  34. #ifdef CONFIG_CPU_SUP_INTEL
  35. extern void __init sld_setup(struct cpuinfo_x86 *c);
  36. extern bool handle_user_split_lock(struct pt_regs *regs, long error_code);
  37. extern bool handle_guest_split_lock(unsigned long ip);
  38. extern void handle_bus_lock(struct pt_regs *regs);
  39. u8 get_this_hybrid_cpu_type(void);
  40. #else
  41. static inline void __init sld_setup(struct cpuinfo_x86 *c) {}
  42. static inline bool handle_user_split_lock(struct pt_regs *regs, long error_code)
  43. {
  44. return false;
  45. }
  46. static inline bool handle_guest_split_lock(unsigned long ip)
  47. {
  48. return false;
  49. }
  50. static inline void handle_bus_lock(struct pt_regs *regs) {}
  51. static inline u8 get_this_hybrid_cpu_type(void)
  52. {
  53. return 0;
  54. }
  55. #endif
  56. #ifdef CONFIG_IA32_FEAT_CTL
  57. void init_ia32_feat_ctl(struct cpuinfo_x86 *c);
  58. #else
  59. static inline void init_ia32_feat_ctl(struct cpuinfo_x86 *c) {}
  60. #endif
  61. extern __noendbr void cet_disable(void);
  62. struct ucode_cpu_info;
  63. int intel_cpu_collect_info(struct ucode_cpu_info *uci);
  64. static inline bool intel_cpu_signatures_match(unsigned int s1, unsigned int p1,
  65. unsigned int s2, unsigned int p2)
  66. {
  67. if (s1 != s2)
  68. return false;
  69. /* Processor flags are either both 0 ... */
  70. if (!p1 && !p2)
  71. return true;
  72. /* ... or they intersect. */
  73. return p1 & p2;
  74. }
  75. extern u64 x86_read_arch_cap_msr(void);
  76. extern struct cpumask cpus_stop_mask;
  77. #endif /* _ASM_X86_CPU_H */