Skip to content

Add amd_pstate-based driver

With Linux 6.3 the amd_pstate driver also supports an active/autonomous mode in addition to the current passive mode, which exposes a /sys/devices/system/cpu/cpufreq/policyX/energy_performance_preference file that acts similarly to the one intel_pstate exposes, along with a /sys/devices/system/cpu/cpufreq/policyX/energy_performance_available_preferences file as well. On my system (HP Omen 16-n0067AX, AMD Ryzen 7 6800H, kernel 6.3-rc6 compiled from git), when booting with amd_pstate=active added to the kernel command line I have default performance balance_performance balance_power power as the available preferences, and so far I have been quite happy with the power preference to save power and keep CPU temperatures lower and balance_performance for better responsiveness if desired.

So, given the very similar interface I decided to try my hand at making power-profiles-daemon work with amd_pstate like it does with intel_pstate, using the code from the existing Intel P-state PPD driver as a base (removing the bits about turbo and EPB since I don't see equivalents for those knobs/metrics on my system), and this code works for me alongside the power profile UI in KDE Plasma. In particular, switching between the power saving, balanced and performance profiles changes the EPP to power, balance_performance and performance like I see with my other Intel based laptop, and I can also see the CPU frequency behaviour change as I switch between them via KDE's GUI.

I marked this MR as a draft since I assume some proper code sharing between this and the existing Intel P-states driver would be desirable instead of the straight copy paste job I did here, but I'm not sure what that would look like (I don't have much experience in C).

Also, currently I don't see any sort of platform profiles present on my system so I don't know for sure if platform profiles would still be preferred over using AMD P-states, although given it's doing the exact same things as the Intel P-states driver I assume it should work fine, and the test for that seems to work.

Fixes #108 (closed)

Edited by Prajna Sariputra

Merge request reports