From a000922e077ec906c39c5e07ba2e38feefd5b8c0 Mon Sep 17 00:00:00 2001 From: Kyösti Mälkki Date: Sat, 16 Oct 2021 13:35:04 +0300 Subject: cpu/intel/hyperthreading: Use cpuid_get_max_func() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I4b69b1d20b5a768c269d85f0ea23f79e02391a71 Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/c/coreboot/+/58384 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Rudolph --- src/cpu/intel/common/hyperthreading.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/cpu/intel/common/hyperthreading.c b/src/cpu/intel/common/hyperthreading.c index 2936770cc3..3297b381b3 100644 --- a/src/cpu/intel/common/hyperthreading.c +++ b/src/cpu/intel/common/hyperthreading.c @@ -19,24 +19,26 @@ bool intel_ht_sibling(void) { struct cpuid_result result; unsigned int core_ids, apic_ids, threads; + unsigned int max_leaf; if (!intel_ht_supported()) return false; - if (cpuid_eax(0) >= 0xb) { + max_leaf = cpuid_get_max_func(); + if (max_leaf >= 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) + if (max_leaf >= 1) apic_ids = (cpuid_ebx(1) >> 16) & 0xff; if (apic_ids == 0) apic_ids = 1; core_ids = 1; - if (cpuid_eax(0) >= 4) { + if (max_leaf >= 4) { result = cpuid_ext(4, 0); core_ids += (result.eax >> 26) & 0x3f; } -- cgit v1.2.3