This series fixes multiple pp_dpm_* sysfs clocks reporting N/A or missing
the * current-level marker on SMU v14.0.0/v14.0.1 APUs (GC 11.5.1).

Background
----------
On GC 11.5.1 APUs, amd-smi reports N/A for VCLK, DCLK, VCLK1, DCLK1 and
DCEFCLK clocks. Additionally, MCLK and FCLK show DPM levels but lack the
* marker indicating the current level.

The N/A clocks are caused by missing IP_VERSION(11,5,1) entries in the
sysfs visibility whitelists and absent metric handlers. The missing *
marker is caused by the SMU reporting time-filtered average frequencies
that do not match any DPM level exactly.

Fix
---
1. Merge METRICS_AVERAGE_VCLK and METRICS_AVERAGE_DCLK into a single
   fall-through case mapping both to VclkFrequency (SmuMetrics_t has no
   DclkFrequency field; DCLK tracks VCLK on VCN). Add VCLK1/DCLK1
   metric handlers returning 0.

2. Add IP_VERSION(11,5,1) to pp_dpm_vclk, pp_dpm_dclk, pp_dpm_vclk1
   and pp_dpm_dclk1 whitelists. The target APU has two VCN instances.

3. Add SMU_DCEFCLK to get_dpm_freq_by_index and get_dpm_level_count
   using DcfClocks[]/NumDcfClkLevelsEnabled. Add DCEFCLK case in
   emit_clk_levels.

4. Add closest-match fallback in emit_clk_levels: first pass tries
   exact match; if no match (averaged frequency), mark the DPM level
   with the smallest absolute frequency difference. Reverse DPM index
   for SMU_MCLK since MemPstateTable stores levels high-to-low.

Validation
----------
Tested on GC 11.5.1, SMU 14.0.1 APU. All pp_dpm_* clocks now report
correct DPM levels with * markers via both sysfs and amd-smi.

Priya Hosur (4):
  drm/amd/pm: smu_v14_0_0: add DCLK and VCLK1/DCLK1 metric handlers
  drm/amd/pm: add IP_VERSION(11,5,1) to vclk/dclk DPM sysfs whitelists
  drm/amd/pm: smu_v14_0_0: add SMU_DCEFCLK support in DPM frequency
    queries
  drm/amd/pm: smu_v14_0_0: add closest-match fallback for DPM level
    marking

 drivers/gpu/drm/amd/pm/amdgpu_pm.c            |  8 +-
 .../drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c  | 76 +++++++++++++++++--
 2 files changed, 76 insertions(+), 8 deletions(-)

-- 
2.43.0

Reply via email to