diff mbox

drm/i915/debugfs: Take runtime_pm ref for sseu

Message ID 1470062007-26996-1-git-send-email-david.weinehall@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

David Weinehall Aug. 1, 2016, 2:33 p.m. UTC
When reading the SSEU statistics, we need to call
intel_runtime_pm_get() first, otherwise we might end up
triggering "Device suspended during HW access".

Signed-off-by: David Weinehall <david.weinehall@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Joonas Lahtinen Aug. 1, 2016, 2:48 p.m. UTC | #1
On ma, 2016-08-01 at 17:33 +0300, David Weinehall wrote:
> When reading the SSEU statistics, we need to call
> intel_runtime_pm_get() first, otherwise we might end up
> triggering "Device suspended during HW access".
> 
> Signed-off-by: David Weinehall <david.weinehall@linux.intel.com>

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

> ---
>  drivers/gpu/drm/i915/i915_debugfs.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 9aa62c5b5f65..531ca0221c7f 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -5238,7 +5238,8 @@ static void broadwell_sseu_device_status(struct drm_device *dev,
>  static int i915_sseu_status(struct seq_file *m, void *unused)
>  {
>  	struct drm_info_node *node = (struct drm_info_node *) m->private;
> -	struct drm_device *dev = node->minor->dev;
> +	struct drm_i915_private *dev_priv = to_i915(node->minor->dev);
> +	struct drm_device *dev = &dev_priv->drm;
>  	struct sseu_dev_status stat;
>  
>  	if (INTEL_INFO(dev)->gen < 8)
> @@ -5268,6 +5269,9 @@ static int i915_sseu_status(struct seq_file *m, void *unused)
>  
>  	seq_puts(m, "SSEU Device Status\n");
>  	memset(&stat, 0, sizeof(stat));
> +
> +	intel_runtime_pm_get(dev_priv);
> +
>  	if (IS_CHERRYVIEW(dev)) {
>  		cherryview_sseu_device_status(dev, &stat);
>  	} else if (IS_BROADWELL(dev)) {
> @@ -5275,6 +5279,9 @@ static int i915_sseu_status(struct seq_file *m, void *unused)
>  	} else if (INTEL_INFO(dev)->gen >= 9) {
>  		gen9_sseu_device_status(dev, &stat);
>  	}
> +
> +	intel_runtime_pm_put(dev_priv);
> +
>  	seq_printf(m, "  Enabled Slice Total: %u\n",
>  		   stat.slice_total);
>  	seq_printf(m, "  Enabled Subslice Total: %u\n",
Chris Wilson Aug. 1, 2016, 2:54 p.m. UTC | #2
On Mon, Aug 01, 2016 at 05:48:51PM +0300, Joonas Lahtinen wrote:
> On ma, 2016-08-01 at 17:33 +0300, David Weinehall wrote:
> > When reading the SSEU statistics, we need to call
> > intel_runtime_pm_get() first, otherwise we might end up
> > triggering "Device suspended during HW access".
> > 
> > Signed-off-by: David Weinehall <david.weinehall@linux.intel.com>
> 
> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Confidently pushed, thanks.
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 9aa62c5b5f65..531ca0221c7f 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -5238,7 +5238,8 @@  static void broadwell_sseu_device_status(struct drm_device *dev,
 static int i915_sseu_status(struct seq_file *m, void *unused)
 {
 	struct drm_info_node *node = (struct drm_info_node *) m->private;
-	struct drm_device *dev = node->minor->dev;
+	struct drm_i915_private *dev_priv = to_i915(node->minor->dev);
+	struct drm_device *dev = &dev_priv->drm;
 	struct sseu_dev_status stat;
 
 	if (INTEL_INFO(dev)->gen < 8)
@@ -5268,6 +5269,9 @@  static int i915_sseu_status(struct seq_file *m, void *unused)
 
 	seq_puts(m, "SSEU Device Status\n");
 	memset(&stat, 0, sizeof(stat));
+
+	intel_runtime_pm_get(dev_priv);
+
 	if (IS_CHERRYVIEW(dev)) {
 		cherryview_sseu_device_status(dev, &stat);
 	} else if (IS_BROADWELL(dev)) {
@@ -5275,6 +5279,9 @@  static int i915_sseu_status(struct seq_file *m, void *unused)
 	} else if (INTEL_INFO(dev)->gen >= 9) {
 		gen9_sseu_device_status(dev, &stat);
 	}
+
+	intel_runtime_pm_put(dev_priv);
+
 	seq_printf(m, "  Enabled Slice Total: %u\n",
 		   stat.slice_total);
 	seq_printf(m, "  Enabled Subslice Total: %u\n",