1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2014-2019 Intel Corporation
4  */
5 
6 #ifndef _INTEL_GUC_SUBMISSION_H_
7 #define _INTEL_GUC_SUBMISSION_H_
8 
9 #include <linux/types.h>
10 
11 #include "intel_guc.h"
12 
13 struct drm_printer;
14 struct intel_engine_cs;
15 
16 void intel_guc_submission_init_early(struct intel_guc *guc);
17 int intel_guc_submission_init(struct intel_guc *guc);
18 void intel_guc_submission_enable(struct intel_guc *guc);
19 void intel_guc_submission_disable(struct intel_guc *guc);
20 void intel_guc_submission_fini(struct intel_guc *guc);
21 int intel_guc_preempt_work_create(struct intel_guc *guc);
22 void intel_guc_preempt_work_destroy(struct intel_guc *guc);
23 int intel_guc_submission_setup(struct intel_engine_cs *engine);
24 void intel_guc_submission_print_info(struct intel_guc *guc,
25 				     struct drm_printer *p);
26 void intel_guc_submission_print_context_info(struct intel_guc *guc,
27 					     struct drm_printer *p);
28 void intel_guc_dump_active_requests(struct intel_engine_cs *engine,
29 				    struct i915_request *hung_rq,
30 				    struct drm_printer *m);
31 
32 bool intel_guc_virtual_engine_has_heartbeat(const struct intel_engine_cs *ve);
33 
34 int intel_guc_wait_for_pending_msg(struct intel_guc *guc,
35 				   atomic_t *wait_var,
36 				   bool interruptible,
37 				   long timeout);
38 
39 static inline bool intel_guc_submission_is_supported(struct intel_guc *guc)
40 {
41 	return guc->submission_supported;
42 }
43 
44 static inline bool intel_guc_submission_is_wanted(struct intel_guc *guc)
45 {
46 	return guc->submission_selected;
47 }
48 
49 static inline bool intel_guc_submission_is_used(struct intel_guc *guc)
50 {
51 	return intel_guc_is_used(guc) && intel_guc_submission_is_wanted(guc);
52 }
53 
54 #endif
55