xref: /OK3568_Linux_fs/kernel/arch/x86/include/asm/cpu.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */
2*4882a593Smuzhiyun #ifndef _ASM_X86_CPU_H
3*4882a593Smuzhiyun #define _ASM_X86_CPU_H
4*4882a593Smuzhiyun 
5*4882a593Smuzhiyun #include <linux/device.h>
6*4882a593Smuzhiyun #include <linux/cpu.h>
7*4882a593Smuzhiyun #include <linux/topology.h>
8*4882a593Smuzhiyun #include <linux/nodemask.h>
9*4882a593Smuzhiyun #include <linux/percpu.h>
10*4882a593Smuzhiyun 
11*4882a593Smuzhiyun #ifdef CONFIG_SMP
12*4882a593Smuzhiyun 
13*4882a593Smuzhiyun extern void prefill_possible_map(void);
14*4882a593Smuzhiyun 
15*4882a593Smuzhiyun #else /* CONFIG_SMP */
16*4882a593Smuzhiyun 
prefill_possible_map(void)17*4882a593Smuzhiyun static inline void prefill_possible_map(void) {}
18*4882a593Smuzhiyun 
19*4882a593Smuzhiyun #define cpu_physical_id(cpu)			boot_cpu_physical_apicid
20*4882a593Smuzhiyun #define cpu_acpi_id(cpu)			0
21*4882a593Smuzhiyun #define safe_smp_processor_id()			0
22*4882a593Smuzhiyun 
23*4882a593Smuzhiyun #endif /* CONFIG_SMP */
24*4882a593Smuzhiyun 
25*4882a593Smuzhiyun struct x86_cpu {
26*4882a593Smuzhiyun 	struct cpu cpu;
27*4882a593Smuzhiyun };
28*4882a593Smuzhiyun 
29*4882a593Smuzhiyun #ifdef CONFIG_HOTPLUG_CPU
30*4882a593Smuzhiyun extern int arch_register_cpu(int num);
31*4882a593Smuzhiyun extern void arch_unregister_cpu(int);
32*4882a593Smuzhiyun extern void start_cpu0(void);
33*4882a593Smuzhiyun #ifdef CONFIG_DEBUG_HOTPLUG_CPU0
34*4882a593Smuzhiyun extern int _debug_hotplug_cpu(int cpu, int action);
35*4882a593Smuzhiyun #endif
36*4882a593Smuzhiyun #endif
37*4882a593Smuzhiyun 
38*4882a593Smuzhiyun int mwait_usable(const struct cpuinfo_x86 *);
39*4882a593Smuzhiyun 
40*4882a593Smuzhiyun unsigned int x86_family(unsigned int sig);
41*4882a593Smuzhiyun unsigned int x86_model(unsigned int sig);
42*4882a593Smuzhiyun unsigned int x86_stepping(unsigned int sig);
43*4882a593Smuzhiyun #ifdef CONFIG_CPU_SUP_INTEL
44*4882a593Smuzhiyun extern void __init cpu_set_core_cap_bits(struct cpuinfo_x86 *c);
45*4882a593Smuzhiyun extern void switch_to_sld(unsigned long tifn);
46*4882a593Smuzhiyun extern bool handle_user_split_lock(struct pt_regs *regs, long error_code);
47*4882a593Smuzhiyun extern bool handle_guest_split_lock(unsigned long ip);
48*4882a593Smuzhiyun #else
cpu_set_core_cap_bits(struct cpuinfo_x86 * c)49*4882a593Smuzhiyun static inline void __init cpu_set_core_cap_bits(struct cpuinfo_x86 *c) {}
switch_to_sld(unsigned long tifn)50*4882a593Smuzhiyun static inline void switch_to_sld(unsigned long tifn) {}
handle_user_split_lock(struct pt_regs * regs,long error_code)51*4882a593Smuzhiyun static inline bool handle_user_split_lock(struct pt_regs *regs, long error_code)
52*4882a593Smuzhiyun {
53*4882a593Smuzhiyun 	return false;
54*4882a593Smuzhiyun }
55*4882a593Smuzhiyun 
handle_guest_split_lock(unsigned long ip)56*4882a593Smuzhiyun static inline bool handle_guest_split_lock(unsigned long ip)
57*4882a593Smuzhiyun {
58*4882a593Smuzhiyun 	return false;
59*4882a593Smuzhiyun }
60*4882a593Smuzhiyun #endif
61*4882a593Smuzhiyun #ifdef CONFIG_IA32_FEAT_CTL
62*4882a593Smuzhiyun void init_ia32_feat_ctl(struct cpuinfo_x86 *c);
63*4882a593Smuzhiyun #else
init_ia32_feat_ctl(struct cpuinfo_x86 * c)64*4882a593Smuzhiyun static inline void init_ia32_feat_ctl(struct cpuinfo_x86 *c) {}
65*4882a593Smuzhiyun #endif
66*4882a593Smuzhiyun #endif /* _ASM_X86_CPU_H */
67