LOCAL / GPU: ARM: add MALI R12P0_04REL0 drivers
[platform/kernel/linux-exynos.git] / drivers / gpu / arm / midgard / r12p0_04rel0 / mali_kbase_js_policy_cfs.h
1 /*
2  *
3  * (C) COPYRIGHT 2011-2015 ARM Limited. All rights reserved.
4  *
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
8  * of such GNU licence.
9  *
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.
13  *
14  */
15
16
17
18
19
20 /*
21  * Completely Fair Job Scheduler Policy structure definitions
22  */
23
24 #ifndef _KBASE_JS_POLICY_CFS_H_
25 #define _KBASE_JS_POLICY_CFS_H_
26
27 #define KBASEP_JS_RUNTIME_EMPTY ((u64)-1)
28
29 /**
30  * struct kbasep_js_policy_cfs - Data for the CFS policy
31  * @head_runtime_us:  Number of microseconds the least-run context has been
32  *                    running for. The kbasep_js_device_data.queue_mutex must
33  *                    be held whilst updating this.
34  *                    Reads are possible without this mutex, but an older value
35  *                    might be read if no memory barries are issued beforehand.
36  * @least_runtime_us: Number of microseconds the least-run context in the
37  *                    context queue has been running for.
38  *                    -1 if context queue is empty.
39  * @rt_least_runtime_us: Number of microseconds the least-run context in the
40  *                       realtime (priority) context queue has been running for.
41  *                       -1 if realtime context queue is empty
42  */
43 struct kbasep_js_policy_cfs {
44         u64 head_runtime_us;
45         atomic64_t least_runtime_us;
46         atomic64_t rt_least_runtime_us;
47 };
48
49 /**
50  * struct kbasep_js_policy_cfs_ctx - a single linked list of all contexts
51  * @runtime_us:        microseconds this context has been running for
52  * @process_rt_policy: set if calling process policy scheme is a realtime
53  *                     scheduler and will use the priority queue. Non-mutable
54  *                     after ctx init
55  * @process_priority:  calling process NICE priority, in the range -20..19
56  *
57  * &kbasep_js_device_data.runpool_irq.lock must be held when updating
58  * @runtime_us. Initializing will occur on context init and context enqueue
59  * (which can only occur in one thread at a time), but multi-thread access only
60  * occurs while the context is in the runpool.
61  *
62  * Reads are possible without the spinlock, but an older value might be read if
63  * no memory barries are issued beforehand.
64  */
65 struct kbasep_js_policy_cfs_ctx {
66         u64 runtime_us;
67         bool process_rt_policy;
68         int process_priority;
69 };
70
71 /**
72  * struct kbasep_js_policy_cfs_job - per job information for CFS
73  * @ticks: number of ticks that this job has been executing for
74  *
75  * &kbasep_js_device_data.runpool_irq.lock must be held when accessing @ticks.
76  */
77 struct kbasep_js_policy_cfs_job {
78         u32 ticks;
79 };
80
81 #endif