xref: /linux/arch/x86/include/asm/cpu.h (revision 79790b6818e96c58fe2bffee1b418c16e64e7b80)
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 #define cpu_acpi_id(cpu)			0
15 #define safe_smp_processor_id()			0
16 #endif /* CONFIG_SMP */
17 
18 #ifdef CONFIG_HOTPLUG_CPU
19 extern void soft_restart_cpu(void);
20 #endif
21 
22 extern void ap_init_aperfmperf(void);
23 
24 int mwait_usable(const struct cpuinfo_x86 *);
25 
26 unsigned int x86_family(unsigned int sig);
27 unsigned int x86_model(unsigned int sig);
28 unsigned int x86_stepping(unsigned int sig);
29 #ifdef CONFIG_CPU_SUP_INTEL
30 extern void __init sld_setup(struct cpuinfo_x86 *c);
31 extern bool handle_user_split_lock(struct pt_regs *regs, long error_code);
32 extern bool handle_guest_split_lock(unsigned long ip);
33 extern void handle_bus_lock(struct pt_regs *regs);
34 u8 get_this_hybrid_cpu_type(void);
35 #else
sld_setup(struct cpuinfo_x86 * c)36 static inline void __init sld_setup(struct cpuinfo_x86 *c) {}
handle_user_split_lock(struct pt_regs * regs,long error_code)37 static inline bool handle_user_split_lock(struct pt_regs *regs, long error_code)
38 {
39 	return false;
40 }
41 
handle_guest_split_lock(unsigned long ip)42 static inline bool handle_guest_split_lock(unsigned long ip)
43 {
44 	return false;
45 }
46 
handle_bus_lock(struct pt_regs * regs)47 static inline void handle_bus_lock(struct pt_regs *regs) {}
48 
get_this_hybrid_cpu_type(void)49 static inline u8 get_this_hybrid_cpu_type(void)
50 {
51 	return 0;
52 }
53 #endif
54 #ifdef CONFIG_IA32_FEAT_CTL
55 void init_ia32_feat_ctl(struct cpuinfo_x86 *c);
56 #else
init_ia32_feat_ctl(struct cpuinfo_x86 * c)57 static inline void init_ia32_feat_ctl(struct cpuinfo_x86 *c) {}
58 #endif
59 
60 extern __noendbr void cet_disable(void);
61 
62 struct cpu_signature;
63 
64 void intel_collect_cpu_info(struct cpu_signature *sig);
65 
66 extern u64 x86_read_arch_cap_msr(void);
67 bool intel_find_matching_signature(void *mc, struct cpu_signature *sig);
68 int intel_microcode_sanity_check(void *mc, bool print_err, int hdr_type);
69 
70 extern struct cpumask cpus_stop_mask;
71 
72 #endif /* _ASM_X86_CPU_H */
73