The power library does not work with the amd-pstate driver in passive
mode. Initialization fails because the current frequency read from
scaling_setspeed never matches one of the synthesized frequency buckets
exactly, since amd-pstate scales continuously.

The first patch fixes the matching. The second fixes an unrelated bug
found while testing: the sysfs file is buffered, so a frequency the
kernel rejected was reported as success. The third fixes the unit test,
which assumed the nominal frequency sits at a fixed index in the table.

Tested on a Ryzen 9 7945HX booted with amd_pstate=passive and the
cpufreq_userspace governor loaded. power_cpufreq_autotest now passes,
with and without turbo.

v2 - fixed review comment from GPT
   - fixed two other bugs found during review/testing.

Stephen Hemminger (3):
  power/amd_pstate: fix frequency matching for continuous scaling
  power: check for errors when writing frequency
  test/power: fix nominal frequency check with amd-pstate

 app/test/test_power_cpufreq.c                 |  5 +-
 drivers/power/acpi/acpi_cpufreq.c             | 12 ++-
 drivers/power/amd_pstate/amd_pstate_cpufreq.c | 89 +++++++++++++------
 drivers/power/cppc/cppc_cpufreq.c             | 12 ++-
 4 files changed, 74 insertions(+), 44 deletions(-)

-- 
2.53.0

Reply via email to