Skip to content

Commit b092b19

Browse files
prliangpubalexdeucher
authored andcommitted
drm/amdgpu: fix shutdown and poweroff process failed with s0ix
In the shutdown and poweroff opt on the s0i3 system we still need un-gate the gfx clock gating and power gating before destory amdgpu device. Fixes: 628c36d ("drm/amdgpu: update amdgpu device suspend/resume sequence for s0i3 support") Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1499 Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Prike Liang <Prike.Liang@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org
1 parent 83e6667 commit b092b19

3 files changed

Lines changed: 18 additions & 3 deletions

File tree

drivers/gpu/drm/amd/amdgpu/amdgpu.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,6 +1008,12 @@ struct amdgpu_device {
10081008
bool in_suspend;
10091009
bool in_hibernate;
10101010

1011+
/*
1012+
* The combination flag in_poweroff_reboot_com used to identify the poweroff
1013+
* and reboot opt in the s0i3 system-wide suspend.
1014+
*/
1015+
bool in_poweroff_reboot_com;
1016+
10111017
atomic_t in_gpu_reset;
10121018
enum pp_mp1_state mp1_state;
10131019
struct rw_semaphore reset_sem;

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2678,7 +2678,8 @@ static int amdgpu_device_ip_suspend_phase1(struct amdgpu_device *adev)
26782678
{
26792679
int i, r;
26802680

2681-
if (!amdgpu_acpi_is_s0ix_supported(adev) || amdgpu_in_reset(adev)) {
2681+
if (adev->in_poweroff_reboot_com ||
2682+
!amdgpu_acpi_is_s0ix_supported(adev) || amdgpu_in_reset(adev)) {
26822683
amdgpu_device_set_pg_state(adev, AMD_PG_STATE_UNGATE);
26832684
amdgpu_device_set_cg_state(adev, AMD_CG_STATE_UNGATE);
26842685
}
@@ -3741,7 +3742,8 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)
37413742

37423743
amdgpu_fence_driver_suspend(adev);
37433744

3744-
if (!amdgpu_acpi_is_s0ix_supported(adev) || amdgpu_in_reset(adev))
3745+
if (adev->in_poweroff_reboot_com ||
3746+
!amdgpu_acpi_is_s0ix_supported(adev) || amdgpu_in_reset(adev))
37453747
r = amdgpu_device_ip_suspend_phase2(adev);
37463748
else
37473749
amdgpu_gfx_state_change_set(adev, sGpuChangeState_D3Entry);

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1270,7 +1270,9 @@ amdgpu_pci_shutdown(struct pci_dev *pdev)
12701270
*/
12711271
if (!amdgpu_passthrough(adev))
12721272
adev->mp1_state = PP_MP1_STATE_UNLOAD;
1273+
adev->in_poweroff_reboot_com = true;
12731274
amdgpu_device_ip_suspend(adev);
1275+
adev->in_poweroff_reboot_com = false;
12741276
adev->mp1_state = PP_MP1_STATE_NONE;
12751277
}
12761278

@@ -1312,8 +1314,13 @@ static int amdgpu_pmops_thaw(struct device *dev)
13121314
static int amdgpu_pmops_poweroff(struct device *dev)
13131315
{
13141316
struct drm_device *drm_dev = dev_get_drvdata(dev);
1317+
struct amdgpu_device *adev = drm_to_adev(drm_dev);
1318+
int r;
13151319

1316-
return amdgpu_device_suspend(drm_dev, true);
1320+
adev->in_poweroff_reboot_com = true;
1321+
r = amdgpu_device_suspend(drm_dev, true);
1322+
adev->in_poweroff_reboot_com = false;
1323+
return r;
13171324
}
13181325

13191326
static int amdgpu_pmops_restore(struct device *dev)

0 commit comments

Comments
 (0)