After a GPU reset the level reported through
power_dpm_force_performance_level no longer describes the hardware. The
reset reinitialises PMFW, which comes back on its default curve, but
smu_dpm.dpm_level still holds the level the user forced, and that cached
value is what sysfs reports.

On an SMU 14.0.1 APU this shows up as gfxclk dropping from 2.8GHz to 600MHz
while sysfs still reports high, with no thermal or power event involved:

  before  level: high   freq: 2799000000
          amdgpu 0000:c5:00.0: MODE2 reset
          amdgpu 0000:c5:00.0: SMU is resumed successfully!
  after   level: high   freq:  600000000

The stale value also leaves the user with no way back. Writing the same
level again is dropped by amdgpu_dpm_force_performance_level(), which
returns early when the requested level matches the cached one, so only a
genuine change of level reaches the hardware:

  after reset            : 600000000
  re-write "high" (same) : 600000000
  toggle auto -> high    : 2691000000

Since the reset often goes unnoticed, the machine quietly runs at a fraction
of the requested clock with no indication to the user.

The patch resets the cached level once PMFW has been reinitialised, so that
it describes the hardware and writing the level again takes effect. It is
scoped to reset recovery only, as PMFW retains its state across s2idle and
the forced level still applies on resume.

Tested on an SMU 14.0.1 APU. For each level: set it, trigger a reset
through debugfs, then write the same level again.

  level          set        after reset    after writing it again
  high           2691MHz    auto 600MHz    high 2691MHz
  low             600MHz    auto 600MHz    low 600MHz
  auto            600MHz    auto 600MHz    auto 600MHz
  manual          600MHz    auto 600MHz    manual 600MHz
  profile_peak   2081MHz    auto 600MHz    profile_peak 2201MHz

Every level reports auto after the reset, matching the hardware, and writing
the level again takes effect in each case. profile_peak sets a ceiling
rather than a floor, so its sampled clock varies with load.

Suspend/resume is unaffected: high at 2771MHz before suspend, still high at
2799MHz after resume.

This is the only configuration I have available to test. The change is in
generic SMU code, so it applies to every ASIC going through smu_late_init().

Priya Hosur (1):
  drm/amd/pm: report the default performance level after a reset

 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 4 ++++
 1 file changed, 4 insertions(+)

-- 
2.43.0

Reply via email to