summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2022-05-25 12:29:13 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2022-05-25 12:29:13 +0000
commit296f9afa639485d84465a0cb2ad2975ec8887cc8 (patch)
treea6c761625584de51a6d3cd86043882ac89b5c95a /sys/dev/pci
parentd92fb3d1f5e750270daca9737b0281bdddf60860 (diff)
drm/amd: Don't reset dGPUs if the system is going to s2idle
From Mario Limonciello 9d3ec4e5bf032f53137e11075846cec9c474ce4b in linux 5.15.y/5.15.42 7123d39dc24dcd21ff23d75f46f926b15269b9da in mainline linux
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/drm/amd/amdgpu/amdgpu.h2
-rw-r--r--sys/dev/pci/drm/amd/amdgpu/amdgpu_acpi.c14
-rw-r--r--sys/dev/pci/drm/amd/amdgpu/amdgpu_drv.c2
3 files changed, 17 insertions, 1 deletions
diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu.h b/sys/dev/pci/drm/amd/amdgpu/amdgpu.h
index 9920036a7d6..50d729abfe2 100644
--- a/sys/dev/pci/drm/amd/amdgpu/amdgpu.h
+++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu.h
@@ -1440,9 +1440,11 @@ static inline int amdgpu_acpi_smart_shift_update(struct drm_device *dev,
#if defined(CONFIG_ACPI) && defined(CONFIG_SUSPEND)
bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev);
+bool amdgpu_acpi_should_gpu_reset(struct amdgpu_device *adev);
bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev);
#else
static inline bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev) { return false; }
+static inline bool amdgpu_acpi_should_gpu_reset(struct amdgpu_device *adev) { return false; }
static inline bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev) { return false; }
#endif
diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_acpi.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_acpi.c
index bdedf4f781a..970822d1a36 100644
--- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_acpi.c
+++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_acpi.c
@@ -1059,6 +1059,20 @@ bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev)
}
/**
+ * amdgpu_acpi_should_gpu_reset
+ *
+ * @adev: amdgpu_device_pointer
+ *
+ * returns true if should reset GPU, false if not
+ */
+bool amdgpu_acpi_should_gpu_reset(struct amdgpu_device *adev)
+{
+ if (adev->flags & AMD_IS_APU)
+ return false;
+ return pm_suspend_target_state != PM_SUSPEND_TO_IDLE;
+}
+
+/**
* amdgpu_acpi_is_s0ix_active
*
* @adev: amdgpu_device_pointer
diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_drv.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_drv.c
index feaa32429d8..03a116fd55a 100644
--- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_drv.c
+++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_drv.c
@@ -2263,7 +2263,7 @@ static int amdgpu_pmops_suspend_noirq(struct device *dev)
struct drm_device *drm_dev = dev_get_drvdata(dev);
struct amdgpu_device *adev = drm_to_adev(drm_dev);
- if (!adev->in_s0ix)
+ if (amdgpu_acpi_should_gpu_reset(adev))
return amdgpu_asic_reset(adev);
return 0;