[PATCH 1/3] drm/i915: Do gem backup at i915_pm_ops.suspend_late()

Nirmoy Das nirmoy.das at intel.com
Mon Jan 30 16:36:20 UTC 2023


Backup gem objects at suspend_late stage where it is guaranteed
that there won't any new requests generated from userspace.

Signed-off-by: Nirmoy Das <nirmoy.das at intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_pm.c |  1 +
 drivers/gpu/drm/i915/i915_driver.c     | 18 +++++-------------
 2 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_pm.c b/drivers/gpu/drm/i915/gem/i915_gem_pm.c
index 0d812f4d787d..7897716eb1cf 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_pm.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_pm.c
@@ -140,6 +140,7 @@ void i915_gem_suspend_late(struct drm_i915_private *i915)
 	unsigned int i;
 	bool flush = false;
 
+	i915_gem_backup_suspend(i915);
 	/*
 	 * Neither the BIOS, ourselves or any other kernel
 	 * expects the system to be in execlists mode on startup,
diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
index c705ad08b162..96b8f24b496d 100644
--- a/drivers/gpu/drm/i915/i915_driver.c
+++ b/drivers/gpu/drm/i915/i915_driver.c
@@ -1039,19 +1039,9 @@ static void i915_drm_complete(struct drm_device *dev)
 	intel_pxp_resume_complete(i915->pxp);
 }
 
-static int i915_drm_prepare(struct drm_device *dev)
+static void i915_drm_prepare(struct drm_device *dev)
 {
-	struct drm_i915_private *i915 = to_i915(dev);
-
-	intel_pxp_suspend_prepare(i915->pxp);
-
-	/*
-	 * NB intel_display_suspend() may issue new requests after we've
-	 * ostensibly marked the GPU as ready-to-sleep here. We need to
-	 * split out that work and pull it forward so that after point,
-	 * the GPU is not woken again.
-	 */
-	return i915_gem_backup_suspend(i915);
+	intel_pxp_suspend_prepare(to_i915(dev)->pxp);
 }
 
 static int i915_drm_suspend(struct drm_device *dev)
@@ -1363,7 +1353,9 @@ static int i915_pm_prepare(struct device *kdev)
 	if (i915->drm.switch_power_state == DRM_SWITCH_POWER_OFF)
 		return 0;
 
-	return i915_drm_prepare(&i915->drm);
+	i915_drm_prepare(&i915->drm);
+
+	return 0;
 }
 
 static int i915_pm_suspend(struct device *kdev)
-- 
2.39.0



More information about the Intel-gfx-trybot mailing list