⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

Module cpufreq

Module cpufreq 

Source
Expand description

CPU Frequency Scaling via MSR for x86_64.

Controls CPU P-states (performance states) through the IA32_PERF_CTL and IA32_PERF_STATUS MSRs. Supports three governors:

  • Performance: fixed at maximum frequency
  • Powersave: fixed at minimum frequency
  • Ondemand: dynamic scaling based on CPU utilization (integer math)

P-state ratios are read from MSR_PLATFORM_INFO (0xCE) which provides the minimum and maximum non-turbo frequency ratios. The bus clock frequency (typically 100 MHz) is used to convert ratios to kHz.

Enums§

CpuGovernor
CPU frequency scaling governor.

Functions§

cpufreq_available_governors
Get the list of available governor names.
cpufreq_get_available_frequencies
Get available CPU frequencies in kHz.
cpufreq_get_frequency
Get the current CPU frequency in kHz.
cpufreq_get_governor
Get the current governor.
cpufreq_get_max_frequency
Get the maximum frequency in kHz.
cpufreq_get_min_frequency
Get the minimum frequency in kHz.
cpufreq_init
Initialize the CPU frequency scaling subsystem.
cpufreq_ondemand_sample
Sample CPU load and adjust frequency (called periodically).
cpufreq_set_frequency
Set the target CPU frequency in kHz.
cpufreq_set_governor
Set the active CPU frequency governor.
is_initialized
Check if cpufreq is initialized.