drm/amd/pm: unify the interface for power gating
Subsystems (3)
PATCH 1/2 drm/amd/pm: unify the interface for power gating
No need to have special handling for swSMU supported ASICs.
--- drivers/gpu/drm/amd/pm/amdgpu_dpm.c | 9 --------- drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h | 3 --- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 6 +++--- 3 files changed, 3 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_dpm.c +0 -9
@@ -927,7 +927,6 @@ int amdgpu_dpm_set_powergating_by_smu(struct amdgpu_device *adev, uint32_t block {int ret =0 ;const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs; -bool swsmu =is_support_sw_smu (adev);switch (block_type) {case AMD_IP_BLOCK_TYPE_UVD :
@@ -968,15 +967,7 @@ int amdgpu_dpm_set_powergating_by_smu(struct amdgpu_device *adev, uint32_t blockcase AMD_IP_BLOCK_TYPE_GFX :case AMD_IP_BLOCK_TYPE_VCN :case AMD_IP_BLOCK_TYPE_SDMA : -if (pp_funcs && pp_funcs->set_powergating_by_smu) { - ret = (pp_funcs->set_powergating_by_smu ( - (adev)->powerplay.pp_handle, block_type, gate)); - } -break ;case AMD_IP_BLOCK_TYPE_JPEG : -if (swsmu) - ret =smu_dpm_set_power_gate (&adev->smu, block_type, gate); -break ;case AMD_IP_BLOCK_TYPE_GMC :case AMD_IP_BLOCK_TYPE_ACP :if (pp_funcs && pp_funcs->set_powergating_by_smu) {
drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h +0 -3
@@ -1305,9 +1305,6 @@ bool is_support_sw_smu(struct amdgpu_device *adev);bool is_support_cclk_dpm (struct amdgpu_device *adev);int smu_write_watermarks_table (struct smu_context *smu); -/* smu to display interface */ -extern int smu_dpm_set_power_gate (void *handle,uint32_t block_type,bool gate); -int smu_get_dpm_freq_range (struct smu_context *smu,enum smu_clk_type clk_type,uint32_t *min,uint32_t *max);
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +3 -3
@@ -268,9 +268,9 @@ static int smu_dpm_set_jpeg_enable(struct smu_context *smu,* Under this case, the smu->mutex lock protection is already enforced on * the parent API smu_force_performance_level of the call path. */ -int smu_dpm_set_power_gate (void *handle, -uint32_t block_type, -bool gate) +static int smu_dpm_set_power_gate (void *handle, +uint32_t block_type, +bool gate) {struct smu_context *smu = handle;int ret =0 ;
Signature · 6 lines
2.29.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/2 drm/amd/pm: unify the interface for gfx state setting
No need to have special handling for swSMU supported ASICs.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 16 ++++++---------- drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h | 2 -- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 5 ++++- 3 files changed, 10 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +6 -10
@@ -842,14 +842,10 @@ int amdgpu_gfx_get_num_kcq(struct amdgpu_device *adev)void amdgpu_gfx_state_change_set (struct amdgpu_device *adev,enum gfx_change_state state) { -if (is_support_sw_smu (adev)) { -smu_gfx_state_change_set (&adev->smu, state); - }else { -mutex_lock (&adev->pm.mutex); -if (adev->powerplay.pp_funcs && - adev->powerplay.pp_funcs->gfx_state_change_set) - ((adev)->powerplay.pp_funcs->gfx_state_change_set ( - (adev)->powerplay.pp_handle, state)); -mutex_unlock (&adev->pm.mutex); - } +mutex_lock (&adev->pm.mutex); +if (adev->powerplay.pp_funcs && + adev->powerplay.pp_funcs->gfx_state_change_set) + ((adev)->powerplay.pp_funcs->gfx_state_change_set ( + (adev)->powerplay.pp_handle, state)); +mutex_unlock (&adev->pm.mutex); }
drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h +0 -2
@@ -1317,8 +1317,6 @@ int smu_allow_xgmi_power_down(struct smu_context *smu, bool en);int smu_get_status_gfxoff (struct amdgpu_device *adev,uint32_t *value); -int smu_gfx_state_change_set (struct smu_context *smu,uint32_t state); -int smu_set_light_sbr (struct smu_context *smu,bool enable); int smu_wait_for_event(struct amdgpu_device *adev, enum smu_event_type event,
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +4 -1
@@ -2920,8 +2920,10 @@ static int smu_enable_mgpu_fan_boost(void *handle)return ret; } -int smu_gfx_state_change_set (struct smu_context *smu,uint32_t state) +static int smu_gfx_state_change_set (void *handle, +uint32_t state) { +struct smu_context *smu = handle;int ret =0 ;mutex_lock (&smu->mutex);
@@ -2994,6 +2996,7 @@ static const struct amd_pm_funcs swsmu_pm_funcs = { .display_disable_memory_clock_switch = smu_display_disable_memory_clock_switch, .get_max_sustainable_clocks_by_dc = smu_get_max_sustainable_clocks_by_dc, .load_firmware = smu_load_microcode, + .gfx_state_change_set = smu_gfx_state_change_set, }; int smu_wait_for_event(struct amdgpu_device *adev, enum smu_event_type event,
Signature · 6 lines
2.29.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
RE: [PATCH 2/2] drm/amd/pm: unify the interface for gfx state setting
[AMD Public Use]
Series is
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Evan Quan
Sent: Thursday, March 25, 2021 4:12 PM
To: [email protected]
Cc: Quan, Evan <[email protected]>
Subject: [PATCH 2/2] drm/amd/pm: unify the interface for gfx state setting
No need to have special handling for swSMU supported ASICs.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 16 ++++++---------- drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h | 2 -- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 5 ++++- 3 files changed, 10 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +6 -10
@@ -842,14 +842,10 @@ int amdgpu_gfx_get_num_kcq(struct amdgpu_device *adev)void amdgpu_gfx_state_change_set (struct amdgpu_device *adev,enum gfx_change_state state) { -if (is_support_sw_smu (adev)) { -smu_gfx_state_change_set (&adev->smu, state); - }else { -mutex_lock (&adev->pm.mutex); -if (adev->powerplay.pp_funcs && - adev->powerplay.pp_funcs->gfx_state_change_set) - ((adev)->powerplay.pp_funcs->gfx_state_change_set ( - (adev)->powerplay.pp_handle, state)); -mutex_unlock (&adev->pm.mutex); - } +mutex_lock (&adev->pm.mutex); +if (adev->powerplay.pp_funcs && + adev->powerplay.pp_funcs->gfx_state_change_set) + ((adev)->powerplay.pp_funcs->gfx_state_change_set ( + (adev)->powerplay.pp_handle, state)); +mutex_unlock (&adev->pm.mutex); }
drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h +0 -2
@@ -1317,8 +1317,6 @@ int smu_allow_xgmi_power_down(struct smu_context *smu, bool en);int smu_get_status_gfxoff (struct amdgpu_device *adev,uint32_t *value); -int smu_gfx_state_change_set (struct smu_context *smu,uint32_t state); -int smu_set_light_sbr (struct smu_context *smu,bool enable); int smu_wait_for_event(struct amdgpu_device *adev, enum smu_event_type event, diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index 0d1372d440ed..b2898f93a3ff 100644
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +4 -1
@@ -2920,8 +2920,10 @@ static int smu_enable_mgpu_fan_boost(void *handle)return ret; } -int smu_gfx_state_change_set (struct smu_context *smu,uint32_t state) +static int smu_gfx_state_change_set (void *handle, +uint32_t state) { +struct smu_context *smu = handle;int ret =0 ;mutex_lock (&smu->mutex);
@@ -2994,6 +2996,7 @@ static const struct amd_pm_funcs swsmu_pm_funcs = { .display_disable_memory_clock_switch = smu_display_disable_memory_clock_switch, .get_max_sustainable_clocks_by_dc = smu_get_max_sustainable_clocks_by_dc, .load_firmware = smu_load_microcode, + .gfx_state_change_set = smu_gfx_state_change_set, }; int smu_wait_for_event(struct amdgpu_device *adev, enum smu_event_type event,
--
2.29.0
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Clijo.lazar%40amd.com%7Cead6b76a1b794a3e28a308d8ef7abebc%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637522657764444120%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=8k39%2B4CHfE4hYaGq1rci1Df6ATY%2B4mFWWy28h9fv8Sc%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx