Preparing Linux for AMD CPPC HighestFreq: A Hands-On Guide

From Moocchen, the free encyclopedia of technology

Overview

The AMD P-State driver is the modern Linux CPU frequency scaling solution for AMD processors. It leverages the Collaborative Processor Performance Control (CPPC) interface defined in the ACPI specification. A forthcoming ACPI revision introduces a new register called HighestFreq, which will allow the operating system to query the maximum achievable frequency under ideal conditions. This guide walks you through understanding this feature, preparing your Linux system for it, and validating that your environment is ready—even before the spec is finalized.

Preparing Linux for AMD CPPC HighestFreq: A Hands-On Guide

We'll cover what CPPC is, why HighestFreq matters, and how to check your current kernel and hardware support. You'll also find code examples and common pitfalls to avoid.

Prerequisites

Hardware Requirements

  • An AMD processor based on Zen 2 (Ryzen 3000) or newer – Zen 3 and Zen 4 are recommended for full CPPC support.
  • A BIOS/UEFI that exposes CPPC tables to the operating system (most modern firmware does).
  • Sufficient cooling and power delivery to sustain high-frequency states.

Software Requirements

  • A recent Linux kernel (v5.17 or later) with the amd_pstate driver compiled either as a module or built-in.
  • ACPI support enabled in the kernel configuration (CONFIG_ACPI and CONFIG_ACPI_CPPC_LIB).
  • Access to a terminal and root privileges for verification.
  • Optionally, tools like cpupower or turbostat for advanced monitoring.

Step-by-Step Instructions

1. Identify Your Current CPU Frequency Scaling Driver

First, confirm which driver is managing your AMD CPU. Run:

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver

If the output is amd-pstate, you're already using the right driver. If it shows acpi-cpufreq or intel_pstate, you may need to enable amd_pstate explicitly.

To switch, add the kernel boot parameter amd_pstate=active (or amd_pstate=passive) in your bootloader configuration (e.g., GRUB).

2. Verify CPPC Support at Runtime

The kernel exposes CPPC capabilities via sysfs. Check for the presence of CPPC directories:

ls /sys/devices/system/cpu/cpu0/acpi_cppc/

Expected files include highest_perf, lowest_perf, nominal_perf, and lowest_nonlinear_perf. The upcoming HighestFreq register will appear here as highest_freq once the kernel adds support. Even before that, you can inspect the raw ACPI data:

cat /sys/firmware/acpi/tables/CPPC

Binary output means your system has a CPPC table. To decode it, use acpidump and iasl (from the ACPICA tools).

3. Check Kernel Version and Patches

The HighestFreq support is being developed in the linux-pm mailing list. To track progress:

uname -r

For bleeding-edge features, you may need a kernel from the linux-next branch or a custom build with the pending patches. Search for "CPPC HighestFreq" in git log of your kernel source:

git log --oneline --grep="HighestFreq"

If none appear, the patches haven't been merged yet. You can apply them manually from the mailing list archive.

4. Test with a Modified ACPI Table (Simulation)

To validate that your kernel would recognize the new register, you can craft a custom CPPC table using ACPICA tools. This is advanced but helps with development:

  1. Install acpica-tools (Ubuntu: sudo apt install acpica-tools).
  2. Dump your current CPPC table: acpidump > acpidump.out
  3. Disassemble: acpixtract acpidump.out then iasl -d cppc.dat
  4. Edit the resulting cppc.dsl to include a field named HighestFreq at the correct offset (typically 64-bit, after LowestFreq).
  5. Recompile and load the table: iasl -sa cppc.dsl and then sudo acpidump -o cppc.aml – however, loading custom tables requires kernel support and is not recommended on production systems.

Instead, monitor dmesg for CPPC: HighestFreq not found messages, which indicate that the kernel is looking for the register but the firmware doesn't provide it yet.

5. Monitor CPU Frequency and Performance

Once your kernel supports HighestFreq, you can query the maximum theoretical frequency:

cat /sys/devices/system/cpu/cpu0/acpi_cppc/highest_freq

Compare with actual maximum frequency from cpufreq:

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq

Use cpupower monitor or turbostat --show frequency to watch real-time clocks. A large gap between highest_freq and scaling_max_freq might indicate thermal or power limit throttling.

Common Mistakes

Mistake 1: Using the Wrong Kernel Parameter

Some users mistakenly pass intel_pstate=disable instead of enabling amd_pstate. On AMD systems, set amd_pstate=active in the bootloader. Also, avoid acpi_osi=Linux as it can interfere with CPPC table loading.

Mistake 2: Not Having CPPC in BIOS

Even on modern AMD hardware, some motherboards disable CPPC by default. Check BIOS settings under CPU Configuration or Power Management for an option named CPPC – enable it.

Mistake 3: Relying on Outdated Tools

Old versions of cpupower or turbostat may not report CPPC fields. Ensure you have a recent version of the linux-tools package matching your kernel.

Mistake 4: Misreading the ACPI Table Format

The HighestFreq register is a 64-bit value in MHz, but the actual field layout depends on the ACPI revision. When manually editing tables, you must follow the byte offsets precisely – one mistake can cause system instability. Always verify with acpixtract and iasl.

Summary

The HighestFreq feature in AMD CPPC will give Linux a more accurate picture of a processor's peak capability, enabling better performance scaling decisions. This guide has shown you how to verify your current driver, check kernel support, simulate the feature, and avoid common pitfalls. As the ACPI spec evolves, keep your kernel up to date and watch the linux-pm mailing list for final patches.