[Intel-gfx] [RFC 12/22] drm/i915/slpc: Send shutdown event

tom.orourke at intel.com tom.orourke at intel.com
Wed Jan 20 18:26:14 PST 2016


From: Tom O'Rourke <Tom.O'Rourke at intel.com>

Send SLPC shutdown event during disable, suspend, and reset
operations.  Sending shutdown event while already shutdown
is OK.

Signed-off-by: Tom O'Rourke <Tom.O'Rourke at intel.com>
---
 drivers/gpu/drm/i915/intel_slpc.c | 45 ++++++++++++++++++++++++++++++++++++---
 1 file changed, 42 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_slpc.c b/drivers/gpu/drm/i915/intel_slpc.c
index 59c54a6..f155d88 100644
--- a/drivers/gpu/drm/i915/intel_slpc.c
+++ b/drivers/gpu/drm/i915/intel_slpc.c
@@ -50,6 +50,30 @@ static int host2guc_slpc_reset(struct drm_i915_private *dev_priv)
 	return ret;
 }
 
+static int host2guc_slpc_shutdown(struct drm_i915_private *dev_priv)
+{
+	struct drm_i915_gem_object *obj = dev_priv->guc.slpc.shared_data_obj;
+	u32 data[4];
+	int ret;
+	u64 shared_data_gtt_offset = i915_gem_obj_ggtt_offset(obj);
+
+	data[0] = HOST2GUC_ACTION_SLPC_REQUEST;
+	data[1] = SLPC_EVENT(SLPC_EVENT_SHUTDOWN, 2);
+	data[2] = lower_32_bits(shared_data_gtt_offset);
+	data[3] = upper_32_bits(shared_data_gtt_offset);
+
+	WARN_ON(0 != data[3]);
+
+	ret = host2guc_action(&dev_priv->guc, data, 4);
+
+	if (0 == ret) {
+		ret = I915_READ(SOFT_SCRATCH(1));
+		ret &= 0xFF;
+	}
+
+	return ret;
+}
+
 static u8 slpc_get_platform_sku(struct drm_i915_gem_object *obj)
 {
 	struct drm_device *dev = obj->base.dev;
@@ -158,15 +182,23 @@ int intel_slpc_cleanup(struct drm_device *dev)
 int intel_slpc_suspend(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
+	int ret = 0;
 
-	return 0;
+	if (dev_priv->guc.slpc.shared_data_obj)
+		ret = host2guc_slpc_shutdown(dev_priv);
+
+	return ret;
 }
 
 int intel_slpc_disable(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
+	int ret = 0;
 
-	return 0;
+	if (dev_priv->guc.slpc.shared_data_obj)
+		ret = host2guc_slpc_shutdown(dev_priv);
+
+	return ret;
 }
 
 int intel_slpc_enable(struct drm_device *dev)
@@ -183,6 +215,13 @@ int intel_slpc_enable(struct drm_device *dev)
 int intel_slpc_reset(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
+	int ret = 0;
 
-	return 0;
+	if (dev_priv->guc.slpc.shared_data_obj) {
+		ret = host2guc_slpc_shutdown(dev_priv);
+		/* ignore failed shutdown, continue wth reset */
+		ret = host2guc_slpc_reset(dev_priv);
+	}
+
+	return ret;
 }
-- 
1.9.1



More information about the Intel-gfx mailing list