[PATCH 0/8] amdgpu/pm: Implement emit_clock_levels for arcturus, aldebaran

Darren Powell darren.powell at amd.com
Thu Apr 27 06:27:10 UTC 2023


amdgpu/pm: Implement emit_clock_levels for arcturus,aldebaran

== Description ==
Scnprintf use within the kernel is not recommended, but simple sysfs_emit replacement has
not been successful due to the page alignment requirement of the function. This patch
set implements a new api "emit_clock_levels" to facilitate passing both the base and
offset to the device rather than just the write pointer.

This patch set replaces print_clock_levels for arcturus and aldebaran platforms with 
emit_clock_levels, and also optimizes the code to reduce the code duplication for each 
different clock. This was spread into three parts to show more clearly the changes made
to the code, followed by combining the common code into a second switch statement.
It is similar to previous work on vega10 to implement emit_clk_levels
 commit a63e6b83 ("amdgpu/pm: Implement emit_clk_levels for vega10")
with the addition of the optimization to reduce code duplication.

== Patch Summary ==
   linux: (git at gitlab.freedesktop.org:agd5f) origin/amd-staging-drm-next @ 2d8c6b82e241
    + 9a269da4c047 amdgpu/pm: Replace print_clock_levels with emit_clock_levels for arcturus
    + 51ce0fcc9599 amdgpu/pm: Optimize emit_clock_levels for arcturus - part 1
    + dcaa5b7551dd amdgpu/pm: Optimize emit_clock_levels for arcturus - part 2
    + 1d16d820e4ee amdgpu/pm: Optimize emit_clock_levels for arcturus - part 3
    + b374fbf6013d amdgpu/pm: Replace print_clock_levels with emit_clock_levels for aldebaran
    + 2ecf48d3e83c amdgpu/pm: Optimize emit_clock_levels for aldebaran - part 1
    + fd8c21e1d1e4 amdgpu/pm: Optimize emit_clock_levels for aldebaran - part 2
    + a67ce808f18c amdgpu/pm: Optimize emit_clock_levels for aldebaran - part 3

== System Summary ==
 * DESKTOP(AMD Ryzen9 7900 + NAVI10(731f/ca), BIOS: 1.11)
  + ISO(Ubuntu 22.04.2 LTS)
  + Kernel(6.1.11-20230412-fdoagd5f-g2d8c6b82e241)

== Test ==
AMDGPU_PCI_ADDR=`lspci -nn | grep "VGA\|Display" | cut -d " " -f 1`
AMDGPU_HWMON=`ls -la /sys/class/hwmon | grep $AMDGPU_PCI_ADDR | awk '{print $9}'`
HWMON_DIR=/sys/class/hwmon/${AMDGPU_HWMON}

lspci -nn | grep "VGA\|Display"  > $LOGFILE
printf 'OD enabled = %X\n' "$(( `cat /sys/module/amdgpu/parameters/ppfeaturemask` & 0x4000 ))" >> $LOGFILE
FILES="pp_od_clk_voltage
pp_dpm_sclk
pp_dpm_mclk
pp_dpm_pcie
pp_dpm_socclk
pp_dpm_fclk
pp_dpm_dcefclk
pp_dpm_vclk
pp_dpm_dclk "

for f in $FILES
do
  echo === $f === >> $LOGFILE
  cat $HWMON_DIR/device/$f >> $LOGFILE
done
cat $LOGFILE

Darren Powell (8):
  amdgpu/pm: Replace print_clock_levels with emit_clock_levels for
    arcturus
  amdgpu/pm: Optimize emit_clock_levels for arcturus - part 1
  amdgpu/pm: Optimize emit_clock_levels for arcturus - part 2
  amdgpu/pm: Optimize emit_clock_levels for arcturus - part 3
  amdgpu/pm: Replace print_clock_levels with emit_clock_levels for
    aldebaran
  amdgpu/pm: Optimize emit_clock_levels for aldebaran - part 1
  amdgpu/pm: Optimize emit_clock_levels for aldebaran - part 2
  amdgpu/pm: Optimize emit_clock_levels for aldebaran - part 3

 .../gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c | 166 ++++++----------
 .../drm/amd/pm/swsmu/smu13/aldebaran_ppt.c    | 181 +++++++-----------
 2 files changed, 132 insertions(+), 215 deletions(-)


base-commit: 2d8c6b82e241f2d1a802ae6bbc24c127e689c724
-- 
2.34.1



More information about the amd-gfx mailing list