mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-28 20:02:17 +00:00
![Michael Ellerman](/assets/img/avatar_default.png)
Some architectures allow partial SMT states at boot time, ie. when not all SMT threads are brought online. To support that the SMT code needs to know the maximum number of SMT threads, and also the currently configured number. The architecture code knows the max number of threads, so have the architecture code pass that value to cpu_smt_set_num_threads(). Note that although topology_max_smt_threads() exists, it is not configured early enough to be used here. As architecture, like PowerPC, allows the threads number to be set through the kernel command line, also pass that value. [ ldufour: Slightly reword the commit message ] [ ldufour: Rename cpu_smt_check_topology and add a num_threads argument ] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Tested-by: Zhang Rui <rui.zhang@intel.com> Link: https://lore.kernel.org/r/20230705145143.40545-5-ldufour@linux.ibm.com
33 lines
1.1 KiB
C
33 lines
1.1 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _LINUX_CPU_SMT_H_
|
|
#define _LINUX_CPU_SMT_H_
|
|
|
|
enum cpuhp_smt_control {
|
|
CPU_SMT_ENABLED,
|
|
CPU_SMT_DISABLED,
|
|
CPU_SMT_FORCE_DISABLED,
|
|
CPU_SMT_NOT_SUPPORTED,
|
|
CPU_SMT_NOT_IMPLEMENTED,
|
|
};
|
|
|
|
#if defined(CONFIG_SMP) && defined(CONFIG_HOTPLUG_SMT)
|
|
extern enum cpuhp_smt_control cpu_smt_control;
|
|
extern unsigned int cpu_smt_num_threads;
|
|
extern void cpu_smt_disable(bool force);
|
|
extern void cpu_smt_set_num_threads(unsigned int num_threads,
|
|
unsigned int max_threads);
|
|
extern bool cpu_smt_possible(void);
|
|
extern int cpuhp_smt_enable(void);
|
|
extern int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval);
|
|
#else
|
|
# define cpu_smt_control (CPU_SMT_NOT_IMPLEMENTED)
|
|
# define cpu_smt_num_threads 1
|
|
static inline void cpu_smt_disable(bool force) { }
|
|
static inline void cpu_smt_set_num_threads(unsigned int num_threads,
|
|
unsigned int max_threads) { }
|
|
static inline bool cpu_smt_possible(void) { return false; }
|
|
static inline int cpuhp_smt_enable(void) { return 0; }
|
|
static inline int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval) { return 0; }
|
|
#endif
|
|
|
|
#endif /* _LINUX_CPU_SMT_H_ */
|