General idea is to try and access scheduler data structures less from the drivers so the series basically adds some helpers to move closer towards that goal. Three copies of the same to_drm_sched_job macro get removed and by the end of the series, as a bonus, we can now re-order members of struct drm_sched_job and eliminate a hole. I did not here from folks on which direction we want to take this after v1 so I went ahead and sketched up a different flavour in v2. The drm_sched_cancel_all_jobs() helper can be removed if (or when) amdgpu can change the approach of implementing its permanently wedged state. But until then I see no harm to clean up that, and even more so the to_drm_sched_job and its hidden dependency on queue_node being the first element. v2: * Add header file for internal scheduler API. * Add helper for peeking too. (Danilo) * Add (temporary?) drm_sched_cancel_all_jobs() helper to replace amdgpu amdgpu_job_stop_all_jobs_on_sched(). Cc: Christian König <christian.koenig@xxxxxxx> Cc: Danilo Krummrich <dakr@xxxxxxxxxx> Cc: Matthew Brost <matthew.brost@xxxxxxxxx> Cc: Philipp Stanner <phasta@xxxxxxxxxx> Tvrtko Ursulin (4): drm/scheduler: Add drm_sched_cancel_all_jobs helper drm/amdgpu: Use drm_sched_cancel_all_jobs helper drm/sched: Add internal job peek/pop API drm/sched: Make the type of drm_sched_job->last_dependency consistent drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 34 --------------- drivers/gpu/drm/amd/amdgpu/amdgpu_job.h | 2 - drivers/gpu/drm/scheduler/sched_entity.c | 11 +++-- drivers/gpu/drm/scheduler/sched_internal.h | 43 ++++++++++++++++++ drivers/gpu/drm/scheduler/sched_main.c | 51 ++++++++++++++++++++-- include/drm/gpu_scheduler.h | 39 +++++++++-------- 7 files changed, 118 insertions(+), 65 deletions(-) create mode 100644 drivers/gpu/drm/scheduler/sched_internal.h -- 2.48.0