diff mbox series

[2/4] drm/i915: Make GEM resume all engines

Message ID 20220914220427.3091448-3-matthew.d.roper@intel.com (mailing list archive)
State New, archived
Headers show
Series Further multi-gt handling | expand

Commit Message

Matt Roper Sept. 14, 2022, 10:04 p.m. UTC
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Walk all GTs from i915_gem_resume when resuming engines.

Cc: Andi Shyti <andi.shyti@intel.com>
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_pm.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

Comments

Andi Shyti Sept. 15, 2022, 9:34 p.m. UTC | #1
Hi Matt,

On Wed, Sep 14, 2022 at 03:04:25PM -0700, Matt Roper wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> Walk all GTs from i915_gem_resume when resuming engines.
> 
> Cc: Andi Shyti <andi.shyti@intel.com>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>

I had this (and others) in my multi-gt branch from a long time
but never had time to clean it up and send it. Thanks for taking
it.

Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>

Thanks,
Andi

> ---
>  drivers/gpu/drm/i915/gem/i915_gem_pm.c | 22 ++++++++++++++++++++--
>  1 file changed, 20 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_pm.c b/drivers/gpu/drm/i915/gem/i915_gem_pm.c
> index 3428f735e786..2c80cc8362b6 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_pm.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_pm.c
> @@ -212,7 +212,8 @@ int i915_gem_freeze_late(struct drm_i915_private *i915)
>  
>  void i915_gem_resume(struct drm_i915_private *i915)
>  {
> -	int ret;
> +	struct intel_gt *gt;
> +	int ret, i, j;
>  
>  	GEM_TRACE("%s\n", dev_name(i915->drm.dev));
>  
> @@ -224,8 +225,25 @@ void i915_gem_resume(struct drm_i915_private *i915)
>  	 * guarantee that the context image is complete. So let's just reset
>  	 * it and start again.
>  	 */
> -	intel_gt_resume(to_gt(i915));
> +	for_each_gt(gt, i915, i)
> +		if (intel_gt_resume(gt))
> +			goto err_wedged;
>  
>  	ret = lmem_restore(i915, I915_TTM_BACKUP_ALLOW_GPU);
>  	GEM_WARN_ON(ret);
> +
> +	return;
> +
> +err_wedged:
> +	for_each_gt(gt, i915, j) {
> +		if (!intel_gt_is_wedged(gt)) {
> +			dev_err(i915->drm.dev,
> +				"Failed to re-initialize GPU[%u], declaring it wedged!\n",
> +				j);
> +			intel_gt_set_wedged(gt);
> +		}
> +
> +		if (j == i)
> +			break;
> +	}
>  }
> -- 
> 2.37.3
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_pm.c b/drivers/gpu/drm/i915/gem/i915_gem_pm.c
index 3428f735e786..2c80cc8362b6 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_pm.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_pm.c
@@ -212,7 +212,8 @@  int i915_gem_freeze_late(struct drm_i915_private *i915)
 
 void i915_gem_resume(struct drm_i915_private *i915)
 {
-	int ret;
+	struct intel_gt *gt;
+	int ret, i, j;
 
 	GEM_TRACE("%s\n", dev_name(i915->drm.dev));
 
@@ -224,8 +225,25 @@  void i915_gem_resume(struct drm_i915_private *i915)
 	 * guarantee that the context image is complete. So let's just reset
 	 * it and start again.
 	 */
-	intel_gt_resume(to_gt(i915));
+	for_each_gt(gt, i915, i)
+		if (intel_gt_resume(gt))
+			goto err_wedged;
 
 	ret = lmem_restore(i915, I915_TTM_BACKUP_ALLOW_GPU);
 	GEM_WARN_ON(ret);
+
+	return;
+
+err_wedged:
+	for_each_gt(gt, i915, j) {
+		if (!intel_gt_is_wedged(gt)) {
+			dev_err(i915->drm.dev,
+				"Failed to re-initialize GPU[%u], declaring it wedged!\n",
+				j);
+			intel_gt_set_wedged(gt);
+		}
+
+		if (j == i)
+			break;
+	}
 }