3 * (C) COPYRIGHT 2011-2016 ARM Limited. All rights reserved.
5 * This program is free software and is provided to you under the terms of the
6 * GNU General Public License version 2 as published by the Free Software
7 * Foundation, and any use by you of this program is subject to the terms
10 * A copy of the licence is included with the program, and can also be obtained
11 * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
12 * Boston, MA 02110-1301, USA.
21 * Job Manager backend-specific low-level APIs.
24 #ifndef _KBASE_JM_HWACCESS_H_
25 #define _KBASE_JM_HWACCESS_H_
27 #include <mali_kbase_hw.h>
28 #include <mali_kbase_debug.h>
29 #include <linux/atomic.h>
31 #include <backend/gpu/mali_kbase_jm_rb.h>
34 * kbase_job_submit_nolock() - Submit a job to a certain job-slot
35 * @kbdev: Device pointer
36 * @katom: Atom to submit
37 * @js: Job slot to submit on
39 * The caller must check kbasep_jm_is_submit_slots_free() != false before
42 * The following locking conditions are made on the caller:
43 * - it must hold the kbasep_js_device_data::runpoool_irq::lock
45 void kbase_job_submit_nolock(struct kbase_device *kbdev,
46 struct kbase_jd_atom *katom, int js);
49 * kbase_job_done_slot() - Complete the head job on a particular job-slot
50 * @kbdev: Device pointer
52 * @completion_code: Completion code of job reported by GPU
53 * @job_tail: Job tail address reported by GPU
54 * @end_timestamp: Timestamp of job completion
56 void kbase_job_done_slot(struct kbase_device *kbdev, int s, u32 completion_code,
57 u64 job_tail, ktime_t *end_timestamp);
59 #ifdef CONFIG_GPU_TRACEPOINTS
60 static inline char *kbasep_make_job_slot_string(int js, char *js_string)
62 sprintf(js_string, "job_slot_%i", js);
68 * kbase_job_hw_submit() - Submit a job to the GPU
69 * @kbdev: Device pointer
70 * @katom: Atom to submit
71 * @js: Job slot to submit on
73 * The caller must check kbasep_jm_is_submit_slots_free() != false before
76 * The following locking conditions are made on the caller:
77 * - it must hold the kbasep_js_device_data::runpoool_irq::lock
79 void kbase_job_hw_submit(struct kbase_device *kbdev,
80 struct kbase_jd_atom *katom,
84 * kbasep_job_slot_soft_or_hard_stop_do_action() - Perform a soft or hard stop
85 * on the specified atom
86 * @kbdev: Device pointer
87 * @js: Job slot to stop on
88 * @action: The action to perform, either JSn_COMMAND_HARD_STOP or
89 * JSn_COMMAND_SOFT_STOP
90 * @core_reqs: Core requirements of atom to stop
91 * @target_katom: Atom to stop
93 * The following locking conditions are made on the caller:
94 * - it must hold the kbasep_js_device_data::runpool_irq::lock
96 void kbasep_job_slot_soft_or_hard_stop_do_action(struct kbase_device *kbdev,
99 base_jd_core_req core_reqs,
100 struct kbase_jd_atom *target_katom);
103 * kbase_backend_soft_hard_stop_slot() - Soft or hard stop jobs on a given job
104 * slot belonging to a given context.
105 * @kbdev: Device pointer
106 * @kctx: Context pointer. May be NULL
107 * @katom: Specific atom to stop. May be NULL
108 * @js: Job slot to hard stop
109 * @action: The action to perform, either JSn_COMMAND_HARD_STOP or
110 * JSn_COMMAND_SOFT_STOP
112 * If no context is provided then all jobs on the slot will be soft or hard
115 * If a katom is provided then only that specific atom will be stopped. In this
116 * case the kctx parameter is ignored.
118 * Jobs that are on the slot but are not yet on the GPU will be unpulled and
119 * returned to the job scheduler.
121 * Return: true if an atom was stopped, false otherwise
123 bool kbase_backend_soft_hard_stop_slot(struct kbase_device *kbdev,
124 struct kbase_context *kctx,
126 struct kbase_jd_atom *katom,
130 * kbase_job_slot_init - Initialise job slot framework
131 * @kbdev: Device pointer
133 * Called on driver initialisation
135 * Return: 0 on success
137 int kbase_job_slot_init(struct kbase_device *kbdev);
140 * kbase_job_slot_halt - Halt the job slot framework
141 * @kbdev: Device pointer
143 * Should prevent any further job slot processing
145 void kbase_job_slot_halt(struct kbase_device *kbdev);
148 * kbase_job_slot_term - Terminate job slot framework
149 * @kbdev: Device pointer
151 * Called on driver termination
153 void kbase_job_slot_term(struct kbase_device *kbdev);
155 #endif /* _KBASE_JM_HWACCESS_H_ */