drm/amdgpu: add flag for runtime suspend
Subsystems (2)
PATCH 1/3 drm/amdgpu: add flag for runtime suspend
So we know whether we in are in runtime suspend or system suspend.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 ++ 2 files changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -976,6 +976,7 @@ struct amdgpu_device {int pstate;/* enable runtime pm on the device */ bool runpm; +bool in_runpm;bool pm_sysfs_en;bool ucode_sysfs_en;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -0
@@ -1230,6 +1230,7 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev) } } + adev->in_runpm = true;if (amdgpu_device_supports_boco (drm_dev)) drm_dev->switch_power_state =DRM_SWITCH_POWER_CHANGING ;drm_kms_helper_poll_disable (drm_dev);
@@ -1288,6 +1289,7 @@ static int amdgpu_pmops_runtime_resume(struct device *dev)drm_kms_helper_poll_enable (drm_dev);if (amdgpu_device_supports_boco (drm_dev)) drm_dev->switch_power_state =DRM_SWITCH_POWER_ON ; + adev->in_runpm = false;return 0 ; }
Signature · 6 lines
2.24.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/3 drm/amdgpu/smu: properly handle runpm/suspend/reset
We need some special handling when using baco vs. other things.
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 35 ++++++++++++---------- 1 file changed, 19 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +19 -16
@@ -1454,11 +1454,15 @@ int smu_reset(struct smu_context *smu)return ret; } -static int smu_disabled_dpms (struct smu_context *smu) +static int smu_disable_dpm (struct smu_context *smu) {struct amdgpu_device *adev = smu->adev;uint32_t smu_version;int ret =0 ; +bool use_baco = !smu->is_apu && + ((adev->in_gpu_reset && + (amdgpu_asic_reset_method (adev) ==AMD_RESET_METHOD_BACO )) || + (adev->in_runpm &&amdgpu_asic_supports_baco (adev))); ret =smu_get_smc_version (smu,NULL , &smu_version);if (ret) {
@@ -1467,13 +1471,13 @@ static int smu_disabled_dpms(struct smu_context *smu) }/* -* For baco reset on Arcturus, this operation +* For baco on Arcturus, this operation * (disable all smu feature) will be handled by SMU FW. */ -if (adev->in_gpu_reset && - (amdgpu_asic_reset_method (adev) ==AMD_RESET_METHOD_BACO ) && - (adev->asic_type ==CHIP_ARCTURUS && smu_version >0x360e00 )) -return 0 ; +if (adev->asic_type ==CHIP_ARCTURUS ) { +if (use_baco && (smu_version >0x360e00 )) +return 0 ; + }/* Disable all enabled SMU features */ ret =smu_system_features_control (smu, false);
@@ -1482,15 +1486,14 @@ static int smu_disabled_dpms(struct smu_context *smu)return ret; } -/* For baco reset, need to leave BACO feature enabled */ -if (adev->in_gpu_reset && - (amdgpu_asic_reset_method (adev) ==AMD_RESET_METHOD_BACO ) && - !smu->is_apu && -smu_feature_is_enabled (smu,SMU_FEATURE_BACO_BIT )) { - ret =smu_feature_set_enabled (smu,SMU_FEATURE_BACO_BIT , true); -if (ret) { -pr_warn ("set BACO feature enabled failed, return %d\n" , ret); -return ret; +/* For baco, need to leave BACO feature enabled */ +if (use_baco) { +if (smu_feature_is_enabled (smu,SMU_FEATURE_BACO_BIT )) { + ret =smu_feature_set_enabled (smu,SMU_FEATURE_BACO_BIT , true); +if (ret) { +pr_warn ("set BACO feature enabled failed, return %d\n" , ret); +return ret; + } } }
@@ -1510,7 +1513,7 @@ static int smu_suspend(void *handle)return 0 ;if (!amdgpu_sriov_vf (adev)) { - ret =smu_disabled_dpms (smu); + ret =smu_disable_dpm (smu);if (ret)return ret; }
Signature · 6 lines
2.24.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/3 drm/amdgpu/powerplay: fix baco check for vega20
In reply to Alex DeucherWe need to handle the runpm case as well as GPU reset.
--- drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +4 -3
@@ -487,15 +487,16 @@ static int vega20_setup_asic_task(struct pp_hwmgr *hwmgr) {struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr->adev);int ret =0 ; +bool use_baco = (adev->in_gpu_reset && + (amdgpu_asic_reset_method (adev) ==AMD_RESET_METHOD_BACO )) || + (adev->in_runpm &&amdgpu_asic_supports_baco (adev)); ret =vega20_init_sclk_threshold (hwmgr);PP_ASSERT_WITH_CODE (!ret,"Failed to init sclk threshold!" , return ret); -if (adev->in_gpu_reset && - (amdgpu_asic_reset_method (adev) ==AMD_RESET_METHOD_BACO )) { - +if (use_baco) { ret =vega20_baco_apply_vdci_flush_workaround (hwmgr);if (ret)pr_err ("Failed to apply vega20 baco workaround!\n" );
Signature · 6 lines
2.24.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
RE: [PATCH 3/3] drm/amdgpu/powerplay: fix baco check for vega20
Thanks for the fixes. The series is reviewed-by: Evan Quan <[email protected]>
Quoted 46 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Friday, February 7, 2020 11:19 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH 3/3] drm/amdgpu/powerplay: fix baco check for vega20We need to handle the runpm case as well as GPU reset.
Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +2
-0@@ -487,15 +487,16 @@ static int vega20_setup_asic_task(struct pp_hwmgr *hwmgr) {struct amdgpu_device *adev = (struct amdgpu_device *)(hwmgr- >adev);int ret =0 ; + bool use_baco = (adev->in_gpu_reset && + (amdgpu_asic_reset_method(adev) ==
AMD_RESET_METHOD_BACO)) ||drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-2+ (adev->in_runpm &&amdgpu_asic_supports_baco (adev)); ret =vega20_init_sclk_threshold (hwmgr);PP_ASSERT_WITH_CODE (!ret,"Failed to init sclk threshold!" , return ret); - if (adev->in_gpu_reset && - (amdgpu_asic_reset_method(adev) ==
AMD_RESET_METHOD_BACO)) {drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +1
-2- +if (use_baco) { ret =vega20_baco_apply_vdci_flush_workaround (hwmgr);if (ret)pr_err ("Failed to apply vega20 baco workaround!\n" ); --2.24.1
Quoted 9 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.
freedesktop.org%2Fmailman%2Flistinfo%2Famd- gfx&data=02%7C01%7Cevan.quan%40amd.com%7C781e5f8feb044301f 50408d7abe11d18%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C6 37166855729019493&sdata=L8aUO%2F8ut25Yf7zVSfMDE207bcyYnYi2hd 7ANXL6vEk%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx