From: Christian König <[email protected]>

Instead of moving them in the MMU notifier move them during CS.

Signed-off-by: Christian König <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 6 ++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c | 5 -----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index 19c5649..aa45e25f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -472,6 +472,12 @@ static int amdgpu_cs_list_validate(struct amdgpu_cs_parser 
*p,
                /* Check if we have user pages and nobody bound the BO already 
*/
                if (amdgpu_ttm_tt_userptr_needs_pages(bo->tbo.ttm) &&
                    lobj->user_pages) {
+                       amdgpu_ttm_placement_from_domain(bo,
+                                                        AMDGPU_GEM_DOMAIN_CPU);
+                       r = ttm_bo_validate(&bo->tbo, &bo->placement, true,
+                                           false);
+                       if (r)
+                               return r;
                        amdgpu_ttm_tt_set_user_pages(bo->tbo.ttm,
                                                     lobj->user_pages);
                        binding_userptr = true;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
index 6558a3e..47800e4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
@@ -137,11 +137,6 @@ static void amdgpu_mn_invalidate_node(struct 
amdgpu_mn_node *node,
                if (r <= 0)
                        DRM_ERROR("(%ld) failed to wait for user bo\n", r);
 
-               amdgpu_ttm_placement_from_domain(bo, AMDGPU_GEM_DOMAIN_CPU);
-               r = ttm_bo_validate(&bo->tbo, &bo->placement, false, false);
-               if (r)
-                       DRM_ERROR("(%ld) failed to validate user bo\n", r);
-
                amdgpu_bo_unreserve(bo);
        }
 }
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to