drivers/platform/x86/intel/turbo_max_3.c
Source file repositories/reference/linux-study-clean/drivers/platform/x86/intel/turbo_max_3.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/platform/x86/intel/turbo_max_3.c- Extension
.c- Size
- 3543 bytes
- Lines
- 141
- Domain
- Driver Families
- Bucket
- drivers/platform
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/cpufeature.hlinux/cpuhotplug.hlinux/init.hlinux/kernel.hlinux/topology.hlinux/workqueue.hasm/cpu_device_id.hasm/intel-family.hasm/msr.h
Detected Declarations
function Copyrightfunction itmt_legacy_set_priorityfunction itmt_legacy_cpu_onlinefunction itmt_legacy_init
Annotated Snippet
if (ret) {
pr_debug("cpu %d OC mailbox read failed\n", cpu);
break;
}
if (value & BIT_ULL(MSR_OC_MAILBOX_BUSY_BIT)) {
pr_debug("cpu %d OC mailbox still processing\n", cpu);
ret = -EBUSY;
continue;
}
if ((value >> MSR_OC_MAILBOX_RSP_OFFSET) & 0xff) {
pr_debug("cpu %d OC mailbox cmd failed\n", cpu);
ret = -ENXIO;
break;
}
ret = value & 0xff;
pr_debug("cpu %d max_ratio %d\n", cpu, ret);
break;
}
return ret;
}
/*
* The work item is needed to avoid CPU hotplug locking issues. The function
* itmt_legacy_set_priority() is called from CPU online callback, so can't
* call sched_set_itmt_support() from there as this function will aquire
* hotplug locks in its path.
*/
static void itmt_legacy_work_fn(struct work_struct *work)
{
sched_set_itmt_support();
}
static DECLARE_WORK(sched_itmt_work, itmt_legacy_work_fn);
static int itmt_legacy_cpu_online(unsigned int cpu)
{
static u32 max_highest_perf = 0, min_highest_perf = U32_MAX;
int priority;
priority = get_oc_core_priority(cpu);
if (priority < 0)
return 0;
sched_set_itmt_core_prio(priority, cpu);
/* Enable ITMT feature when a core with different priority is found */
if (max_highest_perf <= min_highest_perf) {
if (priority > max_highest_perf)
max_highest_perf = priority;
if (priority < min_highest_perf)
min_highest_perf = priority;
if (max_highest_perf > min_highest_perf)
schedule_work(&sched_itmt_work);
}
return 0;
}
static const struct x86_cpu_id itmt_legacy_cpu_ids[] = {
X86_MATCH_VFM(INTEL_BROADWELL_X, NULL),
X86_MATCH_VFM(INTEL_SKYLAKE_X, NULL),
{}
};
static int __init itmt_legacy_init(void)
{
const struct x86_cpu_id *id;
int ret;
id = x86_match_cpu(itmt_legacy_cpu_ids);
if (!id)
return -ENODEV;
ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN,
"platform/x86/turbo_max_3:online",
itmt_legacy_cpu_online, NULL);
if (ret < 0)
return ret;
return 0;
}
late_initcall(itmt_legacy_init)
Annotation
- Immediate include surface: `linux/cpufeature.h`, `linux/cpuhotplug.h`, `linux/init.h`, `linux/kernel.h`, `linux/topology.h`, `linux/workqueue.h`, `asm/cpu_device_id.h`, `asm/intel-family.h`.
- Detected declarations: `function Copyright`, `function itmt_legacy_set_priority`, `function itmt_legacy_cpu_online`, `function itmt_legacy_init`.
- Atlas domain: Driver Families / drivers/platform.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.