soc/amd/picasso/acpi: include pci_int_defs.asl from soc.asl
[coreboot.git] / src / cpu / intel / hyperthreading / intel_sibling.c
blob773d8e261c2ecd841fb4a1079dd9a97921368619
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <console/console.h>
4 #include <cpu/cpu.h>
5 #include <cpu/intel/hyperthreading.h>
6 #include <device/device.h>
7 #include <option.h>
9 /* Intel hyper-threading requires serialized CPU init. */
11 static int first_time = 1;
12 static int disable_siblings = !CONFIG(LOGICAL_CPUS);
14 void intel_sibling_init(struct device *cpu)
16 unsigned int i, siblings;
17 struct cpuid_result result;
19 /* On the bootstrap processor see if I want sibling cpus enabled */
20 if (first_time) {
21 first_time = 0;
22 disable_siblings = get_uint_option("hyper_threading", disable_siblings);
24 result = cpuid(1);
25 /* Is hyperthreading supported */
26 if (!(result.edx & (1 << 28)))
27 return;
29 /* See how many sibling cpus we have */
30 siblings = (result.ebx >> 16) & 0xff;
31 if (siblings < 1)
32 siblings = 1;
34 printk(BIOS_DEBUG, "CPU: %u %d siblings\n",
35 cpu->path.apic.apic_id,
36 siblings);
38 /* See if I am a sibling cpu */
39 if (cpu->path.apic.apic_id & (siblings - 1)) {
40 if (disable_siblings)
41 cpu->enabled = 0;
42 return;
45 /* I am the primary CPU start up my siblings */
46 for (i = 1; i < siblings; i++) {
47 struct device_path cpu_path;
48 struct device *new;
49 /* Build the CPU device path */
50 cpu_path.type = DEVICE_PATH_APIC;
51 cpu_path.apic.apic_id = cpu->path.apic.apic_id + i;
53 /* Allocate new CPU device structure iff sibling CPU
54 * was not in static device tree.
56 new = alloc_find_dev(cpu->bus, &cpu_path);
58 if (!new)
59 continue;
61 printk(BIOS_DEBUG, "CPU: %u has sibling %u\n",
62 cpu->path.apic.apic_id,
63 new->path.apic.apic_id);