drm/amdgpu: fix the Carrizo UVD hang on system reboot
Subsystems (2)
PATCH 1/1 drm/amdgpu: fix the Carrizo UVD hang on system reboot
It's confirmed that on some APUs the interaction with SMU about DPM disablement will power off the UVD completely. Thus the succeeding interactions with UVD during the reboot will trigger hard hang. To workaround this issue, we will skip the dpm disablement on APUs.
--- drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c | 20 ++++++++++-------- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 30 +++++++++++++++++++-------- drivers/gpu/drm/amd/amdgpu/vce_v2_0.c | 18 +++++++++------- drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 18 +++++++++------- 4 files changed, 52 insertions(+), 34 deletions(-)
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +11 -9
@@ -238,15 +238,17 @@ static int uvd_v4_2_suspend(void *handle)*/ cancel_delayed_work_sync (&adev->uvd.idle_work); -if (adev->pm.dpm_enabled) { -amdgpu_dpm_enable_uvd (adev, false); - }else { -amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); -/* shutdown the UVD block */ -amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_UVD , -AMD_PG_STATE_GATE ); -amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_UVD , -AMD_CG_STATE_GATE ); +if (!(adev->flags &AMD_IS_APU )) { +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_uvd (adev, false); + }else { +amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); +/* shutdown the UVD block */ +amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_UVD , +AMD_PG_STATE_GATE ); +amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_UVD , +AMD_CG_STATE_GATE ); + } } r =uvd_v4_2_hw_fini (adev);
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +21 -9
@@ -560,15 +560,27 @@ static int uvd_v6_0_suspend(void *handle)*/ cancel_delayed_work_sync (&adev->uvd.idle_work); -if (adev->pm.dpm_enabled) { -amdgpu_dpm_enable_uvd (adev, false); - }else { -amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); -/* shutdown the UVD block */ -amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_UVD , -AMD_PG_STATE_GATE ); -amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_UVD , -AMD_CG_STATE_GATE ); +/* +* It's confirmed that on some APUs the interaction with SMU(about DPM disablement) +* will power off the UVD. That will make the succeeding interactions with UVD on the +* suspend path impossible. And the system will hang due to that. To workaround the +* issue, we will skip the dpm disablement on APUs. +* +* TODO: a better solution is to reorg the action chains performed on suspend and make +* the dpm disablement the last one. But that will involve a lot and needs MM team's +* help. +*/ +if (!(adev->flags &AMD_IS_APU )) { +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_uvd (adev, false); + }else { +amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); +/* shutdown the UVD block */ +amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_UVD , +AMD_PG_STATE_GATE ); +amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_UVD , +AMD_CG_STATE_GATE ); + } } r =uvd_v6_0_hw_fini (adev);
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +10 -8
@@ -505,14 +505,16 @@ static int vce_v2_0_suspend(void *handle)*/ cancel_delayed_work_sync (&adev->vce.idle_work); -if (adev->pm.dpm_enabled) { -amdgpu_dpm_enable_vce (adev, false); - }else { -amdgpu_asic_set_vce_clocks (adev,0 ,0 ); -amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_VCE , -AMD_PG_STATE_GATE ); -amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_VCE , -AMD_CG_STATE_GATE ); +if (!(adev->flags &AMD_IS_APU )) { +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_vce (adev, false); + }else { +amdgpu_asic_set_vce_clocks (adev,0 ,0 ); +amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_VCE , +AMD_PG_STATE_GATE ); +amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_VCE , +AMD_CG_STATE_GATE ); + } } r =vce_v2_0_hw_fini (adev);
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +10 -8
@@ -520,14 +520,16 @@ static int vce_v3_0_suspend(void *handle)*/ cancel_delayed_work_sync (&adev->vce.idle_work); -if (adev->pm.dpm_enabled) { -amdgpu_dpm_enable_vce (adev, false); - }else { -amdgpu_asic_set_vce_clocks (adev,0 ,0 ); -amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_VCE , -AMD_PG_STATE_GATE ); -amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_VCE , -AMD_CG_STATE_GATE ); +if (!(adev->flags &AMD_IS_APU )) { +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_vce (adev, false); + }else { +amdgpu_asic_set_vce_clocks (adev,0 ,0 ); +amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_VCE , +AMD_PG_STATE_GATE ); +amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_VCE , +AMD_CG_STATE_GATE ); + } } r =vce_v3_0_hw_fini (adev);
Signature · 1 line
2.29.0
Am 04.11.21 um 09:19 schrieb Evan Quan:
Quoted 7 lines
It's confirmed that on some APUs the interaction with SMU about DPM disablement will power off the UVD completely. Thus the succeeding interactions with UVD during the reboot will trigger hard hang. To workaround this issue, we will skip the dpm disablement on APUs.
Signed-off-by Evan Quan <[email protected]>Change-Id I4340cc2fb0fd94f439cbac5d4963fe920866bc13
But Leo should take a look as well, adding him on CC.
Christian.
Quoted 137 lines
--- drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c | 20 ++++++++++-------- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 30 +++++++++++++++++++-------- drivers/gpu/drm/amd/amdgpu/vce_v2_0.c | 18 +++++++++------- drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 18 +++++++++------- 4 files changed, 52 insertions(+), 34 deletions(-)drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +11
-9@@ -238,15 +238,17 @@ static int uvd_v4_2_suspend(void *handle)*/ cancel_delayed_work_sync (&adev->uvd.idle_work); -if (adev->pm.dpm_enabled) { -amdgpu_dpm_enable_uvd (adev, false); - }else { -amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); -/* shutdown the UVD block */ -amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_UVD , -AMD_PG_STATE_GATE ); -amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_UVD , -AMD_CG_STATE_GATE ); +if (!(adev->flags &AMD_IS_APU )) { +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_uvd (adev, false); + }else { +amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); +/* shutdown the UVD block */ +amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_UVD , +AMD_PG_STATE_GATE ); +amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_UVD , +AMD_CG_STATE_GATE ); + } } r =uvd_v4_2_hw_fini (adev);drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +21
-9@@ -560,15 +560,27 @@ static int uvd_v6_0_suspend(void *handle)*/ cancel_delayed_work_sync (&adev->uvd.idle_work); -if (adev->pm.dpm_enabled) { -amdgpu_dpm_enable_uvd (adev, false); - }else { -amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); -/* shutdown the UVD block */ -amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_UVD , -AMD_PG_STATE_GATE ); -amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_UVD , -AMD_CG_STATE_GATE ); +/* +* It's confirmed that on some APUs the interaction with SMU(about DPM disablement) +* will power off the UVD. That will make the succeeding interactions with UVD on the +* suspend path impossible. And the system will hang due to that. To workaround the +* issue, we will skip the dpm disablement on APUs. +* +* TODO: a better solution is to reorg the action chains performed on suspend and make +* the dpm disablement the last one. But that will involve a lot and needs MM team's +* help. +*/ +if (!(adev->flags &AMD_IS_APU )) { +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_uvd (adev, false); + }else { +amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); +/* shutdown the UVD block */ +amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_UVD , +AMD_PG_STATE_GATE ); +amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_UVD , +AMD_CG_STATE_GATE ); + } } r =uvd_v6_0_hw_fini (adev);drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +10
-8@@ -505,14 +505,16 @@ static int vce_v2_0_suspend(void *handle)*/ cancel_delayed_work_sync (&adev->vce.idle_work); -if (adev->pm.dpm_enabled) { -amdgpu_dpm_enable_vce (adev, false); - }else { -amdgpu_asic_set_vce_clocks (adev,0 ,0 ); -amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_VCE , -AMD_PG_STATE_GATE ); -amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_VCE , -AMD_CG_STATE_GATE ); +if (!(adev->flags &AMD_IS_APU )) { +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_vce (adev, false); + }else { +amdgpu_asic_set_vce_clocks (adev,0 ,0 ); +amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_VCE , +AMD_PG_STATE_GATE ); +amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_VCE , +AMD_CG_STATE_GATE ); + } } r =vce_v2_0_hw_fini (adev);drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +10
-8@@ -520,14 +520,16 @@ static int vce_v3_0_suspend(void *handle)*/ cancel_delayed_work_sync (&adev->vce.idle_work); -if (adev->pm.dpm_enabled) { -amdgpu_dpm_enable_vce (adev, false); - }else { -amdgpu_asic_set_vce_clocks (adev,0 ,0 ); -amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_VCE , -AMD_PG_STATE_GATE ); -amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_VCE , -AMD_CG_STATE_GATE ); +if (!(adev->flags &AMD_IS_APU )) { +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_vce (adev, false); + }else { +amdgpu_asic_set_vce_clocks (adev,0 ,0 ); +amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_VCE , +AMD_PG_STATE_GATE ); +amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_VCE , +AMD_CG_STATE_GATE ); + } } r =vce_v3_0_hw_fini (adev);
Quoted 19 lines · Evan Quan
It's confirmed that on some APUs the interaction with SMU about DPM disablement will power off the UVD completely. Thus the succeeding interactions with UVD during the reboot will trigger hard hang. To workaround this issue, we will skip the dpm disablement on APUs.
Signed-off-by Evan Quan <[email protected]>Change-Id I4340cc2fb0fd94f439cbac5d4963fe920866bc13--- drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c | 20 ++++++++++-------- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 30 +++++++++++++++++++-------- drivers/gpu/drm/amd/amdgpu/vce_v2_0.c | 18 +++++++++------- drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 18 +++++++++------- 4 files changed, 52 insertions(+), 34 deletions(-)drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +0
-0
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c static int uvd_v4_2_suspend(void *handle) · line 239
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +0
-0@@ -238,15 +238,17 @@ static int uvd_v4_2_suspend(void *handle)*/ cancel_delayed_work_sync (&adev->uvd.idle_work);
If the idle work handler had already started execution, it also goes through the same logic. Wouldn't that be a problem? The other case is if decode work is already completed before suspend is called, then also it disables DPM. Not sure how it works then, or is this caused by a second atempt to power off again after idle work is executed?
Thanks,
Lijo
Quoted 124 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +11
-9-if (adev->pm.dpm_enabled) { -amdgpu_dpm_enable_uvd (adev, false); - }else { -amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); -/* shutdown the UVD block */ -amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_UVD , -AMD_PG_STATE_GATE ); -amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_UVD , -AMD_CG_STATE_GATE ); +if (!(adev->flags &AMD_IS_APU )) { +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_uvd (adev, false); + }else { +amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); +/* shutdown the UVD block */ +amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_UVD , +AMD_PG_STATE_GATE ); +amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_UVD , +AMD_CG_STATE_GATE ); + } } r =uvd_v4_2_hw_fini (adev);drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +21
-9@@ -560,15 +560,27 @@ static int uvd_v6_0_suspend(void *handle)*/ cancel_delayed_work_sync (&adev->uvd.idle_work); -if (adev->pm.dpm_enabled) { -amdgpu_dpm_enable_uvd (adev, false); - }else { -amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); -/* shutdown the UVD block */ -amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_UVD , -AMD_PG_STATE_GATE ); -amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_UVD , -AMD_CG_STATE_GATE ); +/* +* It's confirmed that on some APUs the interaction with SMU(about DPM disablement) +* will power off the UVD. That will make the succeeding interactions with UVD on the +* suspend path impossible. And the system will hang due to that. To workaround the +* issue, we will skip the dpm disablement on APUs. +* +* TODO: a better solution is to reorg the action chains performed on suspend and make +* the dpm disablement the last one. But that will involve a lot and needs MM team's +* help. +*/ +if (!(adev->flags &AMD_IS_APU )) { +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_uvd (adev, false); + }else { +amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); +/* shutdown the UVD block */ +amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_UVD , +AMD_PG_STATE_GATE ); +amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_UVD , +AMD_CG_STATE_GATE ); + } } r =uvd_v6_0_hw_fini (adev);drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +10
-8@@ -505,14 +505,16 @@ static int vce_v2_0_suspend(void *handle)*/ cancel_delayed_work_sync (&adev->vce.idle_work); -if (adev->pm.dpm_enabled) { -amdgpu_dpm_enable_vce (adev, false); - }else { -amdgpu_asic_set_vce_clocks (adev,0 ,0 ); -amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_VCE , -AMD_PG_STATE_GATE ); -amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_VCE , -AMD_CG_STATE_GATE ); +if (!(adev->flags &AMD_IS_APU )) { +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_vce (adev, false); + }else { +amdgpu_asic_set_vce_clocks (adev,0 ,0 ); +amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_VCE , +AMD_PG_STATE_GATE ); +amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_VCE , +AMD_CG_STATE_GATE ); + } } r =vce_v2_0_hw_fini (adev);drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +10
-8@@ -520,14 +520,16 @@ static int vce_v3_0_suspend(void *handle)*/ cancel_delayed_work_sync (&adev->vce.idle_work); -if (adev->pm.dpm_enabled) { -amdgpu_dpm_enable_vce (adev, false); - }else { -amdgpu_asic_set_vce_clocks (adev,0 ,0 ); -amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_VCE , -AMD_PG_STATE_GATE ); -amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_VCE , -AMD_CG_STATE_GATE ); +if (!(adev->flags &AMD_IS_APU )) { +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_vce (adev, false); + }else { +amdgpu_asic_set_vce_clocks (adev,0 ,0 ); +amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_VCE , +AMD_PG_STATE_GATE ); +amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_VCE , +AMD_CG_STATE_GATE ); + } } r =vce_v3_0_hw_fini (adev);
[AMD Official Use Only]
Quoted 26 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Thursday, November 4, 2021 4:55 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: fix the Carrizo UVD hang on system rebootQuoted 10 lines · Evan Quan
It's confirmed that on some APUs the interaction with SMU about DPM disablement will power off the UVD completely. Thus the succeeding interactions with UVD during the reboot will trigger hard hang. To workaround this issue, we will skip the dpm disablement on APUs.
Signed-off-by Evan Quan <[email protected]>Change-Id I4340cc2fb0fd94f439cbac5d4963fe920866bc13--- drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c | 20 ++++++++++-------- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 30+++++++++++++++++++--------
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c | 18 +++++++++------- drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 18 +++++++++------- 4 files changed, 52 insertions(+), 34 deletions(-)
Quoted 14 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c static int uvd_v4_2_suspend(void *handle) · line 239
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +0
-0@@ -238,15 +238,17 @@ static int uvd_v4_2_suspend(void *handle)*/ cancel_delayed_work_sync (&adev->uvd.idle_work);If the idle work handler had already started execution, it also goes through the same logic. Wouldn't that be a problem? The other case is if decode work is already completed before suspend is called, then also it disables DPM. Not sure how it works then, or is this caused by a second atempt to power off again after idle work is executed?
[Quan, Evan] Good point. Yes, maybe there should not be 2nd attempt when the target IP is already in the desired state. Let me confirm with Boris.
BR
Evan
Quoted 160 lines
Thanks,
Lijodrivers/gpu/drm/amd/amdgpu/uvd_v4_2.c static int uvd_v4_2_suspend(void *handle)
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +0
-6-if (adev->pm.dpm_enabled) { -amdgpu_dpm_enable_uvd (adev, false); - }else { -amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); -/* shutdown the UVD block */ - amdgpu_device_ip_set_powergating_state(adev,
AMD_IP_BLOCK_TYPE_UVD,drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c static int uvd_v4_2_suspend(void *handle) · line 247
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +0
-2- AMD_PG_STATE_GATE); - amdgpu_device_ip_set_clockgating_state(adev,
AMD_IP_BLOCK_TYPE_UVD,drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c static int uvd_v4_2_suspend(void *handle)
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +7
-1- AMD_CG_STATE_GATE); +if (!(adev->flags &AMD_IS_APU )) { +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_uvd (adev, false); + }else { +amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); +/* shutdown the UVD block */ + amdgpu_device_ip_set_powergating_state(adev,
AMD_IP_BLOCK_TYPE_UVD,drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c static int uvd_v4_2_suspend(void *handle) · line 247
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +1
-0+
AMD_PG_STATE_GATE);drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c static int uvd_v4_2_suspend(void *handle) · line 248
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +1
-0+ amdgpu_device_ip_set_clockgating_state(adev,
AMD_IP_BLOCK_TYPE_UVD,drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c static int uvd_v4_2_suspend(void *handle) · line 249
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +1
-0+
AMD_CG_STATE_GATE);Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +1
-0+ } } r =uvd_v4_2_hw_fini (adev);drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +0
-0drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle) · line 568
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +0
-6@@ -560,15 +560,27 @@ static int uvd_v6_0_suspend(void *handle)*/ cancel_delayed_work_sync (&adev->uvd.idle_work); -if (adev->pm.dpm_enabled) { -amdgpu_dpm_enable_uvd (adev, false); - }else { -amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); -/* shutdown the UVD block */ - amdgpu_device_ip_set_powergating_state(adev,
AMD_IP_BLOCK_TYPE_UVD,drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle) · line 570
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +0
-2- AMD_PG_STATE_GATE); - amdgpu_device_ip_set_clockgating_state(adev,
AMD_IP_BLOCK_TYPE_UVD,drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle)
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +2
-1- AMD_CG_STATE_GATE); +/* +* It's confirmed that on some APUs the interaction with SMU(about DPM disablement)
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle) · line 565
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +1
-0+* will power off the UVD. That will make the succeeding interactions with UVD on the
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle) · line 566
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +1
-0+* suspend path impossible. And the system will hang due to that. To workaround the
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle)
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +3
-0+* issue, we will skip the dpm disablement on APUs. +* +* TODO: a better solution is to reorg the action chains performed on suspend and make
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle) · line 570
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +1
-0+* the dpm disablement the last one. But that will involve a lot and needs MM team's
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle)
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +9
-0+* help. +*/ +if (!(adev->flags &AMD_IS_APU )) { +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_uvd (adev, false); + }else { +amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); +/* shutdown the UVD block */ + amdgpu_device_ip_set_powergating_state(adev,
AMD_IP_BLOCK_TYPE_UVD,drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle) · line 580
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +1
-0+
AMD_PG_STATE_GATE);drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle) · line 581
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +1
-0+ amdgpu_device_ip_set_clockgating_state(adev,
AMD_IP_BLOCK_TYPE_UVD,drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle) · line 582
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +1
-0+
AMD_CG_STATE_GATE);Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +1
-0+ } } r =uvd_v6_0_hw_fini (adev);drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +0
-0drivers/gpu/drm/amd/amdgpu/vce_v2_0.c static int vce_v2_0_suspend(void *handle) · line 512
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +0
-5@@ -505,14 +505,16 @@ static int vce_v2_0_suspend(void *handle)*/ cancel_delayed_work_sync (&adev->vce.idle_work); -if (adev->pm.dpm_enabled) { -amdgpu_dpm_enable_vce (adev, false); - }else { -amdgpu_asic_set_vce_clocks (adev,0 ,0 ); - amdgpu_device_ip_set_powergating_state(adev,
AMD_IP_BLOCK_TYPE_VCE,drivers/gpu/drm/amd/amdgpu/vce_v2_0.c static int vce_v2_0_suspend(void *handle) · line 514
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +0
-2- AMD_PG_STATE_GATE); - amdgpu_device_ip_set_clockgating_state(adev,
AMD_IP_BLOCK_TYPE_VCE,drivers/gpu/drm/amd/amdgpu/vce_v2_0.c static int vce_v2_0_suspend(void *handle)
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +6
-1- AMD_CG_STATE_GATE); +if (!(adev->flags &AMD_IS_APU )) { +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_vce (adev, false); + }else { +amdgpu_asic_set_vce_clocks (adev,0 ,0 ); + amdgpu_device_ip_set_powergating_state(adev,
AMD_IP_BLOCK_TYPE_VCE,drivers/gpu/drm/amd/amdgpu/vce_v2_0.c static int vce_v2_0_suspend(void *handle) · line 514
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +1
-0+
AMD_PG_STATE_GATE);drivers/gpu/drm/amd/amdgpu/vce_v2_0.c static int vce_v2_0_suspend(void *handle) · line 515
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +1
-0+ amdgpu_device_ip_set_clockgating_state(adev,
AMD_IP_BLOCK_TYPE_VCE,drivers/gpu/drm/amd/amdgpu/vce_v2_0.c static int vce_v2_0_suspend(void *handle) · line 516
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +1
-0+
AMD_CG_STATE_GATE);Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +1
-0+ } } r =vce_v2_0_hw_fini (adev);drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +0
-0drivers/gpu/drm/amd/amdgpu/vce_v3_0.c static int vce_v3_0_suspend(void *handle) · line 527
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +0
-5@@ -520,14 +520,16 @@ static int vce_v3_0_suspend(void *handle)*/ cancel_delayed_work_sync (&adev->vce.idle_work); -if (adev->pm.dpm_enabled) { -amdgpu_dpm_enable_vce (adev, false); - }else { -amdgpu_asic_set_vce_clocks (adev,0 ,0 ); - amdgpu_device_ip_set_powergating_state(adev,
AMD_IP_BLOCK_TYPE_VCE,drivers/gpu/drm/amd/amdgpu/vce_v3_0.c static int vce_v3_0_suspend(void *handle) · line 529
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +0
-2- AMD_PG_STATE_GATE); - amdgpu_device_ip_set_clockgating_state(adev,
AMD_IP_BLOCK_TYPE_VCE,drivers/gpu/drm/amd/amdgpu/vce_v3_0.c static int vce_v3_0_suspend(void *handle) · line 528
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +6
-1- AMD_CG_STATE_GATE); +if (!(adev->flags &AMD_IS_APU )) { +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_vce (adev, false); + }else { +amdgpu_asic_set_vce_clocks (adev,0 ,0 ); + amdgpu_device_ip_set_powergating_state(adev,
AMD_IP_BLOCK_TYPE_VCE,drivers/gpu/drm/amd/amdgpu/vce_v3_0.c static int vce_v3_0_suspend(void *handle) · line 529
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +1
-0+
AMD_PG_STATE_GATE);drivers/gpu/drm/amd/amdgpu/vce_v3_0.c static int vce_v3_0_suspend(void *handle) · line 530
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +1
-0+ amdgpu_device_ip_set_clockgating_state(adev,
AMD_IP_BLOCK_TYPE_VCE,drivers/gpu/drm/amd/amdgpu/vce_v3_0.c static int vce_v3_0_suspend(void *handle) · line 531
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +1
-0+
AMD_CG_STATE_GATE);Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +1
-0+ } } r =vce_v3_0_hw_fini (adev);
Am 05.11.21 um 08:58 schrieb Quan, Evan:
Quoted 41 lines
[AMD Official Use Only]
Quoted 26 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Thursday, November 4, 2021 4:55 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: fix the Carrizo UVD hang on system rebootQuoted 10 lines · Evan Quan
It's confirmed that on some APUs the interaction with SMU about DPM disablement will power off the UVD completely. Thus the succeeding interactions with UVD during the reboot will trigger hard hang. To workaround this issue, we will skip the dpm disablement on APUs.
Signed-off-by Evan Quan <[email protected]>Change-Id I4340cc2fb0fd94f439cbac5d4963fe920866bc13--- drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c | 20 ++++++++++-------- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 30+++++++++++++++++++--------
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c | 18 +++++++++------- drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 18 +++++++++------- 4 files changed, 52 insertions(+), 34 deletions(-)Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c static int uvd_v4_2_suspend(void *handle) · line 239
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +0
-0@@ -238,15 +238,17 @@ static int uvd_v4_2_suspend(void *handle)*/ cancel_delayed_work_sync (&adev->uvd.idle_work);If the idle work handler had already started execution, it also goes through the same logic. Wouldn't that be a problem? The other case is if decode work is already completed before suspend is called, then also it disables DPM. Not sure how it works then, or is this caused by a second atempt to power off again after idle work is executed?
Quoted 2 lines
[Quan, Evan] Good point. Yes, maybe there should not be 2nd attempt when the target IP is already in the desired state. Let me confirm with Boris.
It sounds like you not only need to prevent the clock gating, but also enable the clocks during shutdown.
Regards,
Christian.
Quoted 161 lines
BR
EvanQuoted 158 lines
Thanks,
Lijodrivers/gpu/drm/amd/amdgpu/uvd_v4_2.c static int uvd_v4_2_suspend(void *handle)
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +0
-6-if (adev->pm.dpm_enabled) { -amdgpu_dpm_enable_uvd (adev, false); - }else { -amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); -/* shutdown the UVD block */ - amdgpu_device_ip_set_powergating_state(adev,
AMD_IP_BLOCK_TYPE_UVD,drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c static int uvd_v4_2_suspend(void *handle) · line 247
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +0
-2- AMD_PG_STATE_GATE); - amdgpu_device_ip_set_clockgating_state(adev,
AMD_IP_BLOCK_TYPE_UVD,drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c static int uvd_v4_2_suspend(void *handle)
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +7
-1- AMD_CG_STATE_GATE); +if (!(adev->flags &AMD_IS_APU )) { +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_uvd (adev, false); + }else { +amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); +/* shutdown the UVD block */ + amdgpu_device_ip_set_powergating_state(adev,
AMD_IP_BLOCK_TYPE_UVD,drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c static int uvd_v4_2_suspend(void *handle) · line 247
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +1
-0+
AMD_PG_STATE_GATE);drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c static int uvd_v4_2_suspend(void *handle) · line 248
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +1
-0+ amdgpu_device_ip_set_clockgating_state(adev,
AMD_IP_BLOCK_TYPE_UVD,drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c static int uvd_v4_2_suspend(void *handle) · line 249
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +1
-0+
AMD_CG_STATE_GATE);Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +1
-0+ } } r =uvd_v4_2_hw_fini (adev);drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +0
-0drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle) · line 568
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +0
-6@@ -560,15 +560,27 @@ static int uvd_v6_0_suspend(void *handle)*/ cancel_delayed_work_sync (&adev->uvd.idle_work); -if (adev->pm.dpm_enabled) { -amdgpu_dpm_enable_uvd (adev, false); - }else { -amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); -/* shutdown the UVD block */ - amdgpu_device_ip_set_powergating_state(adev,
AMD_IP_BLOCK_TYPE_UVD,drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle) · line 570
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +0
-2- AMD_PG_STATE_GATE); - amdgpu_device_ip_set_clockgating_state(adev,
AMD_IP_BLOCK_TYPE_UVD,drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle)
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +2
-1- AMD_CG_STATE_GATE); +/* +* It's confirmed that on some APUs the interaction with SMU(about DPM disablement)
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle) · line 565
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +1
-0+* will power off the UVD. That will make the succeeding interactions with UVD on the
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle) · line 566
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +1
-0+* suspend path impossible. And the system will hang due to that. To workaround the
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle)
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +3
-0+* issue, we will skip the dpm disablement on APUs. +* +* TODO: a better solution is to reorg the action chains performed on suspend and make
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle) · line 570
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +1
-0+* the dpm disablement the last one. But that will involve a lot and needs MM team's
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle)
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +9
-0+* help. +*/ +if (!(adev->flags &AMD_IS_APU )) { +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_uvd (adev, false); + }else { +amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); +/* shutdown the UVD block */ + amdgpu_device_ip_set_powergating_state(adev,
AMD_IP_BLOCK_TYPE_UVD,drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle) · line 580
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +1
-0+
AMD_PG_STATE_GATE);drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle) · line 581
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +1
-0+ amdgpu_device_ip_set_clockgating_state(adev,
AMD_IP_BLOCK_TYPE_UVD,drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle) · line 582
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +1
-0+
AMD_CG_STATE_GATE);Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +1
-0+ } } r =uvd_v6_0_hw_fini (adev);drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +0
-0drivers/gpu/drm/amd/amdgpu/vce_v2_0.c static int vce_v2_0_suspend(void *handle) · line 512
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +0
-5@@ -505,14 +505,16 @@ static int vce_v2_0_suspend(void *handle)*/ cancel_delayed_work_sync (&adev->vce.idle_work); -if (adev->pm.dpm_enabled) { -amdgpu_dpm_enable_vce (adev, false); - }else { -amdgpu_asic_set_vce_clocks (adev,0 ,0 ); - amdgpu_device_ip_set_powergating_state(adev,
AMD_IP_BLOCK_TYPE_VCE,drivers/gpu/drm/amd/amdgpu/vce_v2_0.c static int vce_v2_0_suspend(void *handle) · line 514
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +0
-2- AMD_PG_STATE_GATE); - amdgpu_device_ip_set_clockgating_state(adev,
AMD_IP_BLOCK_TYPE_VCE,drivers/gpu/drm/amd/amdgpu/vce_v2_0.c static int vce_v2_0_suspend(void *handle)
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +6
-1- AMD_CG_STATE_GATE); +if (!(adev->flags &AMD_IS_APU )) { +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_vce (adev, false); + }else { +amdgpu_asic_set_vce_clocks (adev,0 ,0 ); + amdgpu_device_ip_set_powergating_state(adev,
AMD_IP_BLOCK_TYPE_VCE,drivers/gpu/drm/amd/amdgpu/vce_v2_0.c static int vce_v2_0_suspend(void *handle) · line 514
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +1
-0+
AMD_PG_STATE_GATE);drivers/gpu/drm/amd/amdgpu/vce_v2_0.c static int vce_v2_0_suspend(void *handle) · line 515
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +1
-0+ amdgpu_device_ip_set_clockgating_state(adev,
AMD_IP_BLOCK_TYPE_VCE,drivers/gpu/drm/amd/amdgpu/vce_v2_0.c static int vce_v2_0_suspend(void *handle) · line 516
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +1
-0+
AMD_CG_STATE_GATE);Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +1
-0+ } } r =vce_v2_0_hw_fini (adev);drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +0
-0drivers/gpu/drm/amd/amdgpu/vce_v3_0.c static int vce_v3_0_suspend(void *handle) · line 527
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +0
-5@@ -520,14 +520,16 @@ static int vce_v3_0_suspend(void *handle)*/ cancel_delayed_work_sync (&adev->vce.idle_work); -if (adev->pm.dpm_enabled) { -amdgpu_dpm_enable_vce (adev, false); - }else { -amdgpu_asic_set_vce_clocks (adev,0 ,0 ); - amdgpu_device_ip_set_powergating_state(adev,
AMD_IP_BLOCK_TYPE_VCE,drivers/gpu/drm/amd/amdgpu/vce_v3_0.c static int vce_v3_0_suspend(void *handle) · line 529
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +0
-2- AMD_PG_STATE_GATE); - amdgpu_device_ip_set_clockgating_state(adev,
AMD_IP_BLOCK_TYPE_VCE,drivers/gpu/drm/amd/amdgpu/vce_v3_0.c static int vce_v3_0_suspend(void *handle) · line 528
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +6
-1- AMD_CG_STATE_GATE); +if (!(adev->flags &AMD_IS_APU )) { +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_vce (adev, false); + }else { +amdgpu_asic_set_vce_clocks (adev,0 ,0 ); + amdgpu_device_ip_set_powergating_state(adev,
AMD_IP_BLOCK_TYPE_VCE,drivers/gpu/drm/amd/amdgpu/vce_v3_0.c static int vce_v3_0_suspend(void *handle) · line 529
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +1
-0+
AMD_PG_STATE_GATE);drivers/gpu/drm/amd/amdgpu/vce_v3_0.c static int vce_v3_0_suspend(void *handle) · line 530
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +1
-0+ amdgpu_device_ip_set_clockgating_state(adev,
AMD_IP_BLOCK_TYPE_VCE,drivers/gpu/drm/amd/amdgpu/vce_v3_0.c static int vce_v3_0_suspend(void *handle) · line 531
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +1
-0+
AMD_CG_STATE_GATE);Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +1
-0+ } } r =vce_v3_0_hw_fini (adev);
Quoted 19 lines · Evan Quan
It's confirmed that on some APUs the interaction with SMU about DPM disablement will power off the UVD completely. Thus the succeeding interactions with UVD during the reboot will trigger hard hang. To workaround this issue, we will skip the dpm disablement on APUs.
Signed-off-by Evan Quan <[email protected]>Change-Id I4340cc2fb0fd94f439cbac5d4963fe920866bc13--- drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c | 20 ++++++++++-------- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 30 +++++++++++++++++++-------- drivers/gpu/drm/amd/amdgpu/vce_v2_0.c | 18 +++++++++------- drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 18 +++++++++------- 4 files changed, 52 insertions(+), 34 deletions(-)drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +0
-0
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c static int uvd_v4_2_suspend(void *handle) · line 242
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +0
-2@@ -238,15 +238,17 @@ static int uvd_v4_2_suspend(void *handle)*/ cancel_delayed_work_sync (&adev->uvd.idle_work); -if (adev->pm.dpm_enabled) { -amdgpu_dpm_enable_uvd (adev, false);
[JZ] Hi Evan, VCN code put amdgpu_dpm_enable_uvd(false) at the end of stop. Can we do the same for uvd/vce?
Here, it is possible that some dec/enc jobs are still running when dpm is called. I am not sure if this situation caused hard hang during reboot.
Quoted 120 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +11
-7- }else { -amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); -/* shutdown the UVD block */ -amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_UVD , -AMD_PG_STATE_GATE ); -amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_UVD , -AMD_CG_STATE_GATE ); +if (!(adev->flags &AMD_IS_APU )) { +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_uvd (adev, false); + }else { +amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); +/* shutdown the UVD block */ +amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_UVD , +AMD_PG_STATE_GATE ); +amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_UVD , +AMD_CG_STATE_GATE ); + } } r =uvd_v4_2_hw_fini (adev);drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +21
-9@@ -560,15 +560,27 @@ static int uvd_v6_0_suspend(void *handle)*/ cancel_delayed_work_sync (&adev->uvd.idle_work); -if (adev->pm.dpm_enabled) { -amdgpu_dpm_enable_uvd (adev, false); - }else { -amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); -/* shutdown the UVD block */ -amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_UVD , -AMD_PG_STATE_GATE ); -amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_UVD , -AMD_CG_STATE_GATE ); +/* +* It's confirmed that on some APUs the interaction with SMU(about DPM disablement) +* will power off the UVD. That will make the succeeding interactions with UVD on the +* suspend path impossible. And the system will hang due to that. To workaround the +* issue, we will skip the dpm disablement on APUs. +* +* TODO: a better solution is to reorg the action chains performed on suspend and make +* the dpm disablement the last one. But that will involve a lot and needs MM team's +* help. +*/ +if (!(adev->flags &AMD_IS_APU )) { +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_uvd (adev, false); + }else { +amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); +/* shutdown the UVD block */ +amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_UVD , +AMD_PG_STATE_GATE ); +amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_UVD , +AMD_CG_STATE_GATE ); + } } r =uvd_v6_0_hw_fini (adev);drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +10
-8@@ -505,14 +505,16 @@ static int vce_v2_0_suspend(void *handle)*/ cancel_delayed_work_sync (&adev->vce.idle_work); -if (adev->pm.dpm_enabled) { -amdgpu_dpm_enable_vce (adev, false); - }else { -amdgpu_asic_set_vce_clocks (adev,0 ,0 ); -amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_VCE , -AMD_PG_STATE_GATE ); -amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_VCE , -AMD_CG_STATE_GATE ); +if (!(adev->flags &AMD_IS_APU )) { +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_vce (adev, false); + }else { +amdgpu_asic_set_vce_clocks (adev,0 ,0 ); +amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_VCE , +AMD_PG_STATE_GATE ); +amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_VCE , +AMD_CG_STATE_GATE ); + } } r =vce_v2_0_hw_fini (adev);drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +10
-8@@ -520,14 +520,16 @@ static int vce_v3_0_suspend(void *handle)*/ cancel_delayed_work_sync (&adev->vce.idle_work); -if (adev->pm.dpm_enabled) { -amdgpu_dpm_enable_vce (adev, false); - }else { -amdgpu_asic_set_vce_clocks (adev,0 ,0 ); -amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_VCE , -AMD_PG_STATE_GATE ); -amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_VCE , -AMD_CG_STATE_GATE ); +if (!(adev->flags &AMD_IS_APU )) { +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_vce (adev, false); + }else { +amdgpu_asic_set_vce_clocks (adev,0 ,0 ); +amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_VCE , +AMD_PG_STATE_GATE ); +amdgpu_device_ip_set_clockgating_state (adev,AMD_IP_BLOCK_TYPE_VCE , +AMD_CG_STATE_GATE ); + } } r =vce_v3_0_hw_fini (adev);
[AMD Official Use Only]
Quoted 34 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of James Zhu
Sent: Friday, November 5, 2021 10:03 AM
To: [email protected]
Subject: Re: [PATCH] drm/amdgpu: fix the Carrizo UVD hang on system rebootQuoted 10 lines · Evan Quan
It's confirmed that on some APUs the interaction with SMU about DPM disablement will power off the UVD completely. Thus the succeeding interactions with UVD during the reboot will trigger hard hang. To workaround this issue, we will skip the dpm disablement on APUs.
Signed-off-by Evan Quan <[email protected]>Change-Id I4340cc2fb0fd94f439cbac5d4963fe920866bc13--- drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c | 20 ++++++++++-------- drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 30+++++++++++++++++++--------
Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c | 18 +++++++++------- drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 18 +++++++++------- 4 files changed, 52 insertions(+), 34 deletions(-)drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +0
-0@@ -238,15 +238,17 @@ static int uvd_v4_2_suspend(void *handle)*/ cancel_delayed_work_sync (&adev->uvd.idle_work);
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c static int uvd_v4_2_suspend(void *handle) · line 242
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +0
-2-if (adev->pm.dpm_enabled) { -amdgpu_dpm_enable_uvd (adev, false);[JZ] Hi Evan, VCN code put
amdgpu_dpm_enable_uvd(false)at the end of stop. Can we do the same for uvd/vce?
[Quan, Evan] Sounds reasonable to me. Actually Lijo provided some insights which enlightened me. I will drop this patch and provide a new one.
BR
Evan
Quoted 156 lines
Here, it is possible that some dec/enc jobs are still running when dpm is called. I am not sure if this situation caused hard hang during reboot.
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c static int uvd_v4_2_suspend(void *handle)
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +0
-4- }else { -amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); -/* shutdown the UVD block */ - amdgpu_device_ip_set_powergating_state(adev,
AMD_IP_BLOCK_TYPE_UVD,drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c static int uvd_v4_2_suspend(void *handle) · line 248
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +0
-2- AMD_PG_STATE_GATE); - amdgpu_device_ip_set_clockgating_state(adev,
AMD_IP_BLOCK_TYPE_UVD,drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c static int uvd_v4_2_suspend(void *handle)
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +7
-1- AMD_CG_STATE_GATE); +if (!(adev->flags &AMD_IS_APU )) { +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_uvd (adev, false); + }else { +amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); +/* shutdown the UVD block */ + amdgpu_device_ip_set_powergating_state(adev,
AMD_IP_BLOCK_TYPE_UVD,drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c static int uvd_v4_2_suspend(void *handle) · line 248
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +1
-0+
AMD_PG_STATE_GATE);drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c static int uvd_v4_2_suspend(void *handle) · line 249
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +1
-0+ amdgpu_device_ip_set_clockgating_state(adev,
AMD_IP_BLOCK_TYPE_UVD,drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c static int uvd_v4_2_suspend(void *handle) · line 250
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +1
-0+
AMD_CG_STATE_GATE);Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +1
-0+ } } r =uvd_v4_2_hw_fini (adev);drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +0
-0drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle) · line 568
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +0
-6@@ -560,15 +560,27 @@ static int uvd_v6_0_suspend(void *handle)*/ cancel_delayed_work_sync (&adev->uvd.idle_work); -if (adev->pm.dpm_enabled) { -amdgpu_dpm_enable_uvd (adev, false); - }else { -amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); -/* shutdown the UVD block */ - amdgpu_device_ip_set_powergating_state(adev,
AMD_IP_BLOCK_TYPE_UVD,drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle) · line 570
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +0
-2- AMD_PG_STATE_GATE); - amdgpu_device_ip_set_clockgating_state(adev,
AMD_IP_BLOCK_TYPE_UVD,drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle)
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +2
-1- AMD_CG_STATE_GATE); +/* +* It's confirmed that on some APUs the interaction with SMU(about DPM disablement)
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle) · line 565
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +1
-0+* will power off the UVD. That will make the succeeding interactions with UVD on the
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle) · line 566
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +1
-0+* suspend path impossible. And the system will hang due to that. To workaround the
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle)
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +3
-0+* issue, we will skip the dpm disablement on APUs. +* +* TODO: a better solution is to reorg the action chains performed on suspend and make
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle) · line 570
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +1
-0+* the dpm disablement the last one. But that will involve a lot and needs MM team's
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle)
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +9
-0+* help. +*/ +if (!(adev->flags &AMD_IS_APU )) { +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_uvd (adev, false); + }else { +amdgpu_asic_set_uvd_clocks (adev,0 ,0 ); +/* shutdown the UVD block */ + amdgpu_device_ip_set_powergating_state(adev,
AMD_IP_BLOCK_TYPE_UVD,drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle) · line 580
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +1
-0+
AMD_PG_STATE_GATE);drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle) · line 581
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +1
-0+ amdgpu_device_ip_set_clockgating_state(adev,
AMD_IP_BLOCK_TYPE_UVD,drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c static int uvd_v6_0_suspend(void *handle) · line 582
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +1
-0+
AMD_CG_STATE_GATE);Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +1
-0+ } } r =uvd_v6_0_hw_fini (adev);drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +0
-0drivers/gpu/drm/amd/amdgpu/vce_v2_0.c static int vce_v2_0_suspend(void *handle) · line 512
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +0
-5@@ -505,14 +505,16 @@ static int vce_v2_0_suspend(void *handle)*/ cancel_delayed_work_sync (&adev->vce.idle_work); -if (adev->pm.dpm_enabled) { -amdgpu_dpm_enable_vce (adev, false); - }else { -amdgpu_asic_set_vce_clocks (adev,0 ,0 ); - amdgpu_device_ip_set_powergating_state(adev,
AMD_IP_BLOCK_TYPE_VCE,drivers/gpu/drm/amd/amdgpu/vce_v2_0.c static int vce_v2_0_suspend(void *handle) · line 514
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +0
-2- AMD_PG_STATE_GATE); - amdgpu_device_ip_set_clockgating_state(adev,
AMD_IP_BLOCK_TYPE_VCE,drivers/gpu/drm/amd/amdgpu/vce_v2_0.c static int vce_v2_0_suspend(void *handle)
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +6
-1- AMD_CG_STATE_GATE); +if (!(adev->flags &AMD_IS_APU )) { +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_vce (adev, false); + }else { +amdgpu_asic_set_vce_clocks (adev,0 ,0 ); + amdgpu_device_ip_set_powergating_state(adev,
AMD_IP_BLOCK_TYPE_VCE,drivers/gpu/drm/amd/amdgpu/vce_v2_0.c static int vce_v2_0_suspend(void *handle) · line 514
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +1
-0+
AMD_PG_STATE_GATE);drivers/gpu/drm/amd/amdgpu/vce_v2_0.c static int vce_v2_0_suspend(void *handle) · line 515
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +1
-0+ amdgpu_device_ip_set_clockgating_state(adev,
AMD_IP_BLOCK_TYPE_VCE,drivers/gpu/drm/amd/amdgpu/vce_v2_0.c static int vce_v2_0_suspend(void *handle) · line 516
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +1
-0+
AMD_CG_STATE_GATE);Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +1
-0+ } } r =vce_v2_0_hw_fini (adev);drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +0
-0drivers/gpu/drm/amd/amdgpu/vce_v3_0.c static int vce_v3_0_suspend(void *handle) · line 527
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +0
-5@@ -520,14 +520,16 @@ static int vce_v3_0_suspend(void *handle)*/ cancel_delayed_work_sync (&adev->vce.idle_work); -if (adev->pm.dpm_enabled) { -amdgpu_dpm_enable_vce (adev, false); - }else { -amdgpu_asic_set_vce_clocks (adev,0 ,0 ); - amdgpu_device_ip_set_powergating_state(adev,
AMD_IP_BLOCK_TYPE_VCE,drivers/gpu/drm/amd/amdgpu/vce_v3_0.c static int vce_v3_0_suspend(void *handle) · line 529
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +0
-2- AMD_PG_STATE_GATE); - amdgpu_device_ip_set_clockgating_state(adev,
AMD_IP_BLOCK_TYPE_VCE,drivers/gpu/drm/amd/amdgpu/vce_v3_0.c static int vce_v3_0_suspend(void *handle) · line 528
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +6
-1- AMD_CG_STATE_GATE); +if (!(adev->flags &AMD_IS_APU )) { +if (adev->pm.dpm_enabled) { +amdgpu_dpm_enable_vce (adev, false); + }else { +amdgpu_asic_set_vce_clocks (adev,0 ,0 ); + amdgpu_device_ip_set_powergating_state(adev,
AMD_IP_BLOCK_TYPE_VCE,drivers/gpu/drm/amd/amdgpu/vce_v3_0.c static int vce_v3_0_suspend(void *handle) · line 529
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +1
-0+
AMD_PG_STATE_GATE);drivers/gpu/drm/amd/amdgpu/vce_v3_0.c static int vce_v3_0_suspend(void *handle) · line 530
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +1
-0+ amdgpu_device_ip_set_clockgating_state(adev,
AMD_IP_BLOCK_TYPE_VCE,drivers/gpu/drm/amd/amdgpu/vce_v3_0.c static int vce_v3_0_suspend(void *handle) · line 531
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +1
-0+
AMD_CG_STATE_GATE);Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +1
-0+ } } r =vce_v3_0_hw_fini (adev);