xref: /openbmc/linux/arch/x86/include/asm/cpu.h (revision 0f9b4c3ca5fdf3e177266ef994071b1a03f07318)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
21965aae3SH. Peter Anvin #ifndef _ASM_X86_CPU_H
31965aae3SH. Peter Anvin #define _ASM_X86_CPU_H
4bb898558SAl Viro 
5bb898558SAl Viro #include <linux/device.h>
6bb898558SAl Viro #include <linux/cpu.h>
7bb898558SAl Viro #include <linux/topology.h>
8bb898558SAl Viro #include <linux/nodemask.h>
9bb898558SAl Viro #include <linux/percpu.h>
10991625f3SPeter Zijlstra #include <asm/ibt.h>
11bb898558SAl Viro 
126e5385d4SJaswinder Singh Rajput #ifdef CONFIG_SMP
136e5385d4SJaswinder Singh Rajput 
146e5385d4SJaswinder Singh Rajput extern void prefill_possible_map(void);
156e5385d4SJaswinder Singh Rajput 
166e5385d4SJaswinder Singh Rajput #else /* CONFIG_SMP */
176e5385d4SJaswinder Singh Rajput 
prefill_possible_map(void)186e5385d4SJaswinder Singh Rajput static inline void prefill_possible_map(void) {}
196e5385d4SJaswinder Singh Rajput 
20af8968abSJaswinder Singh Rajput #define cpu_physical_id(cpu)			boot_cpu_physical_apicid
213e9e57faSVitaly Kuznetsov #define cpu_acpi_id(cpu)			0
2296b89dc6SJaswinder Singh Rajput #define safe_smp_processor_id()			0
23f472cdbaSJaswinder Singh Rajput 
246e5385d4SJaswinder Singh Rajput #endif /* CONFIG_SMP */
256e5385d4SJaswinder Singh Rajput 
26bb898558SAl Viro struct x86_cpu {
27bb898558SAl Viro 	struct cpu cpu;
28bb898558SAl Viro };
29bb898558SAl Viro 
30bb898558SAl Viro #ifdef CONFIG_HOTPLUG_CPU
31666e1156SThomas Gleixner extern void soft_restart_cpu(void);
32bb898558SAl Viro #endif
33bb898558SAl Viro 
34bb6e89dfSThomas Gleixner extern void ap_init_aperfmperf(void);
35bb6e89dfSThomas Gleixner 
361c9d16e3SBorislav Petkov int mwait_usable(const struct cpuinfo_x86 *);
376d652ea1SJaswinder Singh Rajput 
3899f925ceSBorislav Petkov unsigned int x86_family(unsigned int sig);
3999f925ceSBorislav Petkov unsigned int x86_model(unsigned int sig);
4099f925ceSBorislav Petkov unsigned int x86_stepping(unsigned int sig);
416650cdd9SPeter Zijlstra (Intel) #ifdef CONFIG_CPU_SUP_INTEL
42ebb1064eSFenghua Yu extern void __init sld_setup(struct cpuinfo_x86 *c);
436650cdd9SPeter Zijlstra (Intel) extern bool handle_user_split_lock(struct pt_regs *regs, long error_code);
44d7e94dbdSThomas Gleixner extern bool handle_guest_split_lock(unsigned long ip);
45ebb1064eSFenghua Yu extern void handle_bus_lock(struct pt_regs *regs);
46250b3c0dSRicardo Neri u8 get_this_hybrid_cpu_type(void);
476650cdd9SPeter Zijlstra (Intel) #else
sld_setup(struct cpuinfo_x86 * c)48ebb1064eSFenghua Yu static inline void __init sld_setup(struct cpuinfo_x86 *c) {}
handle_user_split_lock(struct pt_regs * regs,long error_code)496650cdd9SPeter Zijlstra (Intel) static inline bool handle_user_split_lock(struct pt_regs *regs, long error_code)
506650cdd9SPeter Zijlstra (Intel) {
516650cdd9SPeter Zijlstra (Intel) 	return false;
526650cdd9SPeter Zijlstra (Intel) }
53d7e94dbdSThomas Gleixner 
handle_guest_split_lock(unsigned long ip)54d7e94dbdSThomas Gleixner static inline bool handle_guest_split_lock(unsigned long ip)
55d7e94dbdSThomas Gleixner {
56d7e94dbdSThomas Gleixner 	return false;
57d7e94dbdSThomas Gleixner }
58ebb1064eSFenghua Yu 
handle_bus_lock(struct pt_regs * regs)59ebb1064eSFenghua Yu static inline void handle_bus_lock(struct pt_regs *regs) {}
6042dec9a9SLinus Torvalds 
get_this_hybrid_cpu_type(void)61250b3c0dSRicardo Neri static inline u8 get_this_hybrid_cpu_type(void)
62250b3c0dSRicardo Neri {
63250b3c0dSRicardo Neri 	return 0;
64250b3c0dSRicardo Neri }
656650cdd9SPeter Zijlstra (Intel) #endif
665d510359SSean Christopherson #ifdef CONFIG_IA32_FEAT_CTL
675d510359SSean Christopherson void init_ia32_feat_ctl(struct cpuinfo_x86 *c);
685d510359SSean Christopherson #else
init_ia32_feat_ctl(struct cpuinfo_x86 * c)695d510359SSean Christopherson static inline void init_ia32_feat_ctl(struct cpuinfo_x86 *c) {}
705d510359SSean Christopherson #endif
71af227003SPeter Zijlstra 
72af227003SPeter Zijlstra extern __noendbr void cet_disable(void);
73af227003SPeter Zijlstra 
74198ea646SThomas Gleixner struct cpu_signature;
75d3287fb0SJithu Joseph 
76198ea646SThomas Gleixner void intel_collect_cpu_info(struct cpu_signature *sig);
77d3287fb0SJithu Joseph 
78b8d1d163SDaniel Sneddon extern u64 x86_read_arch_cap_msr(void);
79*433f975eSThomas Gleixner bool intel_find_matching_signature(void *mc, struct cpu_signature *sig);
80e0788c32SJithu Joseph int intel_microcode_sanity_check(void *mc, bool print_err, int hdr_type);
81b8d1d163SDaniel Sneddon 
821f5e7eb7SThomas Gleixner extern struct cpumask cpus_stop_mask;
831f5e7eb7SThomas Gleixner 
841965aae3SH. Peter Anvin #endif /* _ASM_X86_CPU_H */
85