]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
x86/topology: Provide topology_smt_supported()
authorThomas Gleixner <tglx@linutronix.de>
Thu, 21 Jun 2018 08:37:20 +0000 (10:37 +0200)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Fri, 10 Aug 2018 22:56:34 +0000 (18:56 -0400)
Provide information whether SMT is supoorted by the CPUs. Preparatory patch
for SMT control mechanism.

Suggested-by: Dave Hansen <dave.hansen@intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Ingo Molnar <mingo@kernel.org>
Orabug: 28220674
CVE: CVE-2018-3620

(cherry picked from commit f048c399e0f7490ab7296bc2c255d37eb14a9675)

Signed-off-by: Mihai Carabas <mihai.carabas@oracle.com>
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Conflicts:
arch/x86/kernel/smpboot.c
Contextual

arch/x86/include/asm/topology.h
arch/x86/kernel/smpboot.c

index bf9b53421a6f791d4d75837fc64c9f9f5156594a..0d02e19abe58101bf89ed3090f6eb793c20aa8f2 100644 (file)
@@ -124,8 +124,10 @@ extern const struct cpumask *cpu_coregroup_mask(int cpu);
 
 #ifdef CONFIG_SMP
 bool topology_is_primary_thread(unsigned int cpu);
+bool topology_smt_supported(void);
 #else
 static inline bool topology_is_primary_thread(unsigned int cpu) { return true; }
+static inline bool topology_smt_supported(void) { return false; }
 #endif
 
 #ifdef ENABLE_TOPO_DEFINES
index 76c42a0d26c400393ffde0375ec8814b684bd6fc..9cf20ce8be2dc83ebabb1022408b4948f06037a9 100644 (file)
@@ -279,6 +279,14 @@ bool topology_is_primary_thread(unsigned int cpu)
        return apic_id_is_primary_thread(per_cpu(x86_cpu_to_apicid, cpu));
 }
 
+/**
+ * topology_smt_supported - Check whether SMT is supported by the CPUs
+ */
+bool topology_smt_supported(void)
+{
+       return smp_num_siblings > 1;
+}
+
 void __init smp_store_boot_cpu_info(void)
 {
        int id = 0; /* CPU 0 */