drm/amd: add amd_sched_hw_job_reset
authorChunming Zhou <David1.Zhou@amd.com>
Thu, 30 Jun 2016 03:30:37 +0000 (11:30 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 7 Jul 2016 19:06:13 +0000 (15:06 -0400)
amd_sched_hw_job_reset will remove callback from hw fence.

Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
drivers/gpu/drm/amd/scheduler/gpu_scheduler.h

index 717655d0c642160226eb1ab69bb185b38e9852d7..cf2d64bef0dfda2705580c3ad7ccae7ef0243148 100644 (file)
@@ -381,6 +381,20 @@ static void amd_sched_job_timedout(struct work_struct *work)
        job->sched->ops->timedout_job(job);
 }
 
+void amd_sched_hw_job_reset(struct amd_gpu_scheduler *sched)
+{
+       struct amd_sched_job *s_job;
+
+       spin_lock(&sched->job_list_lock);
+       list_for_each_entry_reverse(s_job, &sched->ring_mirror_list, node) {
+               if (fence_remove_callback(s_job->s_fence->parent, &s_job->s_fence->cb)) {
+                       fence_put(s_job->s_fence->parent);
+                       s_job->s_fence->parent = NULL;
+               }
+       }
+       spin_unlock(&sched->job_list_lock);
+}
+
 /**
  * Submit a job to the job queue
  *
index 545fda73a05f10042187d394bae65dae7fda6ba7..fdcd8fbf5e266c5223231ba462e630b604b9545b 100644 (file)
@@ -153,4 +153,5 @@ int amd_sched_job_init(struct amd_sched_job *job,
                       struct amd_gpu_scheduler *sched,
                       struct amd_sched_entity *entity,
                       void *owner);
+void amd_sched_hw_job_reset(struct amd_gpu_scheduler *sched);
 #endif