drm/amdgpu: Rename set_mmhub_powergating_by_smu to powergate_mmhub
Subsystems (2)
PATCH 1/5 drm/amdgpu: Rename set_mmhub_powergating_by_smu to powergate_mmhub
In order to keep consistent with powergate_uvd/vce.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h | 4 ++-- drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c | 4 ++-- drivers/gpu/drm/amd/include/kgd_pp_interface.h | 2 +- drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 8 ++++---- drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c | 4 ++-- drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h +2 -2
@@ -359,8 +359,8 @@ enum amdgpu_pcie_gen { ((adev)->powerplay.pp_funcs->odn_edit_dpm_table (\ (adev)->powerplay.pp_handle, type, parameter, size)) -#define amdgpu_dpm_set_mmhub_powergating_by_smu (adev) \ - ((adev)->powerplay.pp_funcs->set_mmhub_powergating_by_smu( \ +#define amdgpu_dpm_powergate_mmhub (adev) \ + ((adev)->powerplay.pp_funcs->powergate_mmhub( \ (adev)->powerplay.pp_handle))struct amdgpu_dpm {
drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +2 -2
@@ -471,8 +471,8 @@ void mmhub_v1_0_update_power_gating(struct amdgpu_device *adev, RENG_EXECUTE_ON_REG_UPDATE, 1);WREG32_SOC15 (MMHUB ,0 , mmPCTL1_RENG_EXECUTE, pctl1_reng_execute); -if (adev->powerplay.pp_funcs->set_mmhub_powergating_by_smu) -amdgpu_dpm_set_mmhub_powergating_by_smu (adev); +if (adev->powerplay.pp_funcs->powergate_mmhub) +amdgpu_dpm_powergate_mmhub (adev); }else { pctl0_reng_execute = REG_SET_FIELD(pctl0_reng_execute,
drivers/gpu/drm/amd/include/kgd_pp_interface.h +1 -1
@@ -269,7 +269,7 @@ struct amd_pm_funcs {int (*get_power_profile_mode)(void *handle,char *buf);int (*set_power_profile_mode)(void *handle,long *input,uint32_t size);int (*odn_edit_dpm_table)(void *handle,uint32_t type,long *input,uint32_t size); - int (*set_mmhub_powergating_by_smu)(void *handle); + int (*powergate_mmhub)(void *handle); };#endif
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +4 -4
@@ -1183,19 +1183,19 @@ static int pp_get_display_mode_validation_clocks(void *handle,return ret; } -static int pp_set_mmhub_powergating_by_smu (void *handle) +static int pp_dpm_powergate_mmhub (void *handle) {struct pp_hwmgr *hwmgr = handle;if (!hwmgr || !hwmgr->pm_en)return -EINVAL ; -if (hwmgr->hwmgr_func->set_mmhub_powergating_by_smu ==NULL ) { +if (hwmgr->hwmgr_func->powergate_mmhub ==NULL ) {pr_info ("%s was not implemented.\n" , __func__);return 0 ; } -return hwmgr->hwmgr_func->set_mmhub_powergating_by_smu (hwmgr); +return hwmgr->hwmgr_func->powergate_mmhub (hwmgr); }static const struct amd_pm_funcs pp_dpm_funcs = {
@@ -1242,5 +1242,5 @@ static int pp_set_mmhub_powergating_by_smu(void *handle) .set_watermarks_for_clocks_ranges = pp_set_watermarks_for_clocks_ranges, .display_clock_voltage_request = pp_display_clock_voltage_request, .get_display_mode_validation_clocks = pp_get_display_mode_validation_clocks, - .set_mmhub_powergating_by_smu = pp_set_mmhub_powergating_by_smu, + .powergate_mmhub = pp_dpm_powergate_mmhub, };
drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c +2 -2
@@ -1149,7 +1149,7 @@ static int smu10_smus_notify_pwe(struct pp_hwmgr *hwmgr)return smum_send_msg_to_smc (hwmgr, PPSMC_MSG_SetRccPfcPmeRestoreRegister); } -static int smu10_set_mmhub_powergating_by_smu (struct pp_hwmgr *hwmgr) +static int smu10_powergate_mmhub (struct pp_hwmgr *hwmgr) {return smum_send_msg_to_smc (hwmgr, PPSMC_MSG_PowerGateMmHub); }
@@ -1241,7 +1241,7 @@ static int smu10_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, uin .asic_setup = smu10_setup_asic_task, .power_state_set = smu10_set_power_state_tasks, .dynamic_state_management_disable = smu10_disable_dpm_tasks, - .set_mmhub_powergating_by_smu = smu10_set_mmhub_powergating_by_smu, + .powergate_mmhub = smu10_powergate_mmhub, .smus_notify_pwe = smu10_smus_notify_pwe, .gfx_off_control = smu10_gfx_off_control, .get_power_profile_mode = smu10_get_power_profile_mode,
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +1 -1
@@ -327,7 +327,7 @@ struct pp_hwmgr_func {enum PP_OD_DPM_TABLE_COMMAND type, long *input, uint32_t size);int (*set_power_limit)(struct pp_hwmgr *hwmgr,uint32_t n); -int (*set_mmhub_powergating_by_smu)(struct pp_hwmgr *hwmgr); +int (*powergate_mmhub)(struct pp_hwmgr *hwmgr);int (*smus_notify_pwe)(struct pp_hwmgr *hwmgr); };
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1528176139-26350-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org
PATCH 2/5 drm/amd/pp: Rename enable_per_cu_power_gating to powergate_gfx
keep consistent with powergate_uvd/vce/mmhub
--- drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 4 ++-- drivers/gpu/drm/amd/powerplay/hwmgr/smu7_clockpowergating.c | 2 +- drivers/gpu/drm/amd/powerplay/hwmgr/smu7_clockpowergating.h | 2 +- drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 2 +- drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +2 -2
@@ -244,13 +244,13 @@ static int pp_set_powergating_state(void *handle,pr_err ("gfx off control failed!\n" ); } -if (hwmgr->hwmgr_func->enable_per_cu_power_gating ==NULL ) { +if (hwmgr->hwmgr_func->powergate_gfx ==NULL ) {pr_info ("%s was not implemented.\n" , __func__);return 0 ; }/* Enable/disable GFX per cu powergating through SMU */ -return hwmgr->hwmgr_func->enable_per_cu_power_gating (hwmgr, +return hwmgr->hwmgr_func->powergate_gfx (hwmgr, state ==AMD_PG_STATE_GATE ); }
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_clockpowergating.c +1 -1
@@ -416,7 +416,7 @@ int smu7_update_clock_gatings(struct pp_hwmgr *hwmgr,* Powerplay will only control the static per CU Power Gating. * Dynamic per CU Power Gating will be done in gfx. */ -int smu7_enable_per_cu_power_gating (struct pp_hwmgr *hwmgr,bool enable) +int smu7_powergate_gfx (struct pp_hwmgr *hwmgr,bool enable) {struct amdgpu_device *adev = hwmgr->adev;
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_clockpowergating.h +1 -1
@@ -33,6 +33,6 @@int smu7_disable_clock_power_gating (struct pp_hwmgr *hwmgr);int smu7_update_clock_gatings (struct pp_hwmgr *hwmgr,const uint32_t *msg_id); -int smu7_enable_per_cu_power_gating (struct pp_hwmgr *hwmgr,bool enable); +int smu7_powergate_gfx (struct pp_hwmgr *hwmgr,bool enable);#endif
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +1 -1
@@ -5045,7 +5045,7 @@ static int smu7_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, uint .get_fan_control_mode = smu7_get_fan_control_mode, .force_clock_level = smu7_force_clock_level, .print_clock_levels = smu7_print_clock_levels, - .enable_per_cu_power_gating = smu7_enable_per_cu_power_gating, + .powergate_gfx = smu7_powergate_gfx, .get_sclk_od = smu7_get_sclk_od, .set_sclk_od = smu7_set_sclk_od, .get_mclk_od = smu7_get_mclk_od,
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +1 -1
@@ -302,7 +302,7 @@ struct pp_hwmgr_func {int (*power_off_asic)(struct pp_hwmgr *hwmgr);int (*force_clock_level)(struct pp_hwmgr *hwmgr,enum pp_clock_type type,uint32_t mask);int (*print_clock_levels)(struct pp_hwmgr *hwmgr,enum pp_clock_type type,char *buf); -int (*enable_per_cu_power_gating)(struct pp_hwmgr *hwmgr,bool enable); +int (*powergate_gfx)(struct pp_hwmgr *hwmgr,bool enable);int (*get_sclk_od)(struct pp_hwmgr *hwmgr);int (*set_sclk_od)(struct pp_hwmgr *hwmgr,uint32_t value);int (*get_mclk_od)(struct pp_hwmgr *hwmgr);
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/5 drm/amd/pp: Unify powergate_uvd/vce/mmhub to set_powergating_by_smu
In reply to a message not in the archiveSome HW ip blocks need call SMU to enter/leave power gate state. So export common set_powergating_by_smu interface.
1. keep consistent with set_clockgating_by_smu
2. scales easily to powergate other ip(gfx) if necessary
--- drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h | 14 ++++--------- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 8 +++---- drivers/gpu/drm/amd/amdgpu/ci_dpm.c | 15 ++++++++++++- drivers/gpu/drm/amd/amdgpu/kv_dpm.c | 15 ++++++++++++- drivers/gpu/drm/amd/include/kgd_pp_interface.h | 5 ++--- drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 29 +++++++++++++++++++++++--- 6 files changed, 64 insertions(+), 22 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h +4 -10
@@ -287,12 +287,6 @@ enum amdgpu_pcie_gen {#define amdgpu_dpm_force_performance_level (adev, l) \ ((adev)->powerplay.pp_funcs->force_performance_level((adev)->powerplay.pp_handle, (l))) -#define amdgpu_dpm_powergate_uvd (adev, g) \ - ((adev)->powerplay.pp_funcs->powergate_uvd((adev)->powerplay.pp_handle, (g))) - -#define amdgpu_dpm_powergate_vce (adev, g) \ - ((adev)->powerplay.pp_funcs->powergate_vce((adev)->powerplay.pp_handle, (g))) -#define amdgpu_dpm_get_current_power_state (adev) \ ((adev)->powerplay.pp_funcs->get_current_power_state((adev)->powerplay.pp_handle))
@@ -347,6 +341,10 @@ enum amdgpu_pcie_gen { ((adev)->powerplay.pp_funcs->set_clockgating_by_smu (\ (adev)->powerplay.pp_handle, msg_id)) +#define amdgpu_dpm_set_powergating_by_smu (adev, block_type, gate) \ + ((adev)->powerplay.pp_funcs->set_powergating_by_smu(\ + (adev)->powerplay.pp_handle, block_type, gate)) +#define amdgpu_dpm_get_power_profile_mode (adev, buf) \ ((adev)->powerplay.pp_funcs->get_power_profile_mode(\ (adev)->powerplay.pp_handle, buf))
@@ -359,10 +357,6 @@ enum amdgpu_pcie_gen { ((adev)->powerplay.pp_funcs->odn_edit_dpm_table (\ (adev)->powerplay.pp_handle, type, parameter, size)) -#define amdgpu_dpm_powergate_mmhub (adev) \ - ((adev)->powerplay.pp_funcs->powergate_mmhub( \ - (adev)->powerplay.pp_handle)) -struct amdgpu_dpm {struct amdgpu_ps *ps;/* number of valid power states */
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +4 -4
@@ -1668,10 +1668,10 @@ static void amdgpu_dpm_change_power_state_locked(struct amdgpu_device *adev)void amdgpu_dpm_enable_uvd (struct amdgpu_device *adev,bool enable) { -if (adev->powerplay.pp_funcs->powergate_uvd) { +if (adev->powerplay.pp_funcs->set_powergating_by_smu) {/* enable/disable UVD */ mutex_lock (&adev->pm.mutex); -amdgpu_dpm_powergate_uvd (adev, !enable); +amdgpu_dpm_set_powergating_by_smu (adev,AMD_IP_BLOCK_TYPE_UVD , !enable);mutex_unlock (&adev->pm.mutex); }else {if (enable) {
@@ -1690,10 +1690,10 @@ void amdgpu_dpm_enable_uvd(struct amdgpu_device *adev, bool enable)void amdgpu_dpm_enable_vce (struct amdgpu_device *adev,bool enable) { -if (adev->powerplay.pp_funcs->powergate_vce) { +if (adev->powerplay.pp_funcs->set_powergating_by_smu) {/* enable/disable VCE */ mutex_lock (&adev->pm.mutex); -amdgpu_dpm_powergate_vce (adev, !enable); +amdgpu_dpm_set_powergating_by_smu (adev,AMD_IP_BLOCK_TYPE_VCE , !enable);mutex_unlock (&adev->pm.mutex); }else {if (enable) {
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +14 -1
@@ -6764,6 +6764,19 @@ static int ci_dpm_read_sensor(void *handle, int idx, } } +static int ci_set_powergating_by_smu (void *handle, +uint32_t block_type,bool gate) +{ +switch (block_type) { +case AMD_IP_BLOCK_TYPE_UVD : +ci_dpm_powergate_uvd (handle, gate); +break ; +default : +break ; + } +return 0 ; +} +static const struct amd_ip_funcs ci_dpm_ip_funcs = { .name ="ci_dpm" , .early_init = ci_dpm_early_init,
@@ -6801,7 +6814,7 @@ static int ci_dpm_read_sensor(void *handle, int idx, .debugfs_print_current_performance_level = &ci_dpm_debugfs_print_current_performance_level, .force_performance_level = &ci_dpm_force_performance_level, .vblank_too_short = &ci_dpm_vblank_too_short, - .powergate_uvd = &ci_dpm_powergate_uvd, + .set_powergating_by_smu = &ci_set_powergating_by_smu, .set_fan_control_mode = &ci_dpm_set_fan_control_mode, .get_fan_control_mode = &ci_dpm_get_fan_control_mode, .set_fan_speed_percent = &ci_dpm_set_fan_speed_percent,
drivers/gpu/drm/amd/amdgpu/kv_dpm.c +14 -1
@@ -3305,6 +3305,19 @@ static int kv_dpm_read_sensor(void *handle, int idx, } } +static int kv_set_powergating_by_smu (void *handle, +uint32_t block_type,bool gate) +{ +switch (block_type) { +case AMD_IP_BLOCK_TYPE_UVD : +kv_dpm_powergate_uvd (handle, gate); +break ; +default : +break ; + } +return 0 ; +} +static const struct amd_ip_funcs kv_dpm_ip_funcs = { .name ="kv_dpm" , .early_init = kv_dpm_early_init,
@@ -3341,7 +3354,7 @@ static int kv_dpm_read_sensor(void *handle, int idx, .print_power_state = &kv_dpm_print_power_state, .debugfs_print_current_performance_level = &kv_dpm_debugfs_print_current_performance_level, .force_performance_level = &kv_dpm_force_performance_level, - .powergate_uvd = &kv_dpm_powergate_uvd, + .set_powergating_by_smu = kv_set_powergating_by_smu, .enable_bapm = &kv_dpm_enable_bapm, .get_vce_clock_state = amdgpu_get_vce_clock_state, .check_state_equal = kv_check_state_equal,
drivers/gpu/drm/amd/include/kgd_pp_interface.h +2 -3
@@ -232,13 +232,13 @@ struct amd_pm_funcs {void (*debugfs_print_current_performance_level)(void *handle,struct seq_file *m);int (*switch_power_profile)(void *handle,enum PP_SMC_POWER_PROFILE type,bool en);/* export to amdgpu */ -void (*powergate_uvd)(void *handle,bool gate); -void (*powergate_vce)(void *handle,bool gate);struct amd_vce_state *(*get_vce_clock_state)(void *handle,u32 idx);int (*dispatch_tasks)(void *handle,enum amd_pp_task task_id,enum amd_pm_state_type *user_state);int (*load_firmware)(void *handle);int (*wait_for_fw_loading_complete)(void *handle); +int (*set_powergating_by_smu)(void *handle, +uint32_t block_type,bool gate);int (*set_clockgating_by_smu)(void *handle,uint32_t msg_id);int (*set_power_limit)(void *handle,uint32_t n);int (*get_power_limit)(void *handle,uint32_t *limit,bool default_limit);
@@ -269,7 +269,6 @@ struct amd_pm_funcs {int (*get_power_profile_mode)(void *handle,char *buf);int (*set_power_profile_mode)(void *handle,long *input,uint32_t size); int (*odn_edit_dpm_table)(void *handle, uint32_t type, long *input, uint32_t size); - int (*powergate_mmhub)(void *handle); };#endif
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +26 -3
@@ -252,6 +252,7 @@ static int pp_set_powergating_state(void *handle,/* Enable/disable GFX per cu powergating through SMU */ return hwmgr->hwmgr_func->powergate_gfx (hwmgr, state ==AMD_PG_STATE_GATE ); + }static int pp_suspend (void *handle)
@@ -1198,14 +1199,36 @@ static int pp_dpm_powergate_mmhub(void *handle)return hwmgr->hwmgr_func->powergate_mmhub (hwmgr); } +static int pp_set_powergating_by_smu (void *handle, +uint32_t block_type,bool gate) +{ +int ret =0 ; + +switch (block_type) { +case AMD_IP_BLOCK_TYPE_UVD : +case AMD_IP_BLOCK_TYPE_VCN : +pp_dpm_powergate_uvd (handle, gate); +break ; +case AMD_IP_BLOCK_TYPE_VCE : +pp_dpm_powergate_vce (handle, gate); +break ; +case AMD_IP_BLOCK_TYPE_GMC : +pp_dpm_powergate_mmhub (handle); +break ; +case AMD_IP_BLOCK_TYPE_GFX : +break ; +default : +break ; + } +return ret; +} +static const struct amd_pm_funcs pp_dpm_funcs = { .load_firmware = pp_dpm_load_fw, .wait_for_fw_loading_complete = pp_dpm_fw_loading_complete, .force_performance_level = pp_dpm_force_performance_level, .get_performance_level = pp_dpm_get_performance_level, .get_current_power_state = pp_dpm_get_current_power_state, - .powergate_vce = pp_dpm_powergate_vce, - .powergate_uvd = pp_dpm_powergate_uvd, .dispatch_tasks = pp_dpm_dispatch_tasks, .set_fan_control_mode = pp_dpm_set_fan_control_mode, .get_fan_control_mode = pp_dpm_get_fan_control_mode,
@@ -1225,6 +1248,7 @@ static int pp_dpm_powergate_mmhub(void *handle) .get_vce_clock_state = pp_dpm_get_vce_clock_state, .switch_power_profile = pp_dpm_switch_power_profile, .set_clockgating_by_smu = pp_set_clockgating_by_smu, + .set_powergating_by_smu = pp_set_powergating_by_smu, .get_power_profile_mode = pp_get_power_profile_mode, .set_power_profile_mode = pp_set_power_profile_mode, .odn_edit_dpm_table = pp_odn_edit_dpm_table,
@@ -1242,5 +1266,4 @@ static int pp_dpm_powergate_mmhub(void *handle) .set_watermarks_for_clocks_ranges = pp_set_watermarks_for_clocks_ranges, .display_clock_voltage_request = pp_display_clock_voltage_request, .get_display_mode_validation_clocks = pp_get_display_mode_validation_clocks, - .powergate_mmhub = pp_dpm_powergate_mmhub, };
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/5 drm/amd/pp: Add gfx pg support in smu through set_powergating_by_smu
In reply to a message not in the archivegfx ip block can call set_powergating_by_smu to set gfx pg state if necessary.
--- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 10 ++++------ drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c | 4 ++-- drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 17 +++++++++++++++++ 3 files changed, 23 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +4 -6
@@ -5552,14 +5552,12 @@ static int gfx_v8_0_late_init(void *handle)static void gfx_v8_0_enable_gfx_static_mg_power_gating (struct amdgpu_device *adev,bool enable) { -if ((adev->asic_type ==CHIP_POLARIS11 ) || +if (((adev->asic_type ==CHIP_POLARIS11 ) || (adev->asic_type ==CHIP_POLARIS12 ) || - (adev->asic_type ==CHIP_VEGAM )) + (adev->asic_type ==CHIP_VEGAM )) && + adev->powerplay.pp_funcs->set_powergating_by_smu)/* Send msg to SMU via Powerplay */ -amdgpu_device_ip_set_powergating_state (adev, -AMD_IP_BLOCK_TYPE_SMC , - enable ? -AMD_PG_STATE_GATE :AMD_PG_STATE_UNGATE ); +amdgpu_dpm_set_powergating_by_smu (adev,AMD_IP_BLOCK_TYPE_GFX , enable);WREG32_FIELD (RLC_PG_CNTL ,STATIC_PER_CU_PG_ENABLE , enable ?1 :0 ); }
drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +2 -2
@@ -471,8 +471,8 @@ void mmhub_v1_0_update_power_gating(struct amdgpu_device *adev, RENG_EXECUTE_ON_REG_UPDATE, 1);WREG32_SOC15 (MMHUB ,0 , mmPCTL1_RENG_EXECUTE, pctl1_reng_execute); -if (adev->powerplay.pp_funcs->powergate_mmhub) -amdgpu_dpm_powergate_mmhub (adev); +if (adev->powerplay.pp_funcs->set_powergating_by_smu) +amdgpu_dpm_set_powergating_by_smu (adev,AMD_IP_BLOCK_TYPE_GMC ,0 ); }else { pctl0_reng_execute = REG_SET_FIELD(pctl0_reng_execute,
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +17 -0
@@ -1199,6 +1199,22 @@ static int pp_dpm_powergate_mmhub(void *handle)return hwmgr->hwmgr_func->powergate_mmhub (hwmgr); } +static int pp_dpm_powergate_gfx (void *handle,bool gate) +{ +struct amdgpu_device *adev = handle; +struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle; + +if (!hwmgr || !hwmgr->pm_en) +return 0 ; + +if (hwmgr->hwmgr_func->powergate_gfx ==NULL ) { +pr_info ("%s was not implemented.\n" , __func__); +return 0 ; + } + +return hwmgr->hwmgr_func->powergate_gfx (hwmgr, gate); +} +static int pp_set_powergating_by_smu (void *handle,uint32_t block_type,bool gate) {
@@ -1216,6 +1232,7 @@ static int pp_set_powergating_by_smu(void *handle,pp_dpm_powergate_mmhub (handle);break ;case AMD_IP_BLOCK_TYPE_GFX : + ret =pp_dpm_powergate_gfx (handle, gate);break ;default :break ;
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1528176139-26350-4-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org
RE: [PATCH 4/5] drm/amd/pp: Add gfx pg support in smu through set_powergating_by_smu
Comment inline
Quoted 63 lines
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Rex Zhu
Sent: Tuesday, June 05, 2018 1:22 PM
To: [email protected]
Cc: Zhu, Rex <[email protected]>
Subject: [PATCH 4/5] drm/amd/pp: Add gfx pg support in smu throughset_powergating_by_smugfx ip block can call
set_powergating_by_smuto set gfx pg state if necessary.Signed-off-by Rex Zhu <[email protected]>--- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 10 ++++------ drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c | 4 ++-- drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 17 +++++++++++++++++ 3 files changed, 23 insertions(+), 8 deletions(-)drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0
-0@@ -5552,14 +5552,12 @@ static int gfx_v8_0_late_init(void *handle) staticvoid gfx_v8_0_enable_gfx_static_mg_power_gating(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +3
-4bool enable) { -if ((adev->asic_type ==CHIP_POLARIS11 ) || +if (((adev->asic_type ==CHIP_POLARIS11 ) || (adev->asic_type ==CHIP_POLARIS12 ) || - (adev->asic_type ==CHIP_VEGAM )) + (adev->asic_type ==CHIP_VEGAM )) && + adev->powerplay.pp_funcs->set_powergating_by_smu)/* Send msg to SMU via Powerplay */ - amdgpu_device_ip_set_powergating_state(adev, -
AMD_IP_BLOCK_TYPE_SMC,drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0
-2- enable ? - AMD_PG_STATE_GATE :
AMD_PG_STATE_UNGATE);drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1
-0+ amdgpu_dpm_set_powergating_by_smu(adev,
AMD_IP_BLOCK_TYPE_GFX,drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1
-0+enable); WREG32_FIELD(RLC_PG_CNTL, STATIC_PER_CU_PG_ENABLE,enable ? 1 : 0); } diff --git
a/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.cb/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c
index 377f536..85cf2f9 100644drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +2
-2@@ -471,8 +471,8 @@ void mmhub_v1_0_update_power_gating(struct amdgpu_device *adev, RENG_EXECUTE_ON_REG_UPDATE, 1);WREG32_SOC15 (MMHUB ,0 , mmPCTL1_RENG_EXECUTE, pctl1_reng_execute); -if (adev->powerplay.pp_funcs->powergate_mmhub) -amdgpu_dpm_powergate_mmhub (adev); +if (adev->powerplay.pp_funcs->set_powergating_by_smu) + amdgpu_dpm_set_powergating_by_smu(adev,
Quoted 1 line
AMD_IP_BLOCK_TYPE_GMC, 0);
[Evan] The third argument represents for "gate". So, it seems '1' is more suitable(although for mmhub it seems have no real effect).
Quoted 42 lines
drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +0
-0}else { pctl0_reng_execute = REG_SET_FIELD(pctl0_reng_execute,drivers/gpu/drm/amd/powerplay/amd_powerplay.c +15
-0@@ -1199,6 +1199,22 @@ static int pp_dpm_powergate_mmhub(void *handle)return hwmgr->hwmgr_func->powergate_mmhub (hwmgr); } +static int pp_dpm_powergate_gfx (void *handle,bool gate) { +struct amdgpu_device *adev = handle; +struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle; + +if (!hwmgr || !hwmgr->pm_en) +return 0 ; + +if (hwmgr->hwmgr_func->powergate_gfx ==NULL ) { +pr_info ("%s was not implemented.\n" , __func__); +return 0 ; + } + +return hwmgr->hwmgr_func->powergate_gfx (hwmgr, gate); } +static int pp_set_powergating_by_smu (void *handle,uint32_t block_type,bool gate) {@@ -1216,6 +1232,7 @@ static int pp_set_powergating_by_smu(void *handle,pp_dpm_powergate_mmhub (handle);break ;case AMD_IP_BLOCK_TYPE_GFX : + ret =pp_dpm_powergate_gfx (handle, gate);break ;default :break;
--
1.9.1
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/5 drm/amd/pp: Remove the gfx pg/off ctrl code out of pp_set_powergating_state
In reply to a message not in the archiveThis is a ip function for set smu pg state.
Although the cg/pg were still not supported on legacy asics, we should not add other ip block's pg code in it.
--- drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-)
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +1 -24
@@ -229,30 +229,7 @@ static int pp_sw_reset(void *handle)static int pp_set_powergating_state (void *handle,enum amd_powergating_state state) { -struct amdgpu_device *adev = handle; -struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle; -int ret; - -if (!hwmgr || !hwmgr->pm_en) -return 0 ; - -if (hwmgr->hwmgr_func->gfx_off_control) { -/* Enable/disable GFX off through SMU */ - ret = hwmgr->hwmgr_func->gfx_off_control (hwmgr, - state ==AMD_PG_STATE_GATE ); -if (ret) -pr_err ("gfx off control failed!\n" ); - } - -if (hwmgr->hwmgr_func->powergate_gfx ==NULL ) { -pr_info ("%s was not implemented.\n" , __func__); -return 0 ; - } - -/* Enable/disable GFX per cu powergating through SMU */ -return hwmgr->hwmgr_func->powergate_gfx (hwmgr, - state ==AMD_PG_STATE_GATE ); - +return 0 ; }static int pp_suspend (void *handle)
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1528176139-26350-5-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org
RE: [PATCH 5/5] drm/amd/pp: Remove the gfx pg/off ctrl code out of pp_set_powergating_state
Patch #1 ~ 4 are Reviewed-by: Hawking Zhang <[email protected]>
Patch #5
The patch will break recent gfxoff fix from Ray where he leveraged pp_set_powergating_state to enable gfxoff. If we didn't control gfxoff in smc power gating function, we have to add a new gfx function which then call into amdgpu_pp interface to do such thing.
Regards,
Hawking
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Rex Zhu
Sent: 2018年6月5日 13:22
To: [email protected]
Cc: Zhu, Rex <[email protected]>
Subject: [PATCH 5/5] drm/amd/pp: Remove the gfx pg/off ctrl code out of pp_set_powergating_state
This is a ip function for set smu pg state.
Although the cg/pg were still not supported on legacy asics, we should not add other ip block's pg code in it.
--- drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-)
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +1 -25
@@ -229,30 +229,7 @@ static int pp_sw_reset(void *handle) static int pp_set_powergating_state(void *handle, enum amd_powergating_state state) { -struct amdgpu_device *adev = handle; -struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle; -int ret; - -if (!hwmgr || !hwmgr->pm_en) -return 0 ; - -if (hwmgr->hwmgr_func->gfx_off_control) { -/* Enable/disable GFX off through SMU */ - ret = hwmgr->hwmgr_func->gfx_off_control (hwmgr, - state ==AMD_PG_STATE_GATE ); -if (ret) -pr_err ("gfx off control failed!\n" ); - } - -if (hwmgr->hwmgr_func->powergate_gfx ==NULL ) { -pr_info ("%s was not implemented.\n" , __func__); -return 0 ; - } - -/* Enable/disable GFX per cu powergating through SMU */ -return hwmgr->hwmgr_func->powergate_gfx (hwmgr, - state ==AMD_PG_STATE_GATE ); - +return 0 ; }static int pp_suspend (void *handle) --
1.9.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx