summaryrefslogtreecommitdiff
path: root/0003-drm-amdgpu-fix-shutdown-with-s0ix.patch
diff options
context:
space:
mode:
Diffstat (limited to '0003-drm-amdgpu-fix-shutdown-with-s0ix.patch')
-rw-r--r--0003-drm-amdgpu-fix-shutdown-with-s0ix.patch77
1 files changed, 77 insertions, 0 deletions
diff --git a/0003-drm-amdgpu-fix-shutdown-with-s0ix.patch b/0003-drm-amdgpu-fix-shutdown-with-s0ix.patch
new file mode 100644
index 0000000..0427bc0
--- /dev/null
+++ b/0003-drm-amdgpu-fix-shutdown-with-s0ix.patch
@@ -0,0 +1,77 @@
+From 7e63b4196ca6366bbc43741f340b33988c660c33 Mon Sep 17 00:00:00 2001
+From: Alex Deucher <alexander.deucher@amd.com>
+Date: Thu, 18 Feb 2021 12:05:53 -0500
+Subject: drm/amdgpu: fix shutdown with s0ix
+
+For shutdown needs to be handled differently and s0ix. Add
+a new flag to shutdown and use it to adjust behavior appropriately.
+
+Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1499
+Fixes: 628c36d7b238e2 ("drm/amdgpu: update amdgpu device suspend/resume sequence for s0i3 support")
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Cc: Prike Liang <Prike.Liang@amd.com>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 +
+ drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 ++++--
+ drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 ++
+ 3 files changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+index 5993dd0fdd8e..4ae244048d53 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+@@ -1002,6 +1002,7 @@ struct amdgpu_device {
+ /* s3/s4 mask */
+ bool in_suspend;
+ bool in_hibernate;
++ bool in_shutdown;
+
+ atomic_t in_gpu_reset;
+ enum pp_mp1_state mp1_state;
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+index cab1ebaf6d62..d07ff05ad042 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+@@ -2666,7 +2666,8 @@ static int amdgpu_device_ip_suspend_phase1(struct amdgpu_device *adev)
+ {
+ int i, r;
+
+- if (!amdgpu_acpi_is_s0ix_supported(adev) || amdgpu_in_reset(adev)) {
++ if (adev->in_shutdown ||
++ !amdgpu_acpi_is_s0ix_supported(adev) || amdgpu_in_reset(adev)) {
+ amdgpu_device_set_pg_state(adev, AMD_PG_STATE_UNGATE);
+ amdgpu_device_set_cg_state(adev, AMD_CG_STATE_UNGATE);
+ }
+@@ -3726,7 +3727,8 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)
+
+ amdgpu_fence_driver_suspend(adev);
+
+- if (!amdgpu_acpi_is_s0ix_supported(adev) || amdgpu_in_reset(adev))
++ if (adev->in_shutdown ||
++ !amdgpu_acpi_is_s0ix_supported(adev) || amdgpu_in_reset(adev))
+ r = amdgpu_device_ip_suspend_phase2(adev);
+ else
+ amdgpu_gfx_state_change_set(adev, sGpuChangeState_D3Entry);
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+index 7169fb5e3d9c..2aacb96cf320 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+@@ -1259,6 +1259,7 @@ amdgpu_pci_shutdown(struct pci_dev *pdev)
+ if (amdgpu_ras_intr_triggered())
+ return;
+
++ adev->in_shutdown = true;
+ /* if we are running in a VM, make sure the device
+ * torn down properly on reboot/shutdown.
+ * unfortunately we can't detect certain
+@@ -1268,6 +1269,7 @@ amdgpu_pci_shutdown(struct pci_dev *pdev)
+ adev->mp1_state = PP_MP1_STATE_UNLOAD;
+ amdgpu_device_ip_suspend(adev);
+ adev->mp1_state = PP_MP1_STATE_NONE;
++ adev->in_shutdown = false;
+ }
+
+ static int amdgpu_pmops_suspend(struct device *dev)
+--
+cgit v1.2.3-1-gf6bb5
+