Skip to content

Commit f048c39

Browse files
committed
x86/topology: Provide topology_smt_supported()
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>
1 parent 6a4d265 commit f048c39

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

arch/x86/include/asm/topology.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,15 @@ static inline int topology_max_smt_threads(void)
125125
int topology_update_package_map(unsigned int apicid, unsigned int cpu);
126126
int topology_phys_to_logical_pkg(unsigned int pkg);
127127
bool topology_is_primary_thread(unsigned int cpu);
128+
bool topology_smt_supported(void);
128129
#else
129130
#define topology_max_packages() (1)
130131
static inline int
131132
topology_update_package_map(unsigned int apicid, unsigned int cpu) { return 0; }
132133
static inline int topology_phys_to_logical_pkg(unsigned int pkg) { return 0; }
133134
static inline int topology_max_smt_threads(void) { return 1; }
134135
static inline bool topology_is_primary_thread(unsigned int cpu) { return true; }
136+
static inline bool topology_smt_supported(void) { return false; }
135137
#endif
136138

137139
static inline void arch_fix_phys_package_id(int num, u32 slot)

arch/x86/kernel/smpboot.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,14 @@ bool topology_is_primary_thread(unsigned int cpu)
274274
return apic_id_is_primary_thread(per_cpu(x86_cpu_to_apicid, cpu));
275275
}
276276

277+
/**
278+
* topology_smt_supported - Check whether SMT is supported by the CPUs
279+
*/
280+
bool topology_smt_supported(void)
281+
{
282+
return smp_num_siblings > 1;
283+
}
284+
277285
/**
278286
* topology_phys_to_logical_pkg - Map a physical package id to a logical
279287
*

0 commit comments

Comments
 (0)