Lines Matching refs:job

106 int panfrost_job_get_slot(struct panfrost_job *job)
112 if (job->requirements & PANFROST_JD_REQ_FS)
117 if (job->requirements & PANFROST_JD_REQ_ONLY_COMPUTE) {
118 if ((job->requirements & PANFROST_JD_REQ_CORE_GRP_MASK) &&
119 (job->pfdev->features.nr_core_groups == 2))
121 if (panfrost_has_hw_issue(job->pfdev, HW_ISSUE_8987))
146 panfrost_get_job_chain_flag(const struct panfrost_job *job)
148 struct panfrost_fence *f = to_panfrost_fence(job->done_fence);
150 if (!panfrost_has_hw_feature(job->pfdev, HW_FEATURE_JOBCHAIN_DISAMBIGUATION))
159 struct panfrost_job *job = pfdev->jobs[slot][0];
161 WARN_ON(!job);
165 return job;
170 struct panfrost_job *job)
172 if (WARN_ON(!job))
176 pfdev->jobs[slot][0] = job;
181 pfdev->jobs[slot][1] = job;
182 WARN_ON(panfrost_get_job_chain_flag(job) ==
187 static void panfrost_job_hw_submit(struct panfrost_job *job, int js)
189 struct panfrost_device *pfdev = job->pfdev;
192 u64 jc_head = job->jc;
205 cfg = panfrost_mmu_as_get(pfdev, job->mmu);
210 panfrost_job_write_affinity(pfdev, job->requirements, js);
217 panfrost_get_job_chain_flag(job);
228 job_write(pfdev, JS_FLUSH_ID_NEXT(js), job->flush_id);
233 subslot = panfrost_enqueue_job(pfdev, js, job);
234 /* Don't queue the job if a reset is in progress */
239 job, js, subslot, jc_head, cfg & 0xf);
246 struct drm_sched_job *job)
256 ret = drm_sched_job_add_implicit_dependencies(job, bos[i],
275 int panfrost_job_push(struct panfrost_job *job)
277 struct panfrost_device *pfdev = job->pfdev;
281 ret = drm_gem_lock_reservations(job->bos, job->bo_count,
287 drm_sched_job_arm(&job->base);
289 job->render_done_fence = dma_fence_get(&job->base.s_fence->finished);
291 ret = panfrost_acquire_object_fences(job->bos, job->bo_count,
292 &job->base);
298 kref_get(&job->refcount); /* put by scheduler job completion */
300 drm_sched_entity_push_job(&job->base);
304 panfrost_attach_object_fences(job->bos, job->bo_count,
305 job->render_done_fence);
308 drm_gem_unlock_reservations(job->bos, job->bo_count, &acquire_ctx);
315 struct panfrost_job *job = container_of(ref, struct panfrost_job,
319 dma_fence_put(job->done_fence);
320 dma_fence_put(job->render_done_fence);
322 if (job->mappings) {
323 for (i = 0; i < job->bo_count; i++) {
324 if (!job->mappings[i])
327 atomic_dec(&job->mappings[i]->obj->gpu_usecount);
328 panfrost_gem_mapping_put(job->mappings[i]);
330 kvfree(job->mappings);
333 if (job->bos) {
334 for (i = 0; i < job->bo_count; i++)
335 drm_gem_object_put(job->bos[i]);
337 kvfree(job->bos);
340 kfree(job);
343 void panfrost_job_put(struct panfrost_job *job)
345 kref_put(&job->refcount, panfrost_job_cleanup);
350 struct panfrost_job *job = to_panfrost_job(sched_job);
354 panfrost_job_put(job);
359 struct panfrost_job *job = to_panfrost_job(sched_job);
360 struct panfrost_device *pfdev = job->pfdev;
361 int slot = panfrost_job_get_slot(job);
364 if (unlikely(job->base.s_fence->finished.error))
367 /* Nothing to execute: can happen if the job has finished while
370 if (!job->jc)
377 if (job->done_fence)
378 dma_fence_put(job->done_fence);
379 job->done_fence = dma_fence_get(fence);
381 panfrost_job_hw_submit(job, slot);
400 struct panfrost_job *job,
420 /* Update the job head so we can resume */
421 job->jc = job_read(pfdev, JS_TAIL_LO(js)) |
424 /* The job will be resumed, don't signal the fence */
428 dma_fence_set_error(job->done_fence, -ECANCELED);
429 job->jc = 0;
435 dma_fence_set_error(job->done_fence, -EINVAL);
436 job->jc = 0;
439 panfrost_mmu_as_put(pfdev, job->mmu);
443 dma_fence_signal_locked(job->done_fence);
454 struct panfrost_job *job)
456 /* Set ->jc to 0 to avoid re-submitting an already finished job (can
459 job->jc = 0;
460 panfrost_mmu_as_put(pfdev, job->mmu);
463 dma_fence_signal_locked(job->done_fence);
503 * is racy. If we only have one job done at the time we
504 * read JOB_INT_RAWSTAT but the second job fails before we
526 /* When the current job doesn't fail, the JM dequeues
527 * the next job without waiting for an ACK, this means
530 * are inactive, but one job remains in pfdev->jobs[j],
533 * job in _NEXT (see above).
556 /* The job was cancelled, signal the fence now */
562 /* Requeue the job we removed if no reset is pending */
619 * to release job resources. We should rework the code to follow this
636 /* Mask job interrupts and synchronize to make sure we won't be
643 /* Cancel the next job and soft-stop the running job. */
662 * panfrost_devfreq_record_idle() for each stuck job.
677 /* panfrost_device_reset() unmasks job interrupts, but we want to
688 * while resubmitting jobs because the job submission logic will
701 /* Re-enable job interrupts now that everything has been restarted. */
712 struct panfrost_job *job = to_panfrost_job(sched_job);
713 struct panfrost_device *pfdev = job->pfdev;
714 int js = panfrost_job_get_slot(job);
720 if (dma_fence_is_signaled(job->done_fence))
729 * job timeouts, synchronize the IRQ handler and re-check the fence
734 if (dma_fence_is_signaled(job->done_fence)) {
747 panfrost_core_dump(job);
799 * disambiguation stopping the right job in the close path is tricky,
812 js->irq = platform_get_irq_byname(to_platform_device(pfdev->dev), "job");
819 IRQF_SHARED, KBUILD_MODNAME "-job",
822 dev_err(pfdev->dev, "failed to request job irq");
905 struct panfrost_job *job = pfdev->jobs[i][j];
908 if (!job || job->base.entity != entity)
912 /* Try to cancel the job before it starts */
914 /* Reset the job head so it doesn't get restarted if
915 * the job in the first slot failed.
917 job->jc = 0;
921 cmd = panfrost_get_job_chain_flag(job) ?