18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef _ASM_X86_CPU_H
38c2ecf20Sopenharmony_ci#define _ASM_X86_CPU_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <linux/device.h>
68c2ecf20Sopenharmony_ci#include <linux/cpu.h>
78c2ecf20Sopenharmony_ci#include <linux/topology.h>
88c2ecf20Sopenharmony_ci#include <linux/nodemask.h>
98c2ecf20Sopenharmony_ci#include <linux/percpu.h>
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#ifdef CONFIG_SMP
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciextern void prefill_possible_map(void);
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#else /* CONFIG_SMP */
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_cistatic inline void prefill_possible_map(void) {}
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#define cpu_physical_id(cpu)			boot_cpu_physical_apicid
208c2ecf20Sopenharmony_ci#define cpu_acpi_id(cpu)			0
218c2ecf20Sopenharmony_ci#define safe_smp_processor_id()			0
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci#endif /* CONFIG_SMP */
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_cistruct x86_cpu {
268c2ecf20Sopenharmony_ci	struct cpu cpu;
278c2ecf20Sopenharmony_ci};
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci#ifdef CONFIG_HOTPLUG_CPU
308c2ecf20Sopenharmony_ciextern int arch_register_cpu(int num);
318c2ecf20Sopenharmony_ciextern void arch_unregister_cpu(int);
328c2ecf20Sopenharmony_ciextern void start_cpu0(void);
338c2ecf20Sopenharmony_ci#ifdef CONFIG_DEBUG_HOTPLUG_CPU0
348c2ecf20Sopenharmony_ciextern int _debug_hotplug_cpu(int cpu, int action);
358c2ecf20Sopenharmony_ci#endif
368c2ecf20Sopenharmony_ci#endif
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ciint mwait_usable(const struct cpuinfo_x86 *);
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ciunsigned int x86_family(unsigned int sig);
418c2ecf20Sopenharmony_ciunsigned int x86_model(unsigned int sig);
428c2ecf20Sopenharmony_ciunsigned int x86_stepping(unsigned int sig);
438c2ecf20Sopenharmony_ci#ifdef CONFIG_CPU_SUP_INTEL
448c2ecf20Sopenharmony_ciextern void __init cpu_set_core_cap_bits(struct cpuinfo_x86 *c);
458c2ecf20Sopenharmony_ciextern void switch_to_sld(unsigned long tifn);
468c2ecf20Sopenharmony_ciextern bool handle_user_split_lock(struct pt_regs *regs, long error_code);
478c2ecf20Sopenharmony_ciextern bool handle_guest_split_lock(unsigned long ip);
488c2ecf20Sopenharmony_ci#else
498c2ecf20Sopenharmony_cistatic inline void __init cpu_set_core_cap_bits(struct cpuinfo_x86 *c) {}
508c2ecf20Sopenharmony_cistatic inline void switch_to_sld(unsigned long tifn) {}
518c2ecf20Sopenharmony_cistatic inline bool handle_user_split_lock(struct pt_regs *regs, long error_code)
528c2ecf20Sopenharmony_ci{
538c2ecf20Sopenharmony_ci	return false;
548c2ecf20Sopenharmony_ci}
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_cistatic inline bool handle_guest_split_lock(unsigned long ip)
578c2ecf20Sopenharmony_ci{
588c2ecf20Sopenharmony_ci	return false;
598c2ecf20Sopenharmony_ci}
608c2ecf20Sopenharmony_ci#endif
618c2ecf20Sopenharmony_ci#ifdef CONFIG_IA32_FEAT_CTL
628c2ecf20Sopenharmony_civoid init_ia32_feat_ctl(struct cpuinfo_x86 *c);
638c2ecf20Sopenharmony_ci#else
648c2ecf20Sopenharmony_cistatic inline void init_ia32_feat_ctl(struct cpuinfo_x86 *c) {}
658c2ecf20Sopenharmony_ci#endif
668c2ecf20Sopenharmony_ci#endif /* _ASM_X86_CPU_H */
67