Lines Matching refs:job
37 struct amdgpu_job *job = to_amdgpu_job(s_job); in amdgpu_job_timedout() local
55 amdgpu_ring_soft_recovery(ring, job->vmid, s_job->s_fence->parent)) { in amdgpu_job_timedout()
61 amdgpu_vm_get_task_info(ring->adev, job->pasid, &ti); in amdgpu_job_timedout()
63 job->base.sched->name, atomic_read(&ring->fence_drv.last_seq), in amdgpu_job_timedout()
76 r = amdgpu_device_gpu_recover(ring->adev, job, &reset_context); in amdgpu_job_timedout()
93 unsigned int num_ibs, struct amdgpu_job **job) in amdgpu_job_alloc() argument
98 *job = kzalloc(struct_size(*job, ibs, num_ibs), GFP_KERNEL); in amdgpu_job_alloc()
99 if (!*job) in amdgpu_job_alloc()
106 (*job)->base.sched = &adev->rings[0]->sched; in amdgpu_job_alloc()
107 (*job)->vm = vm; in amdgpu_job_alloc()
109 amdgpu_sync_create(&(*job)->explicit_sync); in amdgpu_job_alloc()
110 (*job)->vram_lost_counter = atomic_read(&adev->vram_lost_counter); in amdgpu_job_alloc()
111 (*job)->vm_pd_addr = AMDGPU_BO_INVALID_OFFSET; in amdgpu_job_alloc()
116 return drm_sched_job_init(&(*job)->base, entity, owner); in amdgpu_job_alloc()
122 struct amdgpu_job **job) in amdgpu_job_alloc_with_ib() argument
126 r = amdgpu_job_alloc(adev, NULL, entity, owner, 1, job); in amdgpu_job_alloc_with_ib()
130 (*job)->num_ibs = 1; in amdgpu_job_alloc_with_ib()
131 r = amdgpu_ib_get(adev, NULL, size, pool_type, &(*job)->ibs[0]); in amdgpu_job_alloc_with_ib()
134 drm_sched_job_cleanup(&(*job)->base); in amdgpu_job_alloc_with_ib()
135 kfree(*job); in amdgpu_job_alloc_with_ib()
141 void amdgpu_job_set_resources(struct amdgpu_job *job, struct amdgpu_bo *gds, in amdgpu_job_set_resources() argument
145 job->gds_base = amdgpu_bo_gpu_offset(gds) >> PAGE_SHIFT; in amdgpu_job_set_resources()
146 job->gds_size = amdgpu_bo_size(gds) >> PAGE_SHIFT; in amdgpu_job_set_resources()
149 job->gws_base = amdgpu_bo_gpu_offset(gws) >> PAGE_SHIFT; in amdgpu_job_set_resources()
150 job->gws_size = amdgpu_bo_size(gws) >> PAGE_SHIFT; in amdgpu_job_set_resources()
153 job->oa_base = amdgpu_bo_gpu_offset(oa) >> PAGE_SHIFT; in amdgpu_job_set_resources()
154 job->oa_size = amdgpu_bo_size(oa) >> PAGE_SHIFT; in amdgpu_job_set_resources()
158 void amdgpu_job_free_resources(struct amdgpu_job *job) in amdgpu_job_free_resources() argument
160 struct amdgpu_ring *ring = to_amdgpu_ring(job->base.sched); in amdgpu_job_free_resources()
165 if (job->base.s_fence && job->base.s_fence->finished.ops) in amdgpu_job_free_resources()
166 f = &job->base.s_fence->finished; in amdgpu_job_free_resources()
167 else if (job->hw_fence.ops) in amdgpu_job_free_resources()
168 f = &job->hw_fence; in amdgpu_job_free_resources()
172 for (i = 0; i < job->num_ibs; ++i) in amdgpu_job_free_resources()
173 amdgpu_ib_free(ring->adev, &job->ibs[i], f); in amdgpu_job_free_resources()
178 struct amdgpu_job *job = to_amdgpu_job(s_job); in amdgpu_job_free_cb() local
182 amdgpu_sync_free(&job->explicit_sync); in amdgpu_job_free_cb()
185 if (!job->hw_fence.ops) in amdgpu_job_free_cb()
186 kfree(job); in amdgpu_job_free_cb()
188 dma_fence_put(&job->hw_fence); in amdgpu_job_free_cb()
191 void amdgpu_job_set_gang_leader(struct amdgpu_job *job, in amdgpu_job_set_gang_leader() argument
196 WARN_ON(job->gang_submit); in amdgpu_job_set_gang_leader()
202 if (job != leader) in amdgpu_job_set_gang_leader()
204 job->gang_submit = fence; in amdgpu_job_set_gang_leader()
207 void amdgpu_job_free(struct amdgpu_job *job) in amdgpu_job_free() argument
209 if (job->base.entity) in amdgpu_job_free()
210 drm_sched_job_cleanup(&job->base); in amdgpu_job_free()
212 amdgpu_job_free_resources(job); in amdgpu_job_free()
213 amdgpu_sync_free(&job->explicit_sync); in amdgpu_job_free()
214 if (job->gang_submit != &job->base.s_fence->scheduled) in amdgpu_job_free()
215 dma_fence_put(job->gang_submit); in amdgpu_job_free()
217 if (!job->hw_fence.ops) in amdgpu_job_free()
218 kfree(job); in amdgpu_job_free()
220 dma_fence_put(&job->hw_fence); in amdgpu_job_free()
223 struct dma_fence *amdgpu_job_submit(struct amdgpu_job *job) in amdgpu_job_submit() argument
227 drm_sched_job_arm(&job->base); in amdgpu_job_submit()
228 f = dma_fence_get(&job->base.s_fence->finished); in amdgpu_job_submit()
229 amdgpu_job_free_resources(job); in amdgpu_job_submit()
230 drm_sched_entity_push_job(&job->base); in amdgpu_job_submit()
235 int amdgpu_job_submit_direct(struct amdgpu_job *job, struct amdgpu_ring *ring, in amdgpu_job_submit_direct() argument
240 job->base.sched = &ring->sched; in amdgpu_job_submit_direct()
241 r = amdgpu_ib_schedule(ring, job->num_ibs, job->ibs, job, fence); in amdgpu_job_submit_direct()
246 amdgpu_job_free(job); in amdgpu_job_submit_direct()
255 struct amdgpu_job *job = to_amdgpu_job(sched_job); in amdgpu_job_prepare_job() local
259 if (!fence && job->gang_submit) in amdgpu_job_prepare_job()
260 fence = amdgpu_device_switch_gang(ring->adev, job->gang_submit); in amdgpu_job_prepare_job()
262 while (!fence && job->vm && !job->vmid) { in amdgpu_job_prepare_job()
263 r = amdgpu_vmid_grab(job->vm, ring, job, &fence); in amdgpu_job_prepare_job()
276 struct amdgpu_job *job; in amdgpu_job_run() local
279 job = to_amdgpu_job(sched_job); in amdgpu_job_run()
280 finished = &job->base.s_fence->finished; in amdgpu_job_run()
282 trace_amdgpu_sched_run_job(job); in amdgpu_job_run()
285 if (job->vram_lost_counter != atomic_read(&adev->vram_lost_counter) || in amdgpu_job_run()
286 (job->job_run_counter && job->gang_submit)) in amdgpu_job_run()
292 r = amdgpu_ib_schedule(ring, job->num_ibs, job->ibs, job, in amdgpu_job_run()
298 job->job_run_counter++; in amdgpu_job_run()
299 amdgpu_job_free_resources(job); in amdgpu_job_run()