drm/amdgpu: fix syncing to VM updates
authorChristian König <christian.koenig@amd.com>
Mon, 27 Jul 2015 13:40:35 +0000 (15:40 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 17 Aug 2015 20:50:40 +0000 (16:50 -0400)
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c

index 105a3b51517442fa18b9f7d673e07007c506c55d..2c42f50912b98f7f3305528888f9eb248641b04b 100644 (file)
@@ -122,11 +122,24 @@ int amdgpu_sync_resv(struct amdgpu_device *adev,
                f = rcu_dereference_protected(flist->shared[i],
                                              reservation_object_held(resv));
                fence = f ? to_amdgpu_fence(f) : NULL;
-               if (fence && fence->ring->adev == adev &&
-                   fence->owner == owner &&
-                   fence->owner != AMDGPU_FENCE_OWNER_UNDEFINED)
+               if (fence && fence->ring->adev == adev) {
+                       /* VM updates are only interesting
+                        * for other VM updates and moves.
+                        */
+                       if ((owner != AMDGPU_FENCE_OWNER_MOVE) &&
+                           (fence->owner != AMDGPU_FENCE_OWNER_MOVE) &&
+                           ((owner == AMDGPU_FENCE_OWNER_VM) !=
+                            (fence->owner == AMDGPU_FENCE_OWNER_VM)))
                                continue;
 
+                       /* Ignore fence from the same owner as
+                        * long as it isn't undefined.
+                        */
+                       if (owner != AMDGPU_FENCE_OWNER_UNDEFINED &&
+                           fence->owner == owner)
+                               continue;
+               }
+
                r = amdgpu_sync_fence(adev, sync, f);
                if (r)
                        break;