drm/ttm: partial revert "cleanup ttm_tt_(unbind|destroy)" v3
authorChristian König <christian.koenig@amd.com>
Thu, 21 Jul 2016 10:18:19 +0000 (12:18 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 29 Jul 2016 18:37:04 +0000 (14:37 -0400)
We still need to unbind explicitly during a move.

This partial reverts commit ff20caa0bcbfef9f7686f8d1868a3b990921afd6.

v2: remove unnecessary check and unused variable
v3: fix typo in commit message

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/ttm/ttm_bo_util.c
drivers/gpu/drm/ttm/ttm_tt.c
include/drm/ttm/ttm_bo_driver.h

index 4da0e784f9e7dd5851b24d5bfcfe8eac764d8f06..2df602a35f9291ce178a6634ad9d0531ff331df4 100644 (file)
@@ -53,6 +53,7 @@ int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
        int ret;
 
        if (old_mem->mem_type != TTM_PL_SYSTEM) {
+               ttm_tt_unbind(ttm);
                ttm_bo_free_old_node(bo);
                ttm_flag_masked(&old_mem->placement, TTM_PL_FLAG_SYSTEM,
                                TTM_PL_MASK_MEM);
index d28d4333dcce091fb36c6d6242b2328e8eb9f3e2..526e5a78eea5eba44370f5ee4ddd6a136f18e03d 100644 (file)
@@ -166,16 +166,10 @@ EXPORT_SYMBOL(ttm_tt_set_placement_caching);
 
 void ttm_tt_destroy(struct ttm_tt *ttm)
 {
-       int ret;
-
        if (ttm == NULL)
                return;
 
-       if (ttm->state == tt_bound) {
-               ret = ttm->func->unbind(ttm);
-               BUG_ON(ret);
-               ttm->state = tt_unbound;
-       }
+       ttm_tt_unbind(ttm);
 
        if (ttm->state == tt_unbound)
                ttm_tt_unpopulate(ttm);
@@ -255,6 +249,17 @@ void ttm_dma_tt_fini(struct ttm_dma_tt *ttm_dma)
 }
 EXPORT_SYMBOL(ttm_dma_tt_fini);
 
+void ttm_tt_unbind(struct ttm_tt *ttm)
+{
+       int ret;
+
+       if (ttm->state == tt_bound) {
+               ret = ttm->func->unbind(ttm);
+               BUG_ON(ret);
+               ttm->state = tt_unbound;
+       }
+}
+
 int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem)
 {
        int ret = 0;
index e2ebe6666e2beb7fc28d234341413140f67fcfba..4348d6d5877a213b95c4b4e546287c9032b44a1a 100644 (file)
@@ -627,6 +627,15 @@ extern int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem);
  */
 extern void ttm_tt_destroy(struct ttm_tt *ttm);
 
+/**
+ * ttm_ttm_unbind:
+ *
+ * @ttm: The struct ttm_tt.
+ *
+ * Unbind a struct ttm_tt.
+ */
+extern void ttm_tt_unbind(struct ttm_tt *ttm);
+
 /**
  * ttm_tt_swapin:
  *