MALI: rockchip: upgrade midgard DDK to r14p0-01rel0
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / arm / midgard / mali_kbase_config_defaults.h
1 /*
2  *
3  * (C) COPYRIGHT 2013-2016 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  * @file mali_kbase_config_defaults.h
20  *
21  * Default values for configuration settings
22  *
23  */
24
25 #ifndef _KBASE_CONFIG_DEFAULTS_H_
26 #define _KBASE_CONFIG_DEFAULTS_H_
27
28 /* Include mandatory definitions per platform */
29 #include <mali_kbase_config_platform.h>
30
31 /**
32  * Irq throttle. It is the minimum desired time in between two
33  * consecutive gpu interrupts (given in 'us'). The irq throttle
34  * gpu register will be configured after this, taking into
35  * account the configured max frequency.
36  *
37  * Attached value: number in micro seconds
38  */
39 #define DEFAULT_IRQ_THROTTLE_TIME_US 20
40
41 /**
42  *  Default Job Scheduler initial runtime of a context for the CFS Policy,
43  *  in time-slices.
44  *
45  * This value is relative to that of the least-run context, and defines
46  * where in the CFS queue a new context is added. A value of 1 means 'after
47  * the least-run context has used its timeslice'. Therefore, when all
48  * contexts consistently use the same amount of time, a value of 1 models a
49  * FIFO. A value of 0 would model a LIFO.
50  *
51  * The value is represented in "numbers of time slices". Multiply this
52  * value by that defined in @ref DEFAULT_JS_CTX_TIMESLICE_NS to get
53  * the time value for this in nanoseconds.
54  */
55 #define DEFAULT_JS_CFS_CTX_RUNTIME_INIT_SLICES 1
56
57 /**
58  * Default Job Scheduler minimum runtime value of a context for CFS, in
59  * time_slices relative to that of the least-run context.
60  *
61  * This is a measure of how much preferrential treatment is given to a
62  * context that is not run very often.
63  *
64  * Specficially, this value defines how many timeslices such a context is
65  * (initially) allowed to use at once. Such contexts (e.g. 'interactive'
66  * processes) will appear near the front of the CFS queue, and can initially
67  * use more time than contexts that run continuously (e.g. 'batch'
68  * processes).
69  *
70  * This limit \b prevents a "stored-up timeslices" DoS attack, where a ctx
71  * not run for a long time attacks the system by using a very large initial
72  * number of timeslices when it finally does run.
73  *
74  * @note A value of zero allows not-run-often contexts to get scheduled in
75  * quickly, but to only use a single timeslice when they get scheduled in.
76  */
77 #define DEFAULT_JS_CFS_CTX_RUNTIME_MIN_SLICES 2
78
79 /**
80 * Boolean indicating whether the driver is configured to be secure at
81 * a potential loss of performance.
82 *
83 * This currently affects only r0p0-15dev0 HW and earlier.
84 *
85 * On r0p0-15dev0 HW and earlier, there are tradeoffs between security and
86 * performance:
87 *
88 * - When this is set to true, the driver remains fully secure,
89 * but potentially loses performance compared with setting this to
90 * false.
91 * - When set to false, the driver is open to certain security
92 * attacks.
93 *
94 * From r0p0-00rel0 and onwards, there is no security loss by setting
95 * this to false, and no performance loss by setting it to
96 * true.
97 */
98 #define DEFAULT_SECURE_BUT_LOSS_OF_PERFORMANCE false
99
100 enum {
101         /**
102          * Use unrestricted Address ID width on the AXI bus.
103          */
104         KBASE_AID_32 = 0x0,
105
106         /**
107          * Restrict GPU to a half of maximum Address ID count.
108          * This will reduce performance, but reduce bus load due to GPU.
109          */
110         KBASE_AID_16 = 0x3,
111
112         /**
113          * Restrict GPU to a quarter of maximum Address ID count.
114          * This will reduce performance, but reduce bus load due to GPU.
115          */
116         KBASE_AID_8  = 0x2,
117
118         /**
119          * Restrict GPU to an eighth of maximum Address ID count.
120          * This will reduce performance, but reduce bus load due to GPU.
121          */
122         KBASE_AID_4  = 0x1
123 };
124
125 /**
126  * Default setting for read Address ID limiting on AXI bus.
127  *
128  * Attached value: u32 register value
129  *    KBASE_AID_32 - use the full 32 IDs (5 ID bits)
130  *    KBASE_AID_16 - use 16 IDs (4 ID bits)
131  *    KBASE_AID_8  - use 8 IDs (3 ID bits)
132  *    KBASE_AID_4  - use 4 IDs (2 ID bits)
133  * Default value: KBASE_AID_32 (no limit). Note hardware implementation
134  * may limit to a lower value.
135  */
136 #define DEFAULT_ARID_LIMIT KBASE_AID_32
137
138 /**
139  * Default setting for write Address ID limiting on AXI.
140  *
141  * Attached value: u32 register value
142  *    KBASE_AID_32 - use the full 32 IDs (5 ID bits)
143  *    KBASE_AID_16 - use 16 IDs (4 ID bits)
144  *    KBASE_AID_8  - use 8 IDs (3 ID bits)
145  *    KBASE_AID_4  - use 4 IDs (2 ID bits)
146  * Default value: KBASE_AID_32 (no limit). Note hardware implementation
147  * may limit to a lower value.
148  */
149 #define DEFAULT_AWID_LIMIT KBASE_AID_32
150
151 /**
152  * Default UMP device mapping. A UMP_DEVICE_<device>_SHIFT value which
153  * defines which UMP device this GPU should be mapped to.
154  */
155 #define DEFAULT_UMP_GPU_DEVICE_SHIFT UMP_DEVICE_Z_SHIFT
156
157 /*
158  * Default period for DVFS sampling
159  */
160 // #define DEFAULT_PM_DVFS_PERIOD 100 /* 100ms */
161 #define DEFAULT_PM_DVFS_PERIOD 20 /* 20 ms */
162
163 /*
164  * Power Management poweroff tick granuality. This is in nanoseconds to
165  * allow HR timer support.
166  *
167  * On each scheduling tick, the power manager core may decide to:
168  * -# Power off one or more shader cores
169  * -# Power off the entire GPU
170  */
171 #define DEFAULT_PM_GPU_POWEROFF_TICK_NS (400000) /* 400us */
172
173 /*
174  * Power Manager number of ticks before shader cores are powered off
175  */
176 #define DEFAULT_PM_POWEROFF_TICK_SHADER (2) /* 400-800us */
177
178 /*
179  * Power Manager number of ticks before GPU is powered off
180  */
181 #define DEFAULT_PM_POWEROFF_TICK_GPU (2) /* 400-800us */
182
183 /*
184  * Default scheduling tick granuality
185  */
186 #define DEFAULT_JS_SCHEDULING_PERIOD_NS    (100000000u) /* 100ms */
187
188 /*
189  * Default minimum number of scheduling ticks before jobs are soft-stopped.
190  *
191  * This defines the time-slice for a job (which may be different from that of a
192  * context)
193  */
194 #define DEFAULT_JS_SOFT_STOP_TICKS       (1) /* 100ms-200ms */
195
196 /*
197  * Default minimum number of scheduling ticks before CL jobs are soft-stopped.
198  */
199 #define DEFAULT_JS_SOFT_STOP_TICKS_CL    (1) /* 100ms-200ms */
200
201 /*
202  * Default minimum number of scheduling ticks before jobs are hard-stopped
203  */
204 #define DEFAULT_JS_HARD_STOP_TICKS_SS    (100) /* 10s */
205 #define DEFAULT_JS_HARD_STOP_TICKS_SS_8408  (300) /* 30s */
206
207 /*
208  * Default minimum number of scheduling ticks before CL jobs are hard-stopped.
209  */
210 #define DEFAULT_JS_HARD_STOP_TICKS_CL    (100) /* 10s */
211
212 /*
213  * Default minimum number of scheduling ticks before jobs are hard-stopped
214  * during dumping
215  */
216 #define DEFAULT_JS_HARD_STOP_TICKS_DUMPING   (15000) /* 1500s */
217
218 /*
219  * Default timeout for some software jobs, after which the software event wait
220  * jobs will be cancelled.
221  */
222 #define DEFAULT_JS_SOFT_JOB_TIMEOUT ((u32)3000) /* 3s */
223
224 /*
225  * Default minimum number of scheduling ticks before the GPU is reset to clear a
226  * "stuck" job
227  */
228 #define DEFAULT_JS_RESET_TICKS_SS           (105) /* 10.5s */
229 #define DEFAULT_JS_RESET_TICKS_SS_8408     (450) /* 45s */
230
231 /*
232  * Default minimum number of scheduling ticks before the GPU is reset to clear a
233  * "stuck" CL job.
234  */
235 #define DEFAULT_JS_RESET_TICKS_CL        (105) /* 10.5s */
236
237 /*
238  * Default minimum number of scheduling ticks before the GPU is reset to clear a
239  * "stuck" job during dumping.
240  */
241 #define DEFAULT_JS_RESET_TICKS_DUMPING   (15020) /* 1502s */
242
243 /*
244  * Default number of milliseconds given for other jobs on the GPU to be
245  * soft-stopped when the GPU needs to be reset.
246  */
247 #define DEFAULT_RESET_TIMEOUT_MS (3000) /* 3s */
248
249 /*
250  * Default timeslice that a context is scheduled in for, in nanoseconds.
251  *
252  * When a context has used up this amount of time across its jobs, it is
253  * scheduled out to let another run.
254  *
255  * @note the resolution is nanoseconds (ns) here, because that's the format
256  * often used by the OS.
257  */
258 #define DEFAULT_JS_CTX_TIMESLICE_NS (50000000) /* 50ms */
259
260 #endif /* _KBASE_CONFIG_DEFAULTS_H_ */
261