cpu/intel/common: Move intel_ht_sibling() to common folder

Make intel_ht_sibling() available on all platforms.

Will be used in MP init to only write "Core" MSRs from one thread
on HyperThreading enabled platforms, to prevent race conditions and
resulting #GP if MSRs are written twice or are already locked.

Change-Id: I5d000b34ba4c6536dc866fbaf106b78e905e3e35
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/35619
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Patrick Rudolph
2019-09-26 10:26:49 +02:00
committed by Patrick Georgi
parent 5adbc767f6
commit 6e079dc120
18 changed files with 66 additions and 32 deletions

View File

@@ -25,30 +25,6 @@
static int first_time = 1;
static int disable_siblings = !CONFIG(LOGICAL_CPUS);
/* Return true if running thread does not have the smallest lapic ID
* within a CPU core.
*/
int intel_ht_sibling(void)
{
unsigned int core_ids, apic_ids, threads;
apic_ids = 1;
if (cpuid_eax(0) >= 1)
apic_ids = (cpuid_ebx(1) >> 16) & 0xff;
if (apic_ids < 1)
apic_ids = 1;
core_ids = 1;
if (cpuid_eax(0) >= 4) {
struct cpuid_result result;
result = cpuid_ext(4, 0);
core_ids += (result.eax >> 26) & 0x3f;
}
threads = (apic_ids / core_ids);
return !!(lapicid() & (threads-1));
}
void intel_sibling_init(struct device *cpu)
{
unsigned int i, siblings;