xref: /linux/arch/x86/include/asm/cpu.h (revision 40286d6379aacfcc053253ef78dc78b09addffda)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_X86_CPU_H
3 #define _ASM_X86_CPU_H
4 
5 #include <linux/device.h>
6 #include <linux/cpu.h>
7 #include <linux/topology.h>
8 #include <linux/nodemask.h>
9 #include <linux/percpu.h>
10 #include <asm/ibt.h>
11 
12 #ifndef CONFIG_SMP
13 #define cpu_physical_id(cpu)			boot_cpu_physical_apicid
14 #endif /* CONFIG_SMP */
15 
16 #ifdef CONFIG_HOTPLUG_CPU
17 extern void soft_restart_cpu(void);
18 #endif
19 
20 extern void ap_init_aperfmperf(void);
21 
22 int mwait_usable(const struct cpuinfo_x86 *);
23 
24 unsigned int x86_family(unsigned int sig);
25 unsigned int x86_model(unsigned int sig);
26 unsigned int x86_stepping(unsigned int sig);
27 #ifdef CONFIG_X86_BUS_LOCK_DETECT
28 extern void __init sld_setup(struct cpuinfo_x86 *c);
29 extern bool handle_user_split_lock(struct pt_regs *regs, long error_code);
30 extern bool handle_guest_split_lock(unsigned long ip);
31 extern void handle_bus_lock(struct pt_regs *regs);
32 void split_lock_init(void);
33 void bus_lock_init(void);
34 #else
35 static inline void __init sld_setup(struct cpuinfo_x86 *c) {}
36 static inline bool handle_user_split_lock(struct pt_regs *regs, long error_code)
37 {
38 	return false;
39 }
40 
41 static inline bool handle_guest_split_lock(unsigned long ip)
42 {
43 	return false;
44 }
45 
46 static inline void handle_bus_lock(struct pt_regs *regs) {}
47 static inline void split_lock_init(void) {}
48 static inline void bus_lock_init(void) {}
49 #endif
50 
51 #ifdef CONFIG_IA32_FEAT_CTL
52 void init_ia32_feat_ctl(struct cpuinfo_x86 *c);
53 #else
54 static inline void init_ia32_feat_ctl(struct cpuinfo_x86 *c) {}
55 #endif
56 
57 extern __noendbr void cet_disable(void);
58 
59 struct cpu_signature;
60 
61 void intel_collect_cpu_info(struct cpu_signature *sig);
62 
63 extern u64 x86_read_arch_cap_msr(void);
64 bool intel_find_matching_signature(void *mc, struct cpu_signature *sig);
65 int intel_microcode_sanity_check(void *mc, bool print_err, int hdr_type);
66 
67 extern struct cpumask cpus_stop_mask;
68 
69 #endif /* _ASM_X86_CPU_H */
70