Commit 7a7b94ad authored by Jimmy Rentz's avatar Jimmy Rentz Committed by Ben Skeggs

drm/nouveau: Fix a crash at card takedown for NV40 and older cards

NV40 and older cards (pre NV50) reserve a vram bo for the vga memory at
card init. This bo is then freed at card shutdown.  The problem is that
the ttm bo vram manager was already freed. So a crash occurs when the
vga bo is freed. The fix is to free the vga bo prior to freeing the ttm
bo vram manager. There might be other solutions but this seemed the
simplest to me.
Signed-off-by: default avatarJimmy Rentz <jb17bsome@gmail.com>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 8aeb96f8
...@@ -152,8 +152,6 @@ nouveau_mem_vram_fini(struct drm_device *dev) ...@@ -152,8 +152,6 @@ nouveau_mem_vram_fini(struct drm_device *dev)
{ {
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
nouveau_bo_ref(NULL, &dev_priv->vga_ram);
ttm_bo_device_release(&dev_priv->ttm.bdev); ttm_bo_device_release(&dev_priv->ttm.bdev);
nouveau_ttm_global_release(dev_priv); nouveau_ttm_global_release(dev_priv);
......
...@@ -768,6 +768,11 @@ static void nouveau_card_takedown(struct drm_device *dev) ...@@ -768,6 +768,11 @@ static void nouveau_card_takedown(struct drm_device *dev)
engine->mc.takedown(dev); engine->mc.takedown(dev);
engine->display.late_takedown(dev); engine->display.late_takedown(dev);
if (dev_priv->vga_ram) {
nouveau_bo_unpin(dev_priv->vga_ram);
nouveau_bo_ref(NULL, &dev_priv->vga_ram);
}
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
ttm_bo_clean_mm(&dev_priv->ttm.bdev, TTM_PL_VRAM); ttm_bo_clean_mm(&dev_priv->ttm.bdev, TTM_PL_VRAM);
ttm_bo_clean_mm(&dev_priv->ttm.bdev, TTM_PL_TT); ttm_bo_clean_mm(&dev_priv->ttm.bdev, TTM_PL_TT);
......
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