diff mbox

[4/9] drm/i915: Do hw quiescing first during unload

Message ID 1384828358-31563-5-git-send-email-rodrigo.vivi@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Rodrigo Vivi Nov. 19, 2013, 2:32 a.m. UTC
From: Chris Wilson <chris@chris-wilson.co.uk>

If we force the hw to idle as our first step during unload, we can abort
the unload upon failure. Later we can probe whether the hardware remain
active even after we try to shut it down.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_dma.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

Rodrigo Vivi Nov. 19, 2013, 5:43 p.m. UTC | #1
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>

On Mon, Nov 18, 2013 at 6:32 PM, Rodrigo Vivi <rodrigo.vivi@gmail.com> wrote:
> From: Chris Wilson <chris@chris-wilson.co.uk>
>
> If we force the hw to idle as our first step during unload, we can abort
> the unload upon failure. Later we can probe whether the hardware remain
> active even after we try to shut it down.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/i915_dma.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
> index 0cab2d0..479abc0 100644
> --- a/drivers/gpu/drm/i915/i915_dma.c
> +++ b/drivers/gpu/drm/i915/i915_dma.c
> @@ -1704,6 +1704,12 @@ int i915_driver_unload(struct drm_device *dev)
>         struct drm_i915_private *dev_priv = dev->dev_private;
>         int ret;
>
> +       ret = i915_gem_suspend(dev);
> +       if (ret) {
> +               DRM_ERROR("failed to idle hardware: %d\n", ret);
> +               return ret;
> +       }
> +
>         intel_gpu_ips_teardown();
>
>         if (HAS_POWER_WELL(dev)) {
> @@ -1719,10 +1725,6 @@ int i915_driver_unload(struct drm_device *dev)
>         if (dev_priv->mm.inactive_shrinker.scan_objects)
>                 unregister_shrinker(&dev_priv->mm.inactive_shrinker);
>
> -       ret = i915_gem_suspend(dev);
> -       if (ret)
> -               DRM_ERROR("failed to idle hardware: %d\n", ret);
> -
>         io_mapping_free(dev_priv->gtt.mappable);
>         arch_phys_wc_del(dev_priv->gtt.mtrr);
>
> --
> 1.8.3.1
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 0cab2d0..479abc0 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1704,6 +1704,12 @@  int i915_driver_unload(struct drm_device *dev)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int ret;
 
+	ret = i915_gem_suspend(dev);
+	if (ret) {
+		DRM_ERROR("failed to idle hardware: %d\n", ret);
+		return ret;
+	}
+
 	intel_gpu_ips_teardown();
 
 	if (HAS_POWER_WELL(dev)) {
@@ -1719,10 +1725,6 @@  int i915_driver_unload(struct drm_device *dev)
 	if (dev_priv->mm.inactive_shrinker.scan_objects)
 		unregister_shrinker(&dev_priv->mm.inactive_shrinker);
 
-	ret = i915_gem_suspend(dev);
-	if (ret)
-		DRM_ERROR("failed to idle hardware: %d\n", ret);
-
 	io_mapping_free(dev_priv->gtt.mappable);
 	arch_phys_wc_del(dev_priv->gtt.mtrr);