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 * Affinity Manager internal APIs.
24 #ifndef _KBASE_JS_AFFINITY_H_
25 #define _KBASE_JS_AFFINITY_H_
28 * kbase_js_can_run_job_on_slot_no_lock - Decide whether it is possible to
29 * submit a job to a particular job slot in the current status
31 * @kbdev: The kbase device structure of the device
32 * @js: Job slot number to check for allowance
34 * Will check if submitting to the given job slot is allowed in the current
35 * status. For example using job slot 2 while in soft-stoppable state and only
36 * having 1 coregroup is not allowed by the policy. This function should be
37 * called prior to submitting a job to a slot to make sure policy rules are not
40 * The following locking conditions are made on the caller
41 * - it must hold kbasep_js_device_data.runpool_irq.lock
43 bool kbase_js_can_run_job_on_slot_no_lock(struct kbase_device *kbdev,
47 * kbase_js_choose_affinity - Compute affinity for a given job.
49 * @affinity: Affinity bitmap computed
50 * @kbdev: The kbase device structure of the device
51 * @katom: Job chain of which affinity is going to be found
52 * @js: Slot the job chain is being submitted
54 * Currently assumes an all-on/all-off power management policy.
55 * Also assumes there is at least one core with tiler available.
57 * Returns true if a valid affinity was chosen, false if
58 * no cores were available.
60 bool kbase_js_choose_affinity(u64 * const affinity,
61 struct kbase_device *kbdev,
62 struct kbase_jd_atom *katom,
66 * kbase_js_affinity_would_violate - Determine whether a proposed affinity on
67 * job slot @js would cause a violation of affinity restrictions.
69 * @kbdev: Kbase device structure
70 * @js: The job slot to test
71 * @affinity: The affinity mask to test
73 * The following locks must be held by the caller
74 * - kbasep_js_device_data.runpool_irq.lock
76 * Return: true if the affinity would violate the restrictions
78 bool kbase_js_affinity_would_violate(struct kbase_device *kbdev, int js,
82 * kbase_js_affinity_retain_slot_cores - Affinity tracking: retain cores used by
85 * @kbdev: Kbase device structure
86 * @js: The job slot retaining the cores
87 * @affinity: The cores to retain
89 * The following locks must be held by the caller
90 * - kbasep_js_device_data.runpool_irq.lock
92 void kbase_js_affinity_retain_slot_cores(struct kbase_device *kbdev, int js,
96 * kbase_js_affinity_release_slot_cores - Affinity tracking: release cores used
99 * @kbdev: Kbase device structure
101 * @affinity: Bit mask of core to be released
103 * Cores must be released as soon as a job is dequeued from a slot's 'submit
104 * slots', and before another job is submitted to those slots. Otherwise, the
105 * refcount could exceed the maximum number submittable to a slot,
106 * %BASE_JM_SUBMIT_SLOTS.
108 * The following locks must be held by the caller
109 * - kbasep_js_device_data.runpool_irq.lock
111 void kbase_js_affinity_release_slot_cores(struct kbase_device *kbdev, int js,
115 * kbase_js_debug_log_current_affinities - log the current affinities
117 * @kbdev: Kbase device structure
119 * Output to the Trace log the current tracked affinities on all slots
121 #if KBASE_TRACE_ENABLE
122 void kbase_js_debug_log_current_affinities(struct kbase_device *kbdev);
123 #else /* KBASE_TRACE_ENABLE */
125 kbase_js_debug_log_current_affinities(struct kbase_device *kbdev)
128 #endif /* KBASE_TRACE_ENABLE */
130 #endif /* _KBASE_JS_AFFINITY_H_ */