From 0e0273a015f57e244015c80f0fa37192f1e569f3 Mon Sep 17 00:00:00 2001 From: Angel Pons Date: Wed, 5 Aug 2020 13:43:35 +0200 Subject: cpu/intel/common: Add `intel_ht_supported` function Change-Id: I90c0378c4042dec39c8c86c1d2339a5cbcfe78e3 Signed-off-by: Angel Pons Reviewed-on: https://review.coreboot.org/c/coreboot/+/44210 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Rudolph --- src/cpu/intel/common/common.h | 7 ++++++- src/cpu/intel/common/hyperthreading.c | 10 ++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'src/cpu') diff --git a/src/cpu/intel/common/common.h b/src/cpu/intel/common/common.h index 57a5fe602c..df14668095 100644 --- a/src/cpu/intel/common/common.h +++ b/src/cpu/intel/common/common.h @@ -3,7 +3,7 @@ #ifndef _CPU_INTEL_COMMON_H #define _CPU_INTEL_COMMON_H -#include +#include void set_vmx_and_lock(void); void set_feature_ctrl_vmx(void); @@ -17,6 +17,11 @@ void set_feature_ctrl_lock(void); struct cppc_config; void cpu_init_cppc_config(struct cppc_config *config, u32 version); +/* + * Returns true if CPU supports Hyper-Threading. + */ +bool intel_ht_supported(void); + /* * Returns true if it's not thread 0 on a hyperthreading enabled core. */ diff --git a/src/cpu/intel/common/hyperthreading.c b/src/cpu/intel/common/hyperthreading.c index d68614974f..fce7576673 100644 --- a/src/cpu/intel/common/hyperthreading.c +++ b/src/cpu/intel/common/hyperthreading.c @@ -3,6 +3,13 @@ #include #include #include +#include + +bool intel_ht_supported(void) +{ + /* Is HyperThreading supported? */ + return !!(cpuid_edx(1) & CPUID_FEAURE_HTT); +} /* * Return true if running thread does not have the smallest lapic ID @@ -13,8 +20,7 @@ bool intel_ht_sibling(void) struct cpuid_result result; unsigned int core_ids, apic_ids, threads; - /* Is Hyper-Threading supported */ - if (!(cpuid_edx(1) & CPUID_FEAURE_HTT)) + if (!intel_ht_supported()) return false; apic_ids = 1; -- cgit v1.2.3