drivers/acpi/processor_perflib.c
Source file repositories/reference/linux-study-clean/drivers/acpi/processor_perflib.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/acpi/processor_perflib.c- Extension
.c- Size
- 19723 bytes
- Lines
- 798
- Domain
- Driver Families
- Bucket
- drivers/acpi
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/module.hlinux/init.hlinux/cpufreq.hlinux/slab.hlinux/acpi.hacpi/processor.hasm/cpufeature.hasm/msr.h
Detected Declarations
function acpi_processor_get_platform_limitfunction acpi_processor_ppc_ostfunction acpi_processor_ppc_has_changedfunction acpi_processor_get_bios_limitfunction acpi_processor_ignore_ppc_initfunction acpi_processor_ppc_initfunction for_each_cpufunction acpi_processor_ppc_exitfunction for_each_cpufunction acpi_processor_get_performance_controlfunction amd_fixup_frequencyfunction acpi_processor_get_performance_statesfunction acpi_processor_get_performance_infofunction frequenciesfunction acpi_processor_pstate_controlfunction acpi_processor_notify_smmfunction acpi_processor_get_psdfunction acpi_processor_preregister_performancefunction for_each_possible_cpufunction for_each_possible_cpufunction acpi_processor_register_performancefunction acpi_processor_unregister_performanceexport acpi_processor_get_bios_limitexport acpi_processor_get_performance_infoexport acpi_processor_notify_smmexport acpi_processor_get_psdexport acpi_processor_preregister_performanceexport acpi_processor_register_performanceexport acpi_processor_unregister_performance
Annotated Snippet
if (ACPI_FAILURE(status)) {
acpi_evaluation_failure_warn(pr->handle, "_PPC", status);
return -ENODEV;
}
}
index = ppc;
if (pr->performance_platform_limit == index ||
ppc >= pr->performance->state_count)
return 0;
pr_debug("CPU %d: _PPC is %d - frequency %s limited\n", pr->id,
index, index ? "is" : "is not");
pr->performance_platform_limit = index;
if (unlikely(!freq_qos_request_active(&pr->perflib_req)))
return 0;
/*
* If _PPC returns 0, it means that all of the available states can be
* used ("no limit").
*/
if (index == 0)
qos_value = FREQ_QOS_MAX_DEFAULT_VALUE;
else
qos_value = pr->performance->states[index].core_frequency * 1000;
ret = freq_qos_update_request(&pr->perflib_req, qos_value);
if (ret < 0) {
pr_warn("Failed to update perflib freq constraint: CPU%d (%d)\n",
pr->id, ret);
}
return 0;
}
#define ACPI_PROCESSOR_NOTIFY_PERFORMANCE 0x80
/*
* acpi_processor_ppc_ost: Notify firmware the _PPC evaluation status
* @handle: ACPI processor handle
* @status: the status code of _PPC evaluation
* 0: success. OSPM is now using the performance state specified.
* 1: failure. OSPM has not changed the number of P-states in use
*/
static void acpi_processor_ppc_ost(acpi_handle handle, int status)
{
if (acpi_has_method(handle, "_OST"))
acpi_evaluate_ost(handle, ACPI_PROCESSOR_NOTIFY_PERFORMANCE,
status, NULL);
}
void acpi_processor_ppc_has_changed(struct acpi_processor *pr, int event_flag)
{
int ret;
if (ignore_ppc || !pr->performance) {
/*
* Only when it is notification event, the _OST object
* will be evaluated. Otherwise it is skipped.
*/
if (event_flag)
acpi_processor_ppc_ost(pr->handle, 1);
return;
}
ret = acpi_processor_get_platform_limit(pr);
/*
* Only when it is notification event, the _OST object
* will be evaluated. Otherwise it is skipped.
*/
if (event_flag) {
if (ret < 0)
acpi_processor_ppc_ost(pr->handle, 1);
else
acpi_processor_ppc_ost(pr->handle, 0);
}
if (ret >= 0)
cpufreq_update_limits(pr->id);
}
int acpi_processor_get_bios_limit(int cpu, unsigned int *limit)
{
struct acpi_processor *pr;
pr = per_cpu(processors, cpu);
if (!pr || !pr->performance || !pr->performance->state_count)
return -ENODEV;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/init.h`, `linux/cpufreq.h`, `linux/slab.h`, `linux/acpi.h`, `acpi/processor.h`, `asm/cpufeature.h`.
- Detected declarations: `function acpi_processor_get_platform_limit`, `function acpi_processor_ppc_ost`, `function acpi_processor_ppc_has_changed`, `function acpi_processor_get_bios_limit`, `function acpi_processor_ignore_ppc_init`, `function acpi_processor_ppc_init`, `function for_each_cpu`, `function acpi_processor_ppc_exit`, `function for_each_cpu`, `function acpi_processor_get_performance_control`.
- Atlas domain: Driver Families / drivers/acpi.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.