Change-Id: I51307ed2fe76de7430f69e70cb859e21cbe236b3 Signed-off-by: Chunming Zhou <David1.Zhou at amd.com> --- drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 8 +++++++- drivers/gpu/drm/amd/scheduler/gpu_scheduler.h | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c index 71b5f1a..33640ca 100644 --- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c @@ -219,6 +219,12 @@ static bool amd_sched_entity_is_ready(struct amd_sched_entity *entity) return true; } +void amd_sched_entity_wait_idle(struct amd_gpu_scheduler *sched, + struct amd_sched_entity *entity) +{ + wait_event(sched->job_scheduled, amd_sched_entity_is_idle(entity)); +} + /** * Destroy a context entity * @@ -239,7 +245,7 @@ void amd_sched_entity_fini(struct amd_gpu_scheduler *sched, * The client will not queue more IBs during this fini, consume existing * queued IBs */ - wait_event(sched->job_scheduled, amd_sched_entity_is_idle(entity)); + amd_sched_entity_wait_idle(sched, entity); amd_sched_rq_remove_entity(rq, entity); kfifo_free(&entity->job_queue); diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h index a1c0073..a133fb7 100644 --- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h +++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h @@ -146,6 +146,8 @@ int amd_sched_entity_init(struct amd_gpu_scheduler *sched, void amd_sched_entity_fini(struct amd_gpu_scheduler *sched, struct amd_sched_entity *entity); void amd_sched_entity_push_job(struct amd_sched_job *sched_job); +void amd_sched_entity_wait_idle(struct amd_gpu_scheduler *sched, + struct amd_sched_entity *entity); struct amd_sched_fence *amd_sched_fence_create( struct amd_sched_entity *s_entity, void *owner); -- 1.9.1