mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-05 13:51:52 +00:00
cpu/SMT: create and export cpu_smt_possible()
KVM needs to know if SMT is theoretically possible, this means it is supported and not forcefully disabled ('nosmt=force'). Create and export cpu_smt_possible() answering this question. Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
a073d7e3ad
commit
e1572f1d08
2 changed files with 11 additions and 2 deletions
11
kernel/cpu.c
11
kernel/cpu.c
|
@ -392,8 +392,7 @@ enum cpuhp_smt_control cpu_smt_control __read_mostly = CPU_SMT_ENABLED;
|
|||
|
||||
void __init cpu_smt_disable(bool force)
|
||||
{
|
||||
if (cpu_smt_control == CPU_SMT_FORCE_DISABLED ||
|
||||
cpu_smt_control == CPU_SMT_NOT_SUPPORTED)
|
||||
if (!cpu_smt_possible())
|
||||
return;
|
||||
|
||||
if (force) {
|
||||
|
@ -438,6 +437,14 @@ static inline bool cpu_smt_allowed(unsigned int cpu)
|
|||
*/
|
||||
return !cpumask_test_cpu(cpu, &cpus_booted_once_mask);
|
||||
}
|
||||
|
||||
/* Returns true if SMT is not supported of forcefully (irreversibly) disabled */
|
||||
bool cpu_smt_possible(void)
|
||||
{
|
||||
return cpu_smt_control != CPU_SMT_FORCE_DISABLED &&
|
||||
cpu_smt_control != CPU_SMT_NOT_SUPPORTED;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cpu_smt_possible);
|
||||
#else
|
||||
static inline bool cpu_smt_allowed(unsigned int cpu) { return true; }
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue