1. 30 6月, 2021 1 次提交
    • D
      amdgpu/pm: remove code duplication in show_power_cap calls · 91161b06
      Darren Powell 提交于
       v3: updated patch to apply to latest code
       v2: reorder to check pointers before calling pm_runtime_* functions
      
       created generic function and call with enum from
       * amdgpu_hwmon_show_power_cap_max
       * amdgpu_hwmon_show_power_cap
       * amdgpu_hwmon_show_power_cap_default
      
      === Test ===
      AMDGPU_PCI_ADDR=`lspci -nn | grep "VGA\|Display" | cut -d " " -f 1`
      AMDGPU_HWMON=`ls -la /sys/class/hwmon | grep $AMDGPU_PCI_ADDR | cut -d " " -f 10`
      HWMON_DIR=/sys/class/hwmon/${AMDGPU_HWMON}
      
      cp pp_show_power_cap.txt{,.old}
      lspci -nn | grep "VGA\|Display" > pp_show_power_cap.test.log
      FILES="
      power1_cap
      power1_cap_max
      power1_cap_default "
      
      for f in $FILES
      do
        echo  $f = `cat $HWMON_DIR/$f` >> pp_show_power_cap.test.log
      done
      Signed-off-by: NDarren Powell <darren.powell@amd.com>
      Reviewed-by: NKevin Wang <kevin1.wang@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      91161b06
  2. 19 6月, 2021 1 次提交
    • D
      amdgpu/pm: replaced snprintf usage in amdgpu_pm.c with sysfs_emit · 09b6744c
      Darren Powell 提交于
       replaced snprintf usage in amdgpu_pm.c with sysfs_emit
       fixed warning on comparing int with uint32_t in amdgpu_get_pp_num_states()
      
      == Test ==
      AMDGPU_PCI_ADDR=`lspci -nn | grep "VGA\|Display" | cut -d " " -f 1`
      AMDGPU_HWMON=`ls -la /sys/class/hwmon | grep $AMDGPU_PCI_ADDR | cut -d " " -f 10`
      HWMON_DIR=/sys/class/hwmon/${AMDGPU_HWMON}
      
      lspci -nn | grep "VGA\|Display"  > scnprintf.test.log
      FILES="pp_num_states
      pp_od_clk_voltage
      pp_features
      pp_dpm_sclk
      pp_dpm_mclk
      pp_dpm_socclk
      pp_dpm_fclk
      pp_dpm_vclk
      pp_dpm_dclk
      pp_dpm_dcefclk
      pp_power_profile_mode "
      
      for f in $FILES
      do
        echo === $f === >> scnprintf.test.log
        cat $HWMON_DIR/device/$f >> scnprintf.test.log
      done
      Signed-off-by: NDarren Powell <darren.powell@amd.com>
      Reviewed-by: NKevin Wang <kevin1.wang@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      09b6744c
  3. 09 6月, 2021 4 次提交
  4. 05 6月, 2021 2 次提交
  5. 02 6月, 2021 1 次提交
  6. 11 5月, 2021 4 次提交
  7. 05 5月, 2021 1 次提交
  8. 29 4月, 2021 2 次提交
  9. 16 4月, 2021 1 次提交
  10. 10 4月, 2021 3 次提交
    • T
      drm/amd/pm: Convert sysfs sprintf/snprintf family to sysfs_emit · a9ca9bb3
      Tian Tao 提交于
      Fix the following coccicheck warning:
      drivers/gpu/drm/amd/pm/amdgpu_pm.c:1940:8-16: WARNING:
      use scnprintf or sprintf
      drivers/gpu/drm/amd/pm/amdgpu_pm.c:1978:8-16: WARNING:
      use scnprintf or sprintf
      drivers/gpu/drm/amd/pm/amdgpu_pm.c:2022:8-16: WARNING:
      use scnprintf or sprintf
      drivers/gpu/drm/amd/pm/amdgpu_pm.c:294:8-16: WARNING:
      use scnprintf or sprintf
      drivers/gpu/drm/amd/pm/amdgpu_pm.c:154:8-16: WARNING:
      use scnprintf or sprintf
      drivers/gpu/drm/amd/pm/amdgpu_pm.c:496:8-16: WARNING:
      use scnprintf or sprintf
      drivers/gpu/drm/amd/pm/amdgpu_pm.c:512:9-17: WARNING:
      use scnprintf or sprintf
      drivers/gpu/drm/amd/pm/amdgpu_pm.c:1740:8-16: WARNING:
      use scnprintf or sprintf
      drivers/gpu/drm/amd/pm/amdgpu_pm.c:1667:8-16: WARNING:
      use scnprintf or sprintf
      drivers/gpu/drm/amd/pm/amdgpu_pm.c:2074:8-16: WARNING:
      use scnprintf or sprintf
      drivers/gpu/drm/amd/pm/amdgpu_pm.c:2047:9-17: WARNING:
      use scnprintf or sprintf
      drivers/gpu/drm/amd/pm/amdgpu_pm.c:2768:8-16: WARNING:
      use scnprintf or sprintf
      drivers/gpu/drm/amd/pm/amdgpu_pm.c:2738:8-16: WARNING:
      use scnprintf or sprintf
      drivers/gpu/drm/amd/pm/amdgpu_pm.c:2442:8-16: WARNING:
      use scnprintf or sprintf
      drivers/gpu/drm/amd/pm/amdgpu_pm.c:3246:8-16: WARNING:
      use scnprintf or sprintf
      drivers/gpu/drm/amd/pm/amdgpu_pm.c:3253:8-16: WARNING:
      use scnprintf or sprintf
      drivers/gpu/drm/amd/pm/amdgpu_pm.c:2458:8-16: WARNING:
      use scnprintf or sprintf
      drivers/gpu/drm/amd/pm/amdgpu_pm.c:3047:8-16: WARNING:
      use scnprintf or sprintf
      drivers/gpu/drm/amd/pm/amdgpu_pm.c:3133:8-16: WARNING:
      use scnprintf or sprintf
      drivers/gpu/drm/amd/pm/amdgpu_pm.c:3209:8-16: WARNING:
      use scnprintf or sprintf
      drivers/gpu/drm/amd/pm/amdgpu_pm.c:3216:8-16: WARNING:
      use scnprintf or sprintf
      drivers/gpu/drm/amd/pm/amdgpu_pm.c:2410:8-16: WARNING:
      use scnprintf or sprintf
      drivers/gpu/drm/amd/pm/amdgpu_pm.c:2496:8-16: WARNING:
      use scnprintf or sprintf
      drivers/gpu/drm/amd/pm/amdgpu_pm.c:2470:8-16: WARNING:
      use scnprintf or sprintf
      drivers/gpu/drm/amd/pm/amdgpu_pm.c:2426:8-16: WARNING:
      use scnprintf or sprintf
      drivers/gpu/drm/amd/pm/amdgpu_pm.c:2965:8-16: WARNING:
      use scnprintf or sprintf
      drivers/gpu/drm/amd/pm/amdgpu_pm.c:2972:8-16: WARNING:
      use scnprintf or sprintf
      drivers/gpu/drm/amd/pm/amdgpu_pm.c:3006:8-16: WARNING:
      use scnprintf or sprintf
      drivers/gpu/drm/amd/pm/amdgpu_pm.c:3013:8-16: WARNING:
      use scnprintf or sprintf
      Signed-off-by: NTian Tao <tiantao6@hisilicon.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      a9ca9bb3
    • A
      drm/amdgpu/pm: bail on sysfs/debugfs queries during platform suspend · d2ae842d
      Alex Deucher 提交于
      The GPU is in the process of being shutdown.  Spurious queries during
      suspend and resume can put the SMU into a bad state.  Runtime PM is
      handled dynamically so we check if we are in non-runtime suspend.
      Reviewed-by: NEvan Quan <evan.quan@amd.com>
      Acked-by: NChristian König <christian.koenig@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      d2ae842d
    • E
      drm/amd/pm: label these APIs used internally as static · c6ce68e6
      Evan Quan 提交于
      Also drop unnecessary header file and declarations.
      Signed-off-by: NEvan Quan <evan.quan@amd.com>
      Reviewed-by: NAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      c6ce68e6
  11. 24 3月, 2021 4 次提交
  12. 06 3月, 2021 1 次提交
  13. 27 2月, 2021 5 次提交
    • D
      amdgpu/pm: Powerplay API for smu , updates to some pm functions · 8f4828d0
      Darren Powell 提交于
      v3: updated to include new clocks od_vddgfx_offset, od_cclk
          Context mismatch with revision v3 to patch 0003
      
      Modified Functions
        smu_sys_set_pp_table()        - modifed signature to match Powerplay API set_pp_table
        smu_force_performance_level() - modifed arg0 to match Powerplay API force_performance_level
        smu_od_edit_dpm_table()       - modifed arg0 to match Powerplay API odn_edit_dpm_table
      
      Other Changes
        smu_od_edit_dpm_table()       - removed call to task(READJUST_POWER_STATE) after COMMIT_TABLE,
                                        now handled in calling function
        amdgpu_set_power_dpm_force_performance_level() - now checks thermal for swsmu systems before trying to change level
        amdgpu_set_pp_od_clk_voltage() - now attempts to set fine_grain_clock_vol before swsmu edit dpm table
      Signed-off-by: NDarren Powell <darren.powell@amd.com>
      Reviewed-by: NEvan Quan <evan.quan@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      8f4828d0
    • D
      amdgpu/pm: Powerplay API for smu , changes to clock and profile mode functions · 2ea092e5
      Darren Powell 提交于
      v3: updated to include new clocks vclk, dclk, od_vddgfx_offset, od_cclk
          Added forward declaration for function smu_force_smuclk_levels to resolve clash with other commits
          Resolved context clashes with other commits and v3 updates to patches 0003, 0004
      v2: fix errors flagged by checkpatch
      
      New Functions
        smu_bump_power_profile_mode() - changes profile mode assuming calling function already has mutex
        smu_force_ppclk_levels()      - accepts Powerplay enum pp_clock_type to specify clock to change
        smu_print_ppclk_levels()      - accepts Powerplay enum pp_clock_type to request clock levels
        amdgpu_get_pp_dpm_clock()     - accepts Powerplay enum pp_clock_type to request clock levels and allows
                                        all the amdgpu_get_pp_dpm_$CLK functions to have a single codepath
        amdgpu_set_pp_dpm_clock()     - accepts Powerplay enum pp_clock_type to set clock levels and allows
                                        all the amdgpu_set_pp_dpm_$CLK functions to have a single codepath
      
      Modified Functions
        smu_force_smuclk_levels        - changed function name to make clear difference to smu_force_ppclk_levels
        smu_force_ppclk_levels()       - modifed signature to implement Powerplay API force_clock_level
                                       - calls smu_force_smuclk_levels
        smu_print_smuclk_levels        - changed function name to make clear difference to smu_print_ppclk_levels
        smu_print_ppclk_levels()       - modifed signature to implement Powerplay API force_clock_level
                                       - calls smu_print_smuclk_levels
        smu_sys_get_gpu_metrics        - modifed arg0 to match Powerplay API get_gpu_metrics
        smu_get_power_profile_mode     - modifed arg0 to match Powerplay API get_power_profile_mode
        smu_set_power_profile_mode     - modifed arg0 to match Powerplay API set_power_profile_mode
                                       - removed arg lock_needed, mutex always locked, internal functions
                                         can call smu_bump if they already hold lock
        smu_switch_power_profile       - now calls smu_bump as already holds mutex lock
        smu_adjust_power_state_dynamic - now calls smu_bump as already holds mutex lock
        amdgpu_get_pp_od_clk_voltage   - uses smu_print_ppclk_levels
        amdgpu_{set,get}_pp_dpm_$CLK   - replace logic with call helper function amdgpu_{set,get}_pp_dpm_clock()
                                         CLK ={sclk, mclk, socclk, fclk, dcefclk, pci, vclkd, dclk}
      
      Other Changes
        added 5 smu Powerplay functions to swsmu_dpm_funcs
        removed special smu handling in pm functions and called through Powerplay API
      Signed-off-by: NDarren Powell <darren.powell@amd.com>
      Reviewed-by: NEvan Quan <evan.quan@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      2ea092e5
    • D
      amdgpu/pm: Powerplay API for smu , changed 9 pm power functions to use API · 8dfc8c53
      Darren Powell 提交于
      v2: remove check for error during swsmu amdgpu_dpm_get_pp_num_states() call to match previous powerplay behaviour
      v3: removed smu implementation of powerplay get_power_limit
          Resolved context clashes with other commits
      
      Modified Files
        smu_set_power_limit()         - modifed arg0 to match Powerplay API set_power_limit
        smu_sys_get_pp_table()        - modifed signature to match Powerplay API get_pp_table
        smu_get_power_num_states()    - modifed arg0 to match Powerplay API get_pp_num_states
        smu_get_current_power_state() - modifed arg0 to match Powerplay API get_current_power_state
        smu_sys_get_pp_feature_mask() - modifed signature to match Powerplay API get_ppfeature_status
        smu_sys_set_pp_feature_mask() - modifed arg0 to match Powerplay API set_ppfeature_status
      
      Other Changes
        added 6 above smu Powerplay functions to swsmu_dpm_funcs
        removed special smu handling of above functions and called through Powerplay API
      Signed-off-by: NDarren Powell <darren.powell@amd.com>
      Reviewed-by: NEvan Quan <evan.quan@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      8dfc8c53
    • D
      amdgpu/pm: Powerplay API for smu , changed 6 pm hwmon fan functions to use API · f46587bc
      Darren Powell 提交于
      v2: changed error return value of smu_get_fan_control_mode to AMD_FAN_CTRL_NONE
          fixed type in amdgpu_hwmon_get_pwm1_enable() print statement
          fixed indent flagged by checkpatch.pl
      
      Modified Functions
        smu_set_fan_speed_rpm()     - modifed arg0 to match Powerplay API set_fan_speed_rpm
        smu_get_fan_control_mode()  - modifed signature to match Powerplay API get_fan_control_mode
        smu_set_fan_control_mode()  - modifed signature to match Powerplay API set_fan_control_mode
        smu_get_fan_speed_percent() - modifed signature to match Powerplay API get_fan_speed_percent
        smu_set_fan_speed_percent() - modifed signature to match Powerplay API set_fan_speed_percent
        smu_get_fan_speed_rpm()     - modifed arg0 to match Powerplay API get_fan_speed_rpm
      
      Other Changes
        added 6 above smu fan Powerplay functions to swsmu_dpm_funcs
        removed special smu handling of above functions and called through Powerplay API
      Signed-off-by: NDarren Powell <darren.powell@amd.com>
      Reviewed-by: NAlex Deucher <alexander.deucher@amd.com>
      Reviewed-by: NEvan Quan <evan.quan@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      f46587bc
    • D
      amdgpu/pm: Powerplay API for smu , added get_performance_level · 4df144f8
      Darren Powell 提交于
      v2: updated the structure name to swsmu_pm_funcs
      
      Modified Functions
        smu_get_performance_level() - modifed arg0 to match Powerplay API get_performance_level
      
      Other Changes
        added a new structure swsmu_dpm_funcs to hold smu functions for Powerplay API
        removed special smu handling from amdgpu_get_power_dpm_force_performance_level
      Signed-off-by: NDarren Powell <darren.powell@amd.com>
      Reviewed-by: NAlex Deucher <alexander.deucher@amd.com>
      Reviewed-by: NEvan Quan <evan.quan@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      4df144f8
  14. 19 2月, 2021 1 次提交
  15. 10 2月, 2021 2 次提交
  16. 03 2月, 2021 1 次提交
  17. 02 2月, 2021 3 次提交
  18. 20 1月, 2021 1 次提交
    • H
      drm/amdgpu: fix build error without x86 kconfig (v2) · 4aef0ebc
      Huang Rui 提交于
      This patch is to fix below build error while we are using the kconfig
      without x86.
      
      drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/vangogh_ppt.c: In function
      'vangogh_get_smu_metrics_data':
      drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/vangogh_ppt.c:300:10:
      error: 'boot_cpu_data' undeclared (first use in this function); did you
      mean 'boot_cpuid'?
        300 |          boot_cpu_data.x86_max_cores * sizeof(uint16_t));
            |          ^~~~~~~~~~~~~
            |          boot_cpuid
      drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/vangogh_ppt.c: In function
      'vangogh_read_sensor':
      drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/vangogh_ppt.c:1320:11:
      error: 'boot_cpu_data' undeclared (first use in this function); did you
      mean 'boot_cpuid'?
       1320 |   *size = boot_cpu_data.x86_max_cores * sizeof(uint16_t);
            |           ^~~~~~~~~~~~~
            |           boot_cpuid
      drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/vangogh_ppt.c: In function
      'vangogh_od_edit_dpm_table':
      drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/vangogh_ppt.c:1460:19:
      error: 'boot_cpu_data' undeclared (first use in this function); did you
      mean 'boot_cpuid'?
       1460 |   if (input[0] >= boot_cpu_data.x86_max_cores) {
            |                   ^~~~~~~~~~~~~
            |                   boot_cpuid
      
      v2: fix #ifdef and add comment for APU only
      Reported-by: NStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: NHuang Rui <ray.huang@amd.com>
      Reviewed-by: NAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      4aef0ebc
  19. 15 1月, 2021 1 次提交
    • X
      drm/amd/pm: modify the fine grain tuning function for Renoir · e017fb66
      Xiaojian Du 提交于
      This patch is to modify the fine grain tuning function for Renoir.
      The fine grain tuning function uses the sysfs node -- pp_od_clk_voltage
      to config gfxclk. Meanwhile, another sysfs
      node -- power_dpm_force_perfomance_level also affects the gfx clk.
      It will cause confusion when these two sysfs nodes works
      together.
      It is risky to add two new flags to common smu struct, so
      this patch uses the existing flag to make these two sysfs nodes works
      separately. Only when power_dpm_force_perfomance_level is changed
      to "manual" mode, the fine grain function will be started.
      In other profile modes, including "auto", "high", "low", "profile_peak",
      "profile_standard", "profile_min_sclk", "profile_min_mclk",
      the fine grain tuning function will be shut down and the frequency range
      of gfx will be restored the default value.
      Signed-off-by: NXiaojian Du <Xiaojian.Du@amd.com>
      Reviewed-by: NHuang Rui <ray.huang@amd.com>
      Reviewed-by: NKevin Wang <kevin1.wang@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      e017fb66
  20. 14 1月, 2021 1 次提交