1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef _LINUX_CPU_SMT_H_ 3 #define _LINUX_CPU_SMT_H_ 4 5 enum cpuhp_smt_control { 6 CPU_SMT_ENABLED, 7 CPU_SMT_DISABLED, 8 CPU_SMT_FORCE_DISABLED, 9 CPU_SMT_NOT_SUPPORTED, 10 CPU_SMT_NOT_IMPLEMENTED, 11 }; 12 13 #if defined(CONFIG_SMP) && defined(CONFIG_HOTPLUG_SMT) 14 extern enum cpuhp_smt_control cpu_smt_control; 15 extern unsigned int cpu_smt_num_threads; 16 extern void cpu_smt_disable(bool force); 17 extern void cpu_smt_set_num_threads(unsigned int num_threads, 18 unsigned int max_threads); 19 extern bool cpu_smt_possible(void); 20 extern int cpuhp_smt_enable(void); 21 extern int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval); 22 #else 23 # define cpu_smt_control (CPU_SMT_NOT_IMPLEMENTED) 24 # define cpu_smt_num_threads 1 25 static inline void cpu_smt_disable(bool force) { } 26 static inline void cpu_smt_set_num_threads(unsigned int num_threads, 27 unsigned int max_threads) { } 28 static inline bool cpu_smt_possible(void) { return false; } 29 static inline int cpuhp_smt_enable(void) { return 0; } 30 static inline int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval) { return 0; } 31 #endif 32 33 #endif /* _LINUX_CPU_SMT_H_ */ 34