xref: /openbmc/linux/include/linux/cpu_smt.h (revision 447ae4ac)
13f916919SMichael Ellerman /* SPDX-License-Identifier: GPL-2.0 */
23f916919SMichael Ellerman #ifndef _LINUX_CPU_SMT_H_
33f916919SMichael Ellerman #define _LINUX_CPU_SMT_H_
43f916919SMichael Ellerman 
53f916919SMichael Ellerman enum cpuhp_smt_control {
63f916919SMichael Ellerman 	CPU_SMT_ENABLED,
73f916919SMichael Ellerman 	CPU_SMT_DISABLED,
83f916919SMichael Ellerman 	CPU_SMT_FORCE_DISABLED,
93f916919SMichael Ellerman 	CPU_SMT_NOT_SUPPORTED,
103f916919SMichael Ellerman 	CPU_SMT_NOT_IMPLEMENTED,
113f916919SMichael Ellerman };
123f916919SMichael Ellerman 
133f916919SMichael Ellerman #if defined(CONFIG_SMP) && defined(CONFIG_HOTPLUG_SMT)
143f916919SMichael Ellerman extern enum cpuhp_smt_control cpu_smt_control;
15*447ae4acSMichael Ellerman extern unsigned int cpu_smt_num_threads;
163f916919SMichael Ellerman extern void cpu_smt_disable(bool force);
17*447ae4acSMichael Ellerman extern void cpu_smt_set_num_threads(unsigned int num_threads,
18*447ae4acSMichael Ellerman 				    unsigned int max_threads);
193f916919SMichael Ellerman extern bool cpu_smt_possible(void);
203f916919SMichael Ellerman extern int cpuhp_smt_enable(void);
213f916919SMichael Ellerman extern int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval);
223f916919SMichael Ellerman #else
233f916919SMichael Ellerman # define cpu_smt_control               (CPU_SMT_NOT_IMPLEMENTED)
24*447ae4acSMichael Ellerman # define cpu_smt_num_threads 1
cpu_smt_disable(bool force)253f916919SMichael Ellerman static inline void cpu_smt_disable(bool force) { }
cpu_smt_set_num_threads(unsigned int num_threads,unsigned int max_threads)26*447ae4acSMichael Ellerman static inline void cpu_smt_set_num_threads(unsigned int num_threads,
27*447ae4acSMichael Ellerman 					   unsigned int max_threads) { }
cpu_smt_possible(void)283f916919SMichael Ellerman static inline bool cpu_smt_possible(void) { return false; }
cpuhp_smt_enable(void)293f916919SMichael Ellerman static inline int cpuhp_smt_enable(void) { return 0; }
cpuhp_smt_disable(enum cpuhp_smt_control ctrlval)303f916919SMichael Ellerman static inline int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval) { return 0; }
313f916919SMichael Ellerman #endif
323f916919SMichael Ellerman 
333f916919SMichael Ellerman #endif /* _LINUX_CPU_SMT_H_ */
34