drm/amd/powerplay: properly set mp1 state for SW SMU suspend/reset routine
Subsystems (2)
PATCH 1/2 drm/amd/powerplay: properly set mp1 state for SW SMU suspend/reset routine
Set mp1 state properly for SW SMU suspend/reset routine.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 10 ++--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 40 +++++++++++++++++++ .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 2 + 3 files changed, 47 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -5
@@ -2217,16 +2217,16 @@ static int amdgpu_device_ip_suspend_phase2(struct amdgpu_device *adev)/* handle putting the SMC in the appropriate state */ if (adev->ip_blocks[i].version->type ==AMD_IP_BLOCK_TYPE_SMC ) {if (is_support_sw_smu (adev)) { -/* todo */ + r =smu_set_mp1_state (&adev->smu, adev->mp1_state); }else if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs->set_mp1_state) { r = adev->powerplay.pp_funcs->set_mp1_state ( adev->powerplay.pp_handle, adev->mp1_state); -if (r) { -DRM_ERROR ("SMC failed to set mp1 state %d, %d\n" , - adev->mp1_state, r); - } + } +if (r) { +DRM_ERROR ("SMC failed to set mp1 state %d, %d\n" , + adev->mp1_state, r); } }
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +40 -0
@@ -1796,6 +1796,46 @@ int smu_force_clk_levels(struct smu_context *smu,return ret; } +int smu_set_mp1_state (struct smu_context *smu, +enum pp_mp1_state mp1_state) +{ +uint16_t msg; +int ret; + +/* +* The SMC is not fully ready. That may be +* expected as the IP may be masked. +* So, just return without error. +*/ +if (!smu->pm_enabled) +return 0 ; + +switch (mp1_state) { +case PP_MP1_STATE_SHUTDOWN : + msg = SMU_MSG_PrepareMp1ForShutdown; +break ; +case PP_MP1_STATE_UNLOAD : + msg = SMU_MSG_PrepareMp1ForUnload; +break ; +case PP_MP1_STATE_RESET : + msg = SMU_MSG_PrepareMp1ForReset; +break ; +case PP_MP1_STATE_NONE : +default : +return 0 ; + } + +/* some asics may not support those messages */ +if (smu_msg_get_index (smu, msg) <0 ) +return 0 ; + + ret =smu_send_smc_msg (smu, msg); +if (ret) +pr_err ("[PrepareMp1] Failed!\n" ); + +return ret; +} +const struct amd_ip_funcs smu_ip_funcs = { .name ="smu" , .early_init = smu_early_init,
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +2 -0
@@ -903,5 +903,7 @@ int smu_sys_set_pp_feature_mask(struct smu_context *smu, uint64_t new_mask);int smu_force_clk_levels (struct smu_context *smu,enum smu_clk_type clk_type,uint32_t mask); +int smu_set_mp1_state (struct smu_context *smu, +enum pp_mp1_state mp1_state);#endif
Signature · 6 lines
2.23.0 _______________________________________________ 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): [email protected]
PATCH 2/2 drm/amd/powerplay: check SMU engine readiness before proceeding on S3 resume
This is especially needed for non-psp loading way.
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 28 ++++++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +23 -5
@@ -1213,11 +1213,10 @@ static int smu_free_memory_pool(struct smu_context *smu)return ret; } -static int smu_hw_init (void *handle) +static int smu_start_smc_engine (struct smu_context *smu) { -int ret; -struct amdgpu_device *adev = (struct amdgpu_device *)handle; -struct smu_context *smu = &adev->smu; +struct amdgpu_device *adev = smu->adev; +int ret =0 ;if (adev->firmware.load_type !=AMDGPU_FW_LOAD_PSP ) {if (adev->asic_type <CHIP_NAVI10 ) {
@@ -1228,8 +1227,21 @@ static int smu_hw_init(void *handle) } ret =smu_check_fw_status (smu); +if (ret) +pr_err ("SMC is not ready\n" ); + +return ret; +} + +static int smu_hw_init (void *handle) +{ +int ret; +struct amdgpu_device *adev = (struct amdgpu_device *)handle; +struct smu_context *smu = &adev->smu; + + ret =smu_start_smc_engine (smu);if (ret) { -pr_err ("SMC firmware status is not correct\n" ); +pr_err ("SMU is not ready yet!\n" );return ret; }
@@ -1389,6 +1401,12 @@ static int smu_resume(void *handle)mutex_lock (&smu->mutex); + ret =smu_start_smc_engine (smu); +if (ret) { +pr_err ("SMU is not ready yet!\n" ); +return ret; + } + ret =smu_smc_table_hw_init (smu, false);if (ret) goto failed;
Signature · 6 lines
2.23.0 _______________________________________________ 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): [email protected]
Alex Deucher
Reviewed-byRe: [PATCH 2/2] drm/amd/powerplay: check SMU engine readiness before proceeding on S3 resume
Series is:
Quoted 67 lines · Evan
This is especially needed for non-psp loading way.
Change-Id I1e523168ed4892c34c8cbb66077c3f9288dd8006Signed-off-by Evan Quan <[email protected]>--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 28 ++++++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +23
-6@@ -1213,11 +1213,10 @@ static int smu_free_memory_pool(struct smu_context *smu)return ret; } -static int smu_hw_init (void *handle) +static int smu_start_smc_engine (struct smu_context *smu) { -int ret; -struct amdgpu_device *adev = (struct amdgpu_device *)handle; -struct smu_context *smu = &adev->smu; +struct amdgpu_device *adev = smu->adev; +int ret =0 ;if (adev->firmware.load_type !=AMDGPU_FW_LOAD_PSP ) {if (adev->asic_type <CHIP_NAVI10 ) {@@ -1228,8 +1227,21 @@ static int smu_hw_init(void *handle) } ret =smu_check_fw_status (smu); +if (ret) +pr_err ("SMC is not ready\n" ); + +return ret; +} + +static int smu_hw_init (void *handle) +{ +int ret; +struct amdgpu_device *adev = (struct amdgpu_device *)handle; +struct smu_context *smu = &adev->smu; + + ret =smu_start_smc_engine (smu);if (ret) { -pr_err ("SMC firmware status is not correct\n" ); +pr_err ("SMU is not ready yet!\n" );return ret; }@@ -1389,6 +1401,12 @@ static int smu_resume(void *handle)mutex_lock (&smu->mutex); + ret =smu_start_smc_engine (smu); +if (ret) { +pr_err ("SMU is not ready yet!\n" ); +return ret; + } + ret =smu_smc_table_hw_init (smu, false);if (ret) goto failed; --2.23.0
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