diff options
author | Vitaly Kuznetsov <vkuznets@redhat.com> | 2019-09-16 12:22:56 -0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2019-09-24 07:37:28 -0400 |
commit | e1572f1d08be57a5412a464cff0712a23cd0b73e (patch) | |
tree | d1ee6d7671cd371c765778c9a73777a823dfe848 /kernel/cpu.c | |
parent | a073d7e3ad687a7ef32b65affe80faa7ce89bf92 (diff) |
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>
Diffstat (limited to 'kernel/cpu.c')
-rw-r--r-- | kernel/cpu.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c index e1967e9eddc2..fc28e17940e0 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c | |||
@@ -392,8 +392,7 @@ enum cpuhp_smt_control cpu_smt_control __read_mostly = CPU_SMT_ENABLED; | |||
392 | 392 | ||
393 | void __init cpu_smt_disable(bool force) | 393 | void __init cpu_smt_disable(bool force) |
394 | { | 394 | { |
395 | if (cpu_smt_control == CPU_SMT_FORCE_DISABLED || | 395 | if (!cpu_smt_possible()) |
396 | cpu_smt_control == CPU_SMT_NOT_SUPPORTED) | ||
397 | return; | 396 | return; |
398 | 397 | ||
399 | if (force) { | 398 | if (force) { |
@@ -438,6 +437,14 @@ static inline bool cpu_smt_allowed(unsigned int cpu) | |||
438 | */ | 437 | */ |
439 | return !cpumask_test_cpu(cpu, &cpus_booted_once_mask); | 438 | return !cpumask_test_cpu(cpu, &cpus_booted_once_mask); |
440 | } | 439 | } |
440 | |||
441 | /* Returns true if SMT is not supported of forcefully (irreversibly) disabled */ | ||
442 | bool cpu_smt_possible(void) | ||
443 | { | ||
444 | return cpu_smt_control != CPU_SMT_FORCE_DISABLED && | ||
445 | cpu_smt_control != CPU_SMT_NOT_SUPPORTED; | ||
446 | } | ||
447 | EXPORT_SYMBOL_GPL(cpu_smt_possible); | ||
441 | #else | 448 | #else |
442 | static inline bool cpu_smt_allowed(unsigned int cpu) { return true; } | 449 | static inline bool cpu_smt_allowed(unsigned int cpu) { return true; } |
443 | #endif | 450 | #endif |