summaryrefslogtreecommitdiff
path: root/src/cpu/intel/common/hyperthreading.c
diff options
context:
space:
mode:
authorWonkyu Kim <wonkyu.kim@intel.com>2021-03-22 20:08:11 -0700
committerPatrick Georgi <pgeorgi@google.com>2021-04-15 10:57:12 +0000
commitbdfa35315fc4b01dcd5ee0fee958c529ad4dacb7 (patch)
tree1a1cf208e28ca54911fbec31ee0fd44b6d260459 /src/cpu/intel/common/hyperthreading.c
parent0aeedd42eecee0f1d5b658c3441f8efecb0c6473 (diff)
cpu/intel/common: use lapicid api
Use lapicid api to support both x2apic mode and apic mode BUG=None BRANCH=None TEST=boot to OS and check apic mode cat /proc/cpuinfo | grep "apicid" Signed-off-by: Wonkyu Kim <wonkyu.kim@intel.com> Change-Id: I5ca5b09ae67941adcc07dfafdfe4ba78b0f81009 Reviewed-on: https://review.coreboot.org/c/coreboot/+/51725 Reviewed-by: Patrick Georgi <pgeorgi@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/cpu/intel/common/hyperthreading.c')
-rw-r--r--src/cpu/intel/common/hyperthreading.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/cpu/intel/common/hyperthreading.c b/src/cpu/intel/common/hyperthreading.c
index fce7576673..b9c17b6fa1 100644
--- a/src/cpu/intel/common/hyperthreading.c
+++ b/src/cpu/intel/common/hyperthreading.c
@@ -23,6 +23,14 @@ bool intel_ht_sibling(void)
if (!intel_ht_supported())
return false;
+ if (is_x2apic_mode()) {
+ if (cpuid_eax(0) >= 0xb) {
+ result = cpuid_ext(0xb, 0);
+ const uint32_t div = 1 << (result.eax & 0x1f);
+ return result.edx % div > 0;
+ }
+ }
+
apic_ids = 1;
if (cpuid_eax(0) >= 1)
apic_ids = (cpuid_ebx(1) >> 16) & 0xff;