Commit c911fc1c authored by Daniel Vetter's avatar Daniel Vetter Committed by Chris Wilson

drm/i915: unload: ensure that gem is idle

When the module unloads, all users should be gone, hence all bo references
held by userspace, too. This should already result in an idle ringbuffer.
Still, be paranoid and idle gem before starting the unload dance.

Also kill the call to i915_gem_lastclose under an if (kms), it's a noop
for kms.
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
parent 67e77c5a
...@@ -2249,11 +2249,18 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) ...@@ -2249,11 +2249,18 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
int i915_driver_unload(struct drm_device *dev) int i915_driver_unload(struct drm_device *dev)
{ {
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int ret;
spin_lock(&mchdev_lock); spin_lock(&mchdev_lock);
i915_mch_dev = NULL; i915_mch_dev = NULL;
spin_unlock(&mchdev_lock); spin_unlock(&mchdev_lock);
mutex_lock(&dev->struct_mutex);
ret = i915_gpu_idle(dev);
if (ret)
DRM_ERROR("failed to idle hardware: %d\n", ret);
mutex_unlock(&dev->struct_mutex);
io_mapping_free(dev_priv->mm.gtt_mapping); io_mapping_free(dev_priv->mm.gtt_mapping);
if (dev_priv->mm.gtt_mtrr >= 0) { if (dev_priv->mm.gtt_mtrr >= 0) {
mtrr_del(dev_priv->mm.gtt_mtrr, dev->agp->base, mtrr_del(dev_priv->mm.gtt_mtrr, dev->agp->base,
...@@ -2303,7 +2310,6 @@ int i915_driver_unload(struct drm_device *dev) ...@@ -2303,7 +2310,6 @@ int i915_driver_unload(struct drm_device *dev)
if (I915_HAS_FBC(dev) && i915_powersave) if (I915_HAS_FBC(dev) && i915_powersave)
i915_cleanup_compression(dev); i915_cleanup_compression(dev);
drm_mm_takedown(&dev_priv->vram); drm_mm_takedown(&dev_priv->vram);
i915_gem_lastclose(dev);
intel_cleanup_overlay(dev); intel_cleanup_overlay(dev);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment