@@ -994,9 +994,9 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
vmw_kms_close(dev_priv);
out_no_kms:
if (dev_priv->has_mob)
- (void) ttm_bo_clean_mm(&dev_priv->bdev, VMW_PL_MOB);
+ vmw_gmrid_man_takedown(dev_priv, VMW_PL_MOB);
if (dev_priv->has_gmr)
- (void) ttm_bo_clean_mm(&dev_priv->bdev, VMW_PL_GMR);
+ vmw_gmrid_man_takedown(dev_priv, VMW_PL_GMR);
vmw_takedown_vram_manager(dev_priv);
out_no_vram:
(void)ttm_bo_device_release(&dev_priv->bdev);
@@ -1045,12 +1045,12 @@ static void vmw_driver_unload(struct drm_device *dev)
vmw_overlay_close(dev_priv);
if (dev_priv->has_gmr)
- (void)ttm_bo_clean_mm(&dev_priv->bdev, VMW_PL_GMR);
- (void)ttm_bo_clean_mm(&dev_priv->bdev, TTM_PL_VRAM);
+ vmw_gmrid_man_takedown(dev_priv, VMW_PL_GMR);
+ vmw_takedown_vram_manager(dev_priv);
vmw_release_device_early(dev_priv);
if (dev_priv->has_mob)
- (void) ttm_bo_clean_mm(&dev_priv->bdev, VMW_PL_MOB);
+ vmw_gmrid_man_takedown(dev_priv, VMW_PL_MOB);
(void) ttm_bo_device_release(&dev_priv->bdev);
drm_vma_offset_manager_destroy(&dev_priv->vma_manager);
vmw_release_device_late(dev_priv);
@@ -1222,6 +1222,7 @@ int vmw_overlay_num_free_overlays(struct vmw_private *dev_priv);
*/
int vmw_gmrid_man_init(struct vmw_private *dev_priv, int type);
+void vmw_gmrid_man_takedown(struct vmw_private *dev_priv, int type);
/**
* Prime - vmwgfx_prime.c
@@ -131,16 +131,22 @@ int vmw_gmrid_man_init(struct vmw_private *dev_priv, int type)
return 0;
}
-static int vmw_gmrid_man_takedown(struct ttm_mem_type_manager *man)
+void vmw_gmrid_man_takedown(struct vmw_private *dev_priv, int type)
{
+ struct ttm_mem_type_manager *man = &dev_priv->bdev.man[type];
struct vmwgfx_gmrid_man *gman =
(struct vmwgfx_gmrid_man *)man->priv;
+ ttm_bo_disable_mm(man);
+
+ ttm_bo_force_list_clean(&dev_priv->bdev, man);
+
if (gman) {
ida_destroy(&gman->gmr_ida);
kfree(gman);
}
- return 0;
+
+ ttm_bo_man_cleanup(man);
}
static void vmw_gmrid_man_debug(struct ttm_mem_type_manager *man,
@@ -150,7 +156,6 @@ static void vmw_gmrid_man_debug(struct ttm_mem_type_manager *man,
}
static const struct ttm_mem_type_manager_func vmw_gmrid_manager_func = {
- .takedown = vmw_gmrid_man_takedown,
.get_node = vmw_gmrid_man_get_node,
.put_node = vmw_gmrid_man_put_node,
.debug = vmw_gmrid_man_debug