Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/drivers/accel/ivpu/ivpu_job.h
26428 views
1
/* SPDX-License-Identifier: GPL-2.0-only */
2
/*
3
* Copyright (C) 2020-2024 Intel Corporation
4
*/
5
6
#ifndef __IVPU_JOB_H__
7
#define __IVPU_JOB_H__
8
9
#include <linux/kref.h>
10
#include <linux/idr.h>
11
12
#include "ivpu_gem.h"
13
14
struct ivpu_device;
15
struct ivpu_file_priv;
16
17
/**
18
* struct ivpu_cmdq - Object representing device queue used to send jobs.
19
* @jobq: Pointer to job queue memory shared with the device
20
* @mem: Memory allocated for the job queue, shared with device
21
* @entry_count Number of job entries in the queue
22
* @db_id: Doorbell assigned to this job queue
23
* @db_registered: True if doorbell is registered in device
24
*/
25
struct ivpu_cmdq {
26
struct vpu_job_queue *jobq;
27
struct ivpu_bo *primary_preempt_buf;
28
struct ivpu_bo *secondary_preempt_buf;
29
struct ivpu_bo *mem;
30
u32 entry_count;
31
u32 id;
32
u32 db_id;
33
u8 priority;
34
bool is_legacy;
35
};
36
37
/**
38
* struct ivpu_job - KMD object that represents batchbuffer / DMA buffer.
39
* Each batch / DMA buffer is a job to be submitted and executed by the VPU FW.
40
* This is a unit of execution, and be tracked by the job_id for
41
* any status reporting from VPU FW through IPC JOB RET/DONE message.
42
* @file_priv: The client that submitted this job
43
* @job_id: Job ID for KMD tracking and job status reporting from VPU FW
44
* @status: Status of the Job from IPC JOB RET/DONE message
45
* @batch_buffer: CPU vaddr points to the batch buffer memory allocated for the job
46
* @submit_status_offset: Offset within batch buffer where job completion handler
47
will update the job status
48
*/
49
struct ivpu_job {
50
struct ivpu_device *vdev;
51
struct ivpu_file_priv *file_priv;
52
struct dma_fence *done_fence;
53
u64 cmd_buf_vpu_addr;
54
u32 cmdq_id;
55
u32 job_id;
56
u32 engine_idx;
57
size_t bo_count;
58
struct ivpu_bo *bos[] __counted_by(bo_count);
59
};
60
61
int ivpu_submit_ioctl(struct drm_device *dev, void *data, struct drm_file *file);
62
int ivpu_cmdq_create_ioctl(struct drm_device *dev, void *data, struct drm_file *file);
63
int ivpu_cmdq_destroy_ioctl(struct drm_device *dev, void *data, struct drm_file *file);
64
int ivpu_cmdq_submit_ioctl(struct drm_device *dev, void *data, struct drm_file *file);
65
66
void ivpu_context_abort_locked(struct ivpu_file_priv *file_priv);
67
68
void ivpu_cmdq_release_all_locked(struct ivpu_file_priv *file_priv);
69
void ivpu_cmdq_reset_all_contexts(struct ivpu_device *vdev);
70
void ivpu_cmdq_abort_all_jobs(struct ivpu_device *vdev, u32 ctx_id, u32 cmdq_id);
71
72
void ivpu_job_done_consumer_init(struct ivpu_device *vdev);
73
void ivpu_job_done_consumer_fini(struct ivpu_device *vdev);
74
void ivpu_context_abort_work_fn(struct work_struct *work);
75
76
void ivpu_jobs_abort_all(struct ivpu_device *vdev);
77
78
#endif /* __IVPU_JOB_H__ */
79
80