aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo.c32
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo_manager.c10
-rw-r--r--include/drm/ttm/ttm_bo_driver.h2
3 files changed, 6 insertions, 38 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 9f2eed520fc..4a73f401644 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -434,36 +434,25 @@ out_err:
434} 434}
435 435
436/** 436/**
437 * Call bo::reserved and with the lru lock held. 437 * Call bo::reserved.
438 * Will release GPU memory type usage on destruction. 438 * Will release GPU memory type usage on destruction.
439 * This is the place to put in driver specific hooks. 439 * This is the place to put in driver specific hooks to release
440 * Will release the bo::reserved lock and the 440 * driver private resources.
441 * lru lock on exit. 441 * Will release the bo::reserved lock.
442 */ 442 */
443 443
444static void ttm_bo_cleanup_memtype_use(struct ttm_buffer_object *bo) 444static void ttm_bo_cleanup_memtype_use(struct ttm_buffer_object *bo)
445{ 445{
446 struct ttm_bo_global *glob = bo->glob;
447
448 if (bo->ttm) { 446 if (bo->ttm) {
449
450 /**
451 * Release the lru_lock, since we don't want to have
452 * an atomic requirement on ttm_tt[unbind|destroy].
453 */
454
455 spin_unlock(&glob->lru_lock);
456 ttm_tt_unbind(bo->ttm); 447 ttm_tt_unbind(bo->ttm);
457 ttm_tt_destroy(bo->ttm); 448 ttm_tt_destroy(bo->ttm);
458 bo->ttm = NULL; 449 bo->ttm = NULL;
459 spin_lock(&glob->lru_lock);
460 } 450 }
461 451
462 ttm_bo_mem_put_locked(bo, &bo->mem); 452 ttm_bo_mem_put(bo, &bo->mem);
463 453
464 atomic_set(&bo->reserved, 0); 454 atomic_set(&bo->reserved, 0);
465 wake_up_all(&bo->event_queue); 455 wake_up_all(&bo->event_queue);
466 spin_unlock(&glob->lru_lock);
467} 456}
468 457
469 458
@@ -528,7 +517,7 @@ retry:
528 list_del_init(&bo->ddestroy); 517 list_del_init(&bo->ddestroy);
529 ++put_count; 518 ++put_count;
530 } 519 }
531 520 spin_unlock(&glob->lru_lock);
532 ttm_bo_cleanup_memtype_use(bo); 521 ttm_bo_cleanup_memtype_use(bo);
533 522
534 while (put_count--) 523 while (put_count--)
@@ -784,15 +773,6 @@ void ttm_bo_mem_put(struct ttm_buffer_object *bo, struct ttm_mem_reg *mem)
784} 773}
785EXPORT_SYMBOL(ttm_bo_mem_put); 774EXPORT_SYMBOL(ttm_bo_mem_put);
786 775
787void ttm_bo_mem_put_locked(struct ttm_buffer_object *bo, struct ttm_mem_reg *mem)
788{
789 struct ttm_mem_type_manager *man = &bo->bdev->man[mem->mem_type];
790
791 if (mem->mm_node)
792 (*man->func->put_node_locked)(man, mem);
793}
794EXPORT_SYMBOL(ttm_bo_mem_put_locked);
795
796/** 776/**
797 * Repeatedly evict memory from the LRU for @mem_type until we create enough 777 * Repeatedly evict memory from the LRU for @mem_type until we create enough
798 * space, or we've evicted everything and there isn't enough space. 778 * space, or we've evicted everything and there isn't enough space.
diff --git a/drivers/gpu/drm/ttm/ttm_bo_manager.c b/drivers/gpu/drm/ttm/ttm_bo_manager.c
index 35c97b20bda..7410c190c89 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_manager.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_manager.c
@@ -90,15 +90,6 @@ static void ttm_bo_man_put_node(struct ttm_mem_type_manager *man,
90 } 90 }
91} 91}
92 92
93static void ttm_bo_man_put_node_locked(struct ttm_mem_type_manager *man,
94 struct ttm_mem_reg *mem)
95{
96 if (mem->mm_node) {
97 drm_mm_put_block(mem->mm_node);
98 mem->mm_node = NULL;
99 }
100}
101
102static int ttm_bo_man_init(struct ttm_mem_type_manager *man, 93static int ttm_bo_man_init(struct ttm_mem_type_manager *man,
103 unsigned long p_size) 94 unsigned long p_size)
104{ 95{
@@ -152,7 +143,6 @@ const struct ttm_mem_type_manager_func ttm_bo_manager_func = {
152 ttm_bo_man_takedown, 143 ttm_bo_man_takedown,
153 ttm_bo_man_get_node, 144 ttm_bo_man_get_node,
154 ttm_bo_man_put_node, 145 ttm_bo_man_put_node,
155 ttm_bo_man_put_node_locked,
156 ttm_bo_man_debug 146 ttm_bo_man_debug
157}; 147};
158EXPORT_SYMBOL(ttm_bo_manager_func); 148EXPORT_SYMBOL(ttm_bo_manager_func);
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index d0ff529fedd..d01b4ddbdc5 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -214,8 +214,6 @@ struct ttm_mem_type_manager_func {
214 struct ttm_mem_reg *mem); 214 struct ttm_mem_reg *mem);
215 void (*put_node)(struct ttm_mem_type_manager *man, 215 void (*put_node)(struct ttm_mem_type_manager *man,
216 struct ttm_mem_reg *mem); 216 struct ttm_mem_reg *mem);
217 void (*put_node_locked)(struct ttm_mem_type_manager *man,
218 struct ttm_mem_reg *mem);
219 void (*debug)(struct ttm_mem_type_manager *man, const char *prefix); 217 void (*debug)(struct ttm_mem_type_manager *man, const char *prefix);
220}; 218};
221 219