[igt-dev] [PATCH v2 2/2] add DROP_SUSPEND.

Caz Yokoyama caz.yokoyama at intel.com
Tue Mar 12 03:31:32 UTC 2019


From: "Yokoyama, Caz" <caz.yokoyama at intel.com>

Confirm there is no additional work needed when
GPU is in suspended state.

Change-Id: I0775d784f1485015304261309652de084280bf82
Signed-off-by: Yokoyama, Caz <caz.yokoyama at intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 0a6348ad7c98..ca0ba1f0d89e 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -28,6 +28,7 @@
 
 #include <linux/sort.h>
 #include <linux/sched/mm.h>
+#include <linux/pm_runtime.h>
 #include <drm/drm_debugfs.h>
 #include <drm/drm_fourcc.h>
 #include "intel_drv.h"
@@ -3873,6 +3874,7 @@ DEFINE_SIMPLE_ATTRIBUTE(i915_wedged_fops,
 #define DROP_IDLE	BIT(6)
 #define DROP_RESET_ACTIVE	BIT(7)
 #define DROP_RESET_SEQNO	BIT(8)
+#define DROP_SUSPEND	BIT(9)
 #define DROP_ALL (DROP_UNBOUND	| \
 		  DROP_BOUND	| \
 		  DROP_RETIRE	| \
@@ -3899,7 +3901,9 @@ i915_drop_caches_set(void *data, u64 val)
 
 	DRM_DEBUG("Dropping caches: 0x%08llx [0x%08llx]\n",
 		  val, val & DROP_ALL);
-	wakeref = intel_runtime_pm_get(i915);
+	if (!(val & DROP_SUSPEND)) {
+		wakeref = intel_runtime_pm_get(i915);
+	}
 
 	if (val & DROP_RESET_ACTIVE &&
 	    wait_for(intel_engines_are_idle(i915), I915_IDLE_ENGINES_TIMEOUT))
@@ -3949,8 +3953,23 @@ i915_drop_caches_set(void *data, u64 val)
 	if (val & DROP_FREED)
 		i915_gem_drain_freed_objects(i915);
 
+	if (val & DROP_SUSPEND) {
+		struct device *dev = i915->drm.dev;
+
+		dev_info(dev, "%s() %d: runtime_status: %d\n", __func__, __LINE__,
+			 dev->power.runtime_status);
+		pm_runtime_disable(dev);
+		if (!pm_runtime_status_suspended(dev)) {
+			dev_warn(dev, "%s() %d: runtime_status: %d\n", __func__, __LINE__,
+				 dev->power.runtime_status);
+		}
+		pm_runtime_enable(dev);
+	}
+
 out:
-	intel_runtime_pm_put(i915, wakeref);
+	if (!(val & DROP_SUSPEND)) {
+		intel_runtime_pm_put(i915, wakeref);
+	}
 
 	return ret;
 }
-- 
2.17.1



More information about the igt-dev mailing list