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 void intel_guc_busyness_park(struct intel_gt *gt);
32 void intel_guc_busyness_unpark(struct intel_gt *gt);
33 
34 bool intel_guc_virtual_engine_has_heartbeat(const struct intel_engine_cs *ve);
35 
36 int intel_guc_wait_for_pending_msg(struct intel_guc *guc,
37 				   atomic_t *wait_var,
38 				   bool interruptible,
39 				   long timeout);
40 
intel_guc_submission_is_supported(struct intel_guc * guc)41 static inline bool intel_guc_submission_is_supported(struct intel_guc *guc)
42 {
43 	return guc->submission_supported;
44 }
45 
intel_guc_submission_is_wanted(struct intel_guc * guc)46 static inline bool intel_guc_submission_is_wanted(struct intel_guc *guc)
47 {
48 	return guc->submission_selected;
49 }
50 
intel_guc_submission_is_used(struct intel_guc * guc)51 static inline bool intel_guc_submission_is_used(struct intel_guc *guc)
52 {
53 	return intel_guc_is_used(guc) && intel_guc_submission_is_wanted(guc);
54 }
55 
56 #endif
57