public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH 1/4] drm/i915: fix module unload after context merge
@ 2012-06-19 14:52 Daniel Vetter
  2012-06-19 14:52 ` [PATCH 2/4] drm/i915: initialize the context idr unconditionally Daniel Vetter
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Daniel Vetter @ 2012-06-19 14:52 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter, Ben Widawsky

commit 8e96d9c4d9843f00ebeb4a9b33596d96602ea101
Author: Ben Widawsky <ben@bwidawsk.net>
Date:   Mon Jun 4 14:42:56 2012 -0700

    drm/i915: reset the GPU on context fini

broke module unload because it reset the gpu before we've stopped
touching it. Later on in the unload sequence the ringbuffer code
complained that the gpu would idle properly (because intel_gpu_reset
only resets the hw and not our sw state).

Hence we need to reset the gpu hw as the very last thing before we
unmap the register mmio space.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=51183
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/i915_dma.c         |    7 +++++++
 drivers/gpu/drm/i915/i915_gem_context.c |    2 --
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index f1544c5..a47ed44 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1731,6 +1731,13 @@ int i915_driver_unload(struct drm_device *dev)
 			i915_free_hws(dev);
 	}
 
+
+	/* The only known way to stop the gpu from accessing the hw context is
+	 * to reset it. Do this as the very last operation to avoid confusing
+	 * other code, leading to spurious errors. */
+	if (!dev_priv->hw_contexts_disabled)
+		intel_gpu_reset(dev);
+
 	if (dev_priv->regs != NULL)
 		pci_iounmap(dev->pdev, dev_priv->regs);
 
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index 8fb8cd8..693718b 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -280,8 +280,6 @@ void i915_gem_context_fini(struct drm_device *dev)
 	i915_gem_object_unpin(dev_priv->ring[RCS].default_context->obj);
 
 	do_destroy(dev_priv->ring[RCS].default_context);
-
-	intel_gpu_reset(dev);
 }
 
 void i915_gem_context_open(struct drm_device *dev, struct drm_file *file)
-- 
1.7.10

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-06-19 21:19 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-19 14:52 [PATCH 1/4] drm/i915: fix module unload after context merge Daniel Vetter
2012-06-19 14:52 ` [PATCH 2/4] drm/i915: initialize the context idr unconditionally Daniel Vetter
2012-06-19 17:43   ` Ben Widawsky
2012-06-19 14:52 ` [PATCH 3/4] drm/i915: return -ENOENT if the context doesn't exist Daniel Vetter
2012-06-19 16:19   ` Ben Widawsky
2012-06-19 16:27     ` Daniel Vetter
2012-06-19 14:52 ` [PATCH 4/4] drm/i915/context: shut up compiler Daniel Vetter
2012-06-19 16:16   ` Ben Widawsky
2012-06-19 17:32 ` [PATCH 1/4] drm/i915: fix module unload after context merge Ben Widawsky
2012-06-19 19:55   ` [PATCH] " Daniel Vetter
2012-06-19 21:19     ` Ben Widawsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox