mali_kbase_config_defaults.h 7.8 KB

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