cpu.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef ARCH_X86_CPU_H
  3. #define ARCH_X86_CPU_H
  4. /* attempt to consolidate cpu attributes */
  5. struct cpu_dev {
  6. const char *c_vendor;
  7. /* some have two possibilities for cpuid string */
  8. const char *c_ident[2];
  9. void (*c_early_init)(struct cpuinfo_x86 *);
  10. void (*c_bsp_init)(struct cpuinfo_x86 *);
  11. void (*c_init)(struct cpuinfo_x86 *);
  12. void (*c_identify)(struct cpuinfo_x86 *);
  13. void (*c_detect_tlb)(struct cpuinfo_x86 *);
  14. int c_x86_vendor;
  15. #ifdef CONFIG_X86_32
  16. /* Optional vendor specific routine to obtain the cache size. */
  17. unsigned int (*legacy_cache_size)(struct cpuinfo_x86 *,
  18. unsigned int);
  19. /* Family/stepping-based lookup table for model names. */
  20. struct legacy_cpu_model_info {
  21. int family;
  22. const char *model_names[16];
  23. } legacy_models[5];
  24. #endif
  25. };
  26. struct _tlb_table {
  27. unsigned char descriptor;
  28. char tlb_type;
  29. unsigned int entries;
  30. /* unsigned int ways; */
  31. char info[128];
  32. };
  33. #define cpu_dev_register(cpu_devX) \
  34. static const struct cpu_dev *const __cpu_dev_##cpu_devX __used \
  35. __section(".x86_cpu_dev.init") = \
  36. &cpu_devX;
  37. extern const struct cpu_dev *const __x86_cpu_dev_start[],
  38. *const __x86_cpu_dev_end[];
  39. #ifdef CONFIG_CPU_SUP_INTEL
  40. enum tsx_ctrl_states {
  41. TSX_CTRL_ENABLE,
  42. TSX_CTRL_DISABLE,
  43. TSX_CTRL_RTM_ALWAYS_ABORT,
  44. TSX_CTRL_NOT_SUPPORTED,
  45. };
  46. extern __ro_after_init enum tsx_ctrl_states tsx_ctrl_state;
  47. extern void __init tsx_init(void);
  48. void tsx_ap_init(void);
  49. #else
  50. static inline void tsx_init(void) { }
  51. static inline void tsx_ap_init(void) { }
  52. #endif /* CONFIG_CPU_SUP_INTEL */
  53. extern void init_spectral_chicken(struct cpuinfo_x86 *c);
  54. extern void get_cpu_cap(struct cpuinfo_x86 *c);
  55. extern void get_cpu_address_sizes(struct cpuinfo_x86 *c);
  56. extern void cpu_detect_cache_sizes(struct cpuinfo_x86 *c);
  57. extern void init_scattered_cpuid_features(struct cpuinfo_x86 *c);
  58. extern void init_intel_cacheinfo(struct cpuinfo_x86 *c);
  59. extern void init_amd_cacheinfo(struct cpuinfo_x86 *c);
  60. extern void init_hygon_cacheinfo(struct cpuinfo_x86 *c);
  61. extern void detect_num_cpu_cores(struct cpuinfo_x86 *c);
  62. extern int detect_extended_topology_early(struct cpuinfo_x86 *c);
  63. extern int detect_extended_topology(struct cpuinfo_x86 *c);
  64. extern int detect_ht_early(struct cpuinfo_x86 *c);
  65. extern void detect_ht(struct cpuinfo_x86 *c);
  66. extern void check_null_seg_clears_base(struct cpuinfo_x86 *c);
  67. unsigned int aperfmperf_get_khz(int cpu);
  68. void cpu_select_mitigations(void);
  69. extern void x86_spec_ctrl_setup_ap(void);
  70. extern void update_srbds_msr(void);
  71. extern void update_gds_msr(void);
  72. extern u64 x86_read_arch_cap_msr(void);
  73. #endif /* ARCH_X86_CPU_H */