From 2f4b9400336effee61cbf7f55b7dc35a39096ae1 Mon Sep 17 00:00:00 2001
From: Chunming Zhou <David1.Zhou@amd.com>
Date: Fri, 15 Jan 2016 11:05:21 +0800
Subject: drm/amdgpu: clean up hw semaphore support in driver

No longer used.

Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
Reviewed-by: Ken Wang  <Qingqing.Wang@amd.com>
Reviewed-by: Monk Liu <monk.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 64 ++------------------------------
 1 file changed, 4 insertions(+), 60 deletions(-)

(limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c')

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
index 181ce39ef5e5..a6fee511aab5 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
@@ -48,9 +48,6 @@ void amdgpu_sync_create(struct amdgpu_sync *sync)
 {
 	unsigned i;
 
-	for (i = 0; i < AMDGPU_NUM_SYNCS; ++i)
-		sync->semaphores[i] = NULL;
-
 	for (i = 0; i < AMDGPU_MAX_RINGS; ++i)
 		sync->sync_to[i] = NULL;
 
@@ -153,13 +150,13 @@ static void *amdgpu_sync_get_owner(struct fence *f)
 }
 
 /**
- * amdgpu_sync_resv - use the semaphores to sync to a reservation object
+ * amdgpu_sync_resv - sync to a reservation object
  *
  * @sync: sync object to add fences from reservation object to
  * @resv: reservation object with embedded fence
  * @shared: true if we should only sync to the exclusive fence
  *
- * Sync to the fence using the semaphore objects
+ * Sync to the fence
  */
 int amdgpu_sync_resv(struct amdgpu_device *adev,
 		     struct amdgpu_sync *sync,
@@ -250,9 +247,6 @@ int amdgpu_sync_wait(struct amdgpu_sync *sync)
 		kfree(e);
 	}
 
-	if (amdgpu_enable_semaphores)
-		return 0;
-
 	for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
 		struct fence *fence = sync->sync_to[i];
 		if (!fence)
@@ -279,12 +273,10 @@ int amdgpu_sync_rings(struct amdgpu_sync *sync,
 		      struct amdgpu_ring *ring)
 {
 	struct amdgpu_device *adev = ring->adev;
-	unsigned count = 0;
 	int i, r;
 
 	for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
 		struct amdgpu_ring *other = adev->rings[i];
-		struct amdgpu_semaphore *semaphore;
 		struct amdgpu_fence *fence;
 
 		if (!sync->sync_to[i])
@@ -292,64 +284,19 @@ int amdgpu_sync_rings(struct amdgpu_sync *sync,
 
 		fence = to_amdgpu_fence(sync->sync_to[i]);
 
-		/* check if we really need to sync */
-		if (!amdgpu_enable_scheduler &&
-		    !amdgpu_fence_need_sync(fence, ring))
-			continue;
-
 		/* prevent GPU deadlocks */
 		if (!other->ready) {
 			dev_err(adev->dev, "Syncing to a disabled ring!");
 			return -EINVAL;
 		}
 
-		if (amdgpu_enable_scheduler || !amdgpu_enable_semaphores) {
+		if (amdgpu_enable_scheduler) {
 			r = fence_wait(sync->sync_to[i], true);
 			if (r)
 				return r;
 			continue;
 		}
 
-		if (count >= AMDGPU_NUM_SYNCS) {
-			/* not enough room, wait manually */
-			r = fence_wait(&fence->base, false);
-			if (r)
-				return r;
-			continue;
-		}
-		r = amdgpu_semaphore_create(adev, &semaphore);
-		if (r)
-			return r;
-
-		sync->semaphores[count++] = semaphore;
-
-		/* allocate enough space for sync command */
-		r = amdgpu_ring_alloc(other, 16);
-		if (r)
-			return r;
-
-		/* emit the signal semaphore */
-		if (!amdgpu_semaphore_emit_signal(other, semaphore)) {
-			/* signaling wasn't successful wait manually */
-			amdgpu_ring_undo(other);
-			r = fence_wait(&fence->base, false);
-			if (r)
-				return r;
-			continue;
-		}
-
-		/* we assume caller has already allocated space on waiters ring */
-		if (!amdgpu_semaphore_emit_wait(ring, semaphore)) {
-			/* waiting wasn't successful wait manually */
-			amdgpu_ring_undo(other);
-			r = fence_wait(&fence->base, false);
-			if (r)
-				return r;
-			continue;
-		}
-
-		amdgpu_ring_commit(other);
-		amdgpu_fence_note_sync(fence, ring);
 	}
 
 	return 0;
@@ -362,7 +309,7 @@ int amdgpu_sync_rings(struct amdgpu_sync *sync,
  * @sync: sync object to use
  * @fence: fence to use for the free
  *
- * Free the sync object by freeing all semaphores in it.
+ * Free the sync object.
  */
 void amdgpu_sync_free(struct amdgpu_device *adev,
 		      struct amdgpu_sync *sync,
@@ -378,9 +325,6 @@ void amdgpu_sync_free(struct amdgpu_device *adev,
 		kfree(e);
 	}
 
-	for (i = 0; i < AMDGPU_NUM_SYNCS; ++i)
-		amdgpu_semaphore_free(adev, &sync->semaphores[i], fence);
-
 	for (i = 0; i < AMDGPU_MAX_RINGS; ++i)
 		fence_put(sync->sync_to[i]);
 
-- 
cgit v1.2.3