mali_kbase_uku.h 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  1. /*
  2. *
  3. * (C) COPYRIGHT 2008-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. #ifndef _KBASE_UKU_H_
  16. #define _KBASE_UKU_H_
  17. #include "mali_uk.h"
  18. #include "mali_base_kernel.h"
  19. #include "mali_kbase_gpuprops_types.h"
  20. /*
  21. * 10.1:
  22. * - Do mmap in kernel for SAME_VA memory allocations rather then
  23. * calling back into the kernel as a 2nd stage of the allocation request.
  24. *
  25. * 10.2:
  26. * - Add KBASE_FUNC_MEM_JIT_INIT which allows clients to request a custom VA
  27. * region for use with JIT (ignored on 32-bit platforms)
  28. */
  29. #define BASE_UK_VERSION_MAJOR 10
  30. #define BASE_UK_VERSION_MINOR 2
  31. struct kbase_uk_mem_alloc {
  32. union uk_header header;
  33. /* IN */
  34. u64 va_pages;
  35. u64 commit_pages;
  36. u64 extent;
  37. /* IN/OUT */
  38. u64 flags;
  39. /* OUT */
  40. u64 gpu_va;
  41. u16 va_alignment;
  42. u8 padding[6];
  43. };
  44. struct kbase_uk_mem_free {
  45. union uk_header header;
  46. /* IN */
  47. u64 gpu_addr;
  48. /* OUT */
  49. };
  50. struct kbase_uk_mem_alias {
  51. union uk_header header;
  52. /* IN/OUT */
  53. u64 flags;
  54. /* IN */
  55. u64 stride;
  56. u64 nents;
  57. union kbase_pointer ai;
  58. /* OUT */
  59. u64 gpu_va;
  60. u64 va_pages;
  61. };
  62. struct kbase_uk_mem_import {
  63. union uk_header header;
  64. /* IN */
  65. union kbase_pointer phandle;
  66. u32 type;
  67. u32 padding;
  68. /* IN/OUT */
  69. u64 flags;
  70. /* OUT */
  71. u64 gpu_va;
  72. u64 va_pages;
  73. };
  74. struct kbase_uk_mem_flags_change {
  75. union uk_header header;
  76. /* IN */
  77. u64 gpu_va;
  78. u64 flags;
  79. u64 mask;
  80. };
  81. struct kbase_uk_job_submit {
  82. union uk_header header;
  83. /* IN */
  84. union kbase_pointer addr;
  85. u32 nr_atoms;
  86. u32 stride; /* bytes between atoms, i.e. sizeof(base_jd_atom_v2) */
  87. /* OUT */
  88. };
  89. struct kbase_uk_post_term {
  90. union uk_header header;
  91. };
  92. struct kbase_uk_sync_now {
  93. union uk_header header;
  94. /* IN */
  95. struct base_syncset sset;
  96. /* OUT */
  97. };
  98. struct kbase_uk_hwcnt_setup {
  99. union uk_header header;
  100. /* IN */
  101. u64 dump_buffer;
  102. u32 jm_bm;
  103. u32 shader_bm;
  104. u32 tiler_bm;
  105. u32 unused_1; /* keep for backwards compatibility */
  106. u32 mmu_l2_bm;
  107. u32 padding;
  108. /* OUT */
  109. };
  110. /**
  111. * struct kbase_uk_hwcnt_reader_setup - User/Kernel space data exchange structure
  112. * @header: UK structure header
  113. * @buffer_count: requested number of dumping buffers
  114. * @jm_bm: counters selection bitmask (JM)
  115. * @shader_bm: counters selection bitmask (Shader)
  116. * @tiler_bm: counters selection bitmask (Tiler)
  117. * @mmu_l2_bm: counters selection bitmask (MMU_L2)
  118. * @fd: dumping notification file descriptor
  119. *
  120. * This structure sets up HWC dumper/reader for this context.
  121. * Multiple instances can be created for single context.
  122. */
  123. struct kbase_uk_hwcnt_reader_setup {
  124. union uk_header header;
  125. /* IN */
  126. u32 buffer_count;
  127. u32 jm_bm;
  128. u32 shader_bm;
  129. u32 tiler_bm;
  130. u32 mmu_l2_bm;
  131. /* OUT */
  132. s32 fd;
  133. };
  134. struct kbase_uk_hwcnt_dump {
  135. union uk_header header;
  136. };
  137. struct kbase_uk_hwcnt_clear {
  138. union uk_header header;
  139. };
  140. struct kbase_uk_fence_validate {
  141. union uk_header header;
  142. /* IN */
  143. s32 fd;
  144. u32 padding;
  145. /* OUT */
  146. };
  147. struct kbase_uk_stream_create {
  148. union uk_header header;
  149. /* IN */
  150. char name[32];
  151. /* OUT */
  152. s32 fd;
  153. u32 padding;
  154. };
  155. struct kbase_uk_gpuprops {
  156. union uk_header header;
  157. /* IN */
  158. struct mali_base_gpu_props props;
  159. /* OUT */
  160. };
  161. struct kbase_uk_mem_query {
  162. union uk_header header;
  163. /* IN */
  164. u64 gpu_addr;
  165. #define KBASE_MEM_QUERY_COMMIT_SIZE 1
  166. #define KBASE_MEM_QUERY_VA_SIZE 2
  167. #define KBASE_MEM_QUERY_FLAGS 3
  168. u64 query;
  169. /* OUT */
  170. u64 value;
  171. };
  172. struct kbase_uk_mem_commit {
  173. union uk_header header;
  174. /* IN */
  175. u64 gpu_addr;
  176. u64 pages;
  177. /* OUT */
  178. u32 result_subcode;
  179. u32 padding;
  180. };
  181. struct kbase_uk_find_cpu_offset {
  182. union uk_header header;
  183. /* IN */
  184. u64 gpu_addr;
  185. u64 cpu_addr;
  186. u64 size;
  187. /* OUT */
  188. u64 offset;
  189. };
  190. #define KBASE_GET_VERSION_BUFFER_SIZE 64
  191. struct kbase_uk_get_ddk_version {
  192. union uk_header header;
  193. /* OUT */
  194. char version_buffer[KBASE_GET_VERSION_BUFFER_SIZE];
  195. u32 version_string_size;
  196. u32 padding;
  197. };
  198. struct kbase_uk_disjoint_query {
  199. union uk_header header;
  200. /* OUT */
  201. u32 counter;
  202. u32 padding;
  203. };
  204. struct kbase_uk_set_flags {
  205. union uk_header header;
  206. /* IN */
  207. u32 create_flags;
  208. u32 padding;
  209. };
  210. #define KBASE_MAXIMUM_EXT_RESOURCES 255
  211. struct kbase_uk_ext_buff_kds_data {
  212. union uk_header header;
  213. union kbase_pointer external_resource;
  214. union kbase_pointer file_descriptor;
  215. u32 num_res; /* limited to KBASE_MAXIMUM_EXT_RESOURCES */
  216. u32 padding;
  217. };
  218. #ifdef BASE_LEGACY_UK8_SUPPORT
  219. struct kbase_uk_keep_gpu_powered {
  220. union uk_header header;
  221. u32 enabled;
  222. u32 padding;
  223. };
  224. #endif /* BASE_LEGACY_UK8_SUPPORT */
  225. struct kbase_uk_context_id {
  226. union uk_header header;
  227. /* OUT */
  228. int id;
  229. };
  230. #if (defined(MALI_MIPE_ENABLED) && MALI_MIPE_ENABLED) || \
  231. !defined(MALI_MIPE_ENABLED)
  232. /**
  233. * struct kbase_uk_tlstream_acquire - User/Kernel space data exchange structure
  234. * @header: UK structure header
  235. * @fd: timeline stream file descriptor
  236. *
  237. * This structure is used used when performing a call to acquire kernel side
  238. * timeline stream file descriptor.
  239. */
  240. struct kbase_uk_tlstream_acquire {
  241. union uk_header header;
  242. /* IN */
  243. /* OUT */
  244. s32 fd;
  245. };
  246. /**
  247. * struct kbase_uk_tlstream_flush - User/Kernel space data exchange structure
  248. * @header: UK structure header
  249. *
  250. * This structure is used when performing a call to flush kernel side
  251. * timeline streams.
  252. */
  253. struct kbase_uk_tlstream_flush {
  254. union uk_header header;
  255. /* IN */
  256. /* OUT */
  257. };
  258. #endif /* MALI_MIPE_ENABLED */
  259. /**
  260. * struct struct kbase_uk_prfcnt_value for the KBASE_FUNC_SET_PRFCNT_VALUES ioctl
  261. * @header: UK structure header
  262. * @data: Counter samples for the dummy model
  263. * @size:............Size of the counter sample data
  264. */
  265. struct kbase_uk_prfcnt_values {
  266. union uk_header header;
  267. /* IN */
  268. u32 *data;
  269. u32 size;
  270. };
  271. /**
  272. * struct kbase_uk_soft_event_update - User/Kernel space data exchange structure
  273. * @header: UK structure header
  274. * @evt: the GPU address containing the event
  275. * @new_status: the new event status, must be either BASE_JD_SOFT_EVENT_SET or
  276. * BASE_JD_SOFT_EVENT_RESET
  277. * @flags: reserved for future uses, must be set to 0
  278. *
  279. * This structure is used to update the status of a software event. If the
  280. * event's status is set to BASE_JD_SOFT_EVENT_SET, any job currently waiting
  281. * on this event will complete.
  282. */
  283. struct kbase_uk_soft_event_update {
  284. union uk_header header;
  285. /* IN */
  286. u64 evt;
  287. u32 new_status;
  288. u32 flags;
  289. };
  290. struct kbase_uk_debugfs_mem_profile_add {
  291. union uk_header header;
  292. u32 len;
  293. union kbase_pointer buf;
  294. };
  295. /**
  296. * struct kbase_uk_mem_jit_init - User/Kernel space data exchange structure
  297. * @header: UK structure header
  298. * @va_pages: Number of virtual pages required for JIT
  299. *
  300. * This structure is used when requesting initialization of JIT.
  301. */
  302. struct kbase_uk_mem_jit_init {
  303. union uk_header header;
  304. /* IN */
  305. u64 va_pages;
  306. };
  307. enum kbase_uk_function_id {
  308. KBASE_FUNC_MEM_ALLOC = (UK_FUNC_ID + 0),
  309. KBASE_FUNC_MEM_IMPORT = (UK_FUNC_ID + 1),
  310. KBASE_FUNC_MEM_COMMIT = (UK_FUNC_ID + 2),
  311. KBASE_FUNC_MEM_QUERY = (UK_FUNC_ID + 3),
  312. KBASE_FUNC_MEM_FREE = (UK_FUNC_ID + 4),
  313. KBASE_FUNC_MEM_FLAGS_CHANGE = (UK_FUNC_ID + 5),
  314. KBASE_FUNC_MEM_ALIAS = (UK_FUNC_ID + 6),
  315. KBASE_FUNC_SYNC = (UK_FUNC_ID + 8),
  316. KBASE_FUNC_POST_TERM = (UK_FUNC_ID + 9),
  317. KBASE_FUNC_HWCNT_SETUP = (UK_FUNC_ID + 10),
  318. KBASE_FUNC_HWCNT_DUMP = (UK_FUNC_ID + 11),
  319. KBASE_FUNC_HWCNT_CLEAR = (UK_FUNC_ID + 12),
  320. KBASE_FUNC_GPU_PROPS_REG_DUMP = (UK_FUNC_ID + 14),
  321. KBASE_FUNC_FIND_CPU_OFFSET = (UK_FUNC_ID + 15),
  322. KBASE_FUNC_GET_VERSION = (UK_FUNC_ID + 16),
  323. KBASE_FUNC_EXT_BUFFER_LOCK = (UK_FUNC_ID + 17),
  324. KBASE_FUNC_SET_FLAGS = (UK_FUNC_ID + 18),
  325. KBASE_FUNC_SET_TEST_DATA = (UK_FUNC_ID + 19),
  326. KBASE_FUNC_INJECT_ERROR = (UK_FUNC_ID + 20),
  327. KBASE_FUNC_MODEL_CONTROL = (UK_FUNC_ID + 21),
  328. #ifdef BASE_LEGACY_UK8_SUPPORT
  329. KBASE_FUNC_KEEP_GPU_POWERED = (UK_FUNC_ID + 22),
  330. #endif /* BASE_LEGACY_UK8_SUPPORT */
  331. KBASE_FUNC_FENCE_VALIDATE = (UK_FUNC_ID + 23),
  332. KBASE_FUNC_STREAM_CREATE = (UK_FUNC_ID + 24),
  333. KBASE_FUNC_GET_PROFILING_CONTROLS = (UK_FUNC_ID + 25),
  334. KBASE_FUNC_SET_PROFILING_CONTROLS = (UK_FUNC_ID + 26),
  335. /* to be used only for testing
  336. * purposes, otherwise these controls
  337. * are set through gator API */
  338. KBASE_FUNC_DEBUGFS_MEM_PROFILE_ADD = (UK_FUNC_ID + 27),
  339. KBASE_FUNC_JOB_SUBMIT = (UK_FUNC_ID + 28),
  340. KBASE_FUNC_DISJOINT_QUERY = (UK_FUNC_ID + 29),
  341. KBASE_FUNC_GET_CONTEXT_ID = (UK_FUNC_ID + 31),
  342. #if (defined(MALI_MIPE_ENABLED) && MALI_MIPE_ENABLED) || \
  343. !defined(MALI_MIPE_ENABLED)
  344. KBASE_FUNC_TLSTREAM_ACQUIRE = (UK_FUNC_ID + 32),
  345. KBASE_FUNC_TLSTREAM_FLUSH = (UK_FUNC_ID + 35),
  346. #endif /* MALI_MIPE_ENABLED */
  347. KBASE_FUNC_HWCNT_READER_SETUP = (UK_FUNC_ID + 36),
  348. KBASE_FUNC_SOFT_EVENT_UPDATE = (UK_FUNC_ID + 38),
  349. KBASE_FUNC_MEM_JIT_INIT = (UK_FUNC_ID + 39),
  350. KBASE_FUNC_MAX
  351. };
  352. #endif /* _KBASE_UKU_H_ */