xref: /linux/drivers/gpu/drm/panthor/panthor_sched.h (revision daa2be74b1b2302004945b2a5e32424e177cc7da)
1 /* SPDX-License-Identifier: GPL-2.0 or MIT */
2 /* Copyright 2023 Collabora ltd. */
3 
4 #ifndef __PANTHOR_SCHED_H__
5 #define __PANTHOR_SCHED_H__
6 
7 struct drm_exec;
8 struct dma_fence;
9 struct drm_file;
10 struct drm_gem_object;
11 struct drm_sched_job;
12 struct drm_panthor_group_create;
13 struct drm_panthor_queue_create;
14 struct drm_panthor_group_get_state;
15 struct drm_panthor_queue_submit;
16 struct panthor_device;
17 struct panthor_file;
18 struct panthor_group_pool;
19 struct panthor_job;
20 
21 int panthor_group_create(struct panthor_file *pfile,
22 			 const struct drm_panthor_group_create *group_args,
23 			 const struct drm_panthor_queue_create *queue_args);
24 int panthor_group_destroy(struct panthor_file *pfile, u32 group_handle);
25 int panthor_group_get_state(struct panthor_file *pfile,
26 			    struct drm_panthor_group_get_state *get_state);
27 
28 struct drm_sched_job *
29 panthor_job_create(struct panthor_file *pfile,
30 		   u16 group_handle,
31 		   const struct drm_panthor_queue_submit *qsubmit);
32 struct drm_sched_job *panthor_job_get(struct drm_sched_job *job);
33 struct panthor_vm *panthor_job_vm(struct drm_sched_job *sched_job);
34 void panthor_job_put(struct drm_sched_job *job);
35 void panthor_job_update_resvs(struct drm_exec *exec, struct drm_sched_job *job);
36 
37 int panthor_group_pool_create(struct panthor_file *pfile);
38 void panthor_group_pool_destroy(struct panthor_file *pfile);
39 
40 int panthor_sched_init(struct panthor_device *ptdev);
41 void panthor_sched_unplug(struct panthor_device *ptdev);
42 void panthor_sched_pre_reset(struct panthor_device *ptdev);
43 void panthor_sched_post_reset(struct panthor_device *ptdev, bool reset_failed);
44 void panthor_sched_suspend(struct panthor_device *ptdev);
45 void panthor_sched_resume(struct panthor_device *ptdev);
46 
47 void panthor_sched_report_mmu_fault(struct panthor_device *ptdev);
48 void panthor_sched_report_fw_events(struct panthor_device *ptdev, u32 events);
49 
50 #endif
51