xref: /OK3568_Linux_fs/kernel/include/uapi/gpu/arm/bifrost/mali_kbase_ioctl.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  *
4  * (C) COPYRIGHT 2017-2022 ARM Limited. All rights reserved.
5  *
6  * This program is free software and is provided to you under the terms of the
7  * GNU General Public License version 2 as published by the Free Software
8  * Foundation, and any use by you of this program is subject to the terms
9  * of such GNU license.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, you can access it online at
18  * http://www.gnu.org/licenses/gpl-2.0.html.
19  *
20  */
21 
22 #ifndef _UAPI_KBASE_IOCTL_H_
23 #define _UAPI_KBASE_IOCTL_H_
24 
25 #ifdef __cpluscplus
26 extern "C" {
27 #endif
28 
29 #include <asm-generic/ioctl.h>
30 #include <linux/types.h>
31 
32 #if MALI_USE_CSF
33 #include "csf/mali_kbase_csf_ioctl.h"
34 #else
35 #include "jm/mali_kbase_jm_ioctl.h"
36 #endif /* MALI_USE_CSF */
37 
38 #define KBASE_IOCTL_TYPE 0x80
39 
40 /**
41  * struct kbase_ioctl_set_flags - Set kernel context creation flags
42  *
43  * @create_flags: Flags - see base_context_create_flags
44  */
45 struct kbase_ioctl_set_flags {
46 	__u32 create_flags;
47 };
48 
49 #define KBASE_IOCTL_SET_FLAGS _IOW(KBASE_IOCTL_TYPE, 1, struct kbase_ioctl_set_flags)
50 
51 /**
52  * struct kbase_ioctl_get_gpuprops - Read GPU properties from the kernel
53  *
54  * @buffer: Pointer to the buffer to store properties into
55  * @size: Size of the buffer
56  * @flags: Flags - must be zero for now
57  *
58  * The ioctl will return the number of bytes stored into @buffer or an error
59  * on failure (e.g. @size is too small). If @size is specified as 0 then no
60  * data will be written but the return value will be the number of bytes needed
61  * for all the properties.
62  *
63  * @flags may be used in the future to request a different format for the
64  * buffer. With @flags == 0 the following format is used.
65  *
66  * The buffer will be filled with pairs of values, a __u32 key identifying the
67  * property followed by the value. The size of the value is identified using
68  * the bottom bits of the key. The value then immediately followed the key and
69  * is tightly packed (there is no padding). All keys and values are
70  * little-endian.
71  *
72  * 00 = __u8
73  * 01 = __u16
74  * 10 = __u32
75  * 11 = __u64
76  */
77 struct kbase_ioctl_get_gpuprops {
78 	__u64 buffer;
79 	__u32 size;
80 	__u32 flags;
81 };
82 
83 #define KBASE_IOCTL_GET_GPUPROPS _IOW(KBASE_IOCTL_TYPE, 3, struct kbase_ioctl_get_gpuprops)
84 
85 /**
86  * union kbase_ioctl_mem_alloc - Allocate memory on the GPU
87  * @in: Input parameters
88  * @in.va_pages: The number of pages of virtual address space to reserve
89  * @in.commit_pages: The number of physical pages to allocate
90  * @in.extension: The number of extra pages to allocate on each GPU fault which grows the region
91  * @in.flags: Flags
92  * @out: Output parameters
93  * @out.flags: Flags
94  * @out.gpu_va: The GPU virtual address which is allocated
95  */
96 union kbase_ioctl_mem_alloc {
97 	struct {
98 		__u64 va_pages;
99 		__u64 commit_pages;
100 		__u64 extension;
101 		__u64 flags;
102 	} in;
103 	struct {
104 		__u64 flags;
105 		__u64 gpu_va;
106 	} out;
107 };
108 
109 #define KBASE_IOCTL_MEM_ALLOC _IOWR(KBASE_IOCTL_TYPE, 5, union kbase_ioctl_mem_alloc)
110 
111 /**
112  * struct kbase_ioctl_mem_query - Query properties of a GPU memory region
113  * @in: Input parameters
114  * @in.gpu_addr: A GPU address contained within the region
115  * @in.query: The type of query
116  * @out: Output parameters
117  * @out.value: The result of the query
118  *
119  * Use a %KBASE_MEM_QUERY_xxx flag as input for @query.
120  */
121 union kbase_ioctl_mem_query {
122 	struct {
123 		__u64 gpu_addr;
124 		__u64 query;
125 	} in;
126 	struct {
127 		__u64 value;
128 	} out;
129 };
130 
131 #define KBASE_IOCTL_MEM_QUERY _IOWR(KBASE_IOCTL_TYPE, 6, union kbase_ioctl_mem_query)
132 
133 #define KBASE_MEM_QUERY_COMMIT_SIZE ((__u64)1)
134 #define KBASE_MEM_QUERY_VA_SIZE ((__u64)2)
135 #define KBASE_MEM_QUERY_FLAGS ((__u64)3)
136 
137 /**
138  * struct kbase_ioctl_mem_free - Free a memory region
139  * @gpu_addr: Handle to the region to free
140  */
141 struct kbase_ioctl_mem_free {
142 	__u64 gpu_addr;
143 };
144 
145 #define KBASE_IOCTL_MEM_FREE _IOW(KBASE_IOCTL_TYPE, 7, struct kbase_ioctl_mem_free)
146 
147 /**
148  * struct kbase_ioctl_hwcnt_reader_setup - Setup HWC dumper/reader
149  * @buffer_count: requested number of dumping buffers
150  * @fe_bm:        counters selection bitmask (Front end)
151  * @shader_bm:    counters selection bitmask (Shader)
152  * @tiler_bm:     counters selection bitmask (Tiler)
153  * @mmu_l2_bm:    counters selection bitmask (MMU_L2)
154  *
155  * A fd is returned from the ioctl if successful, or a negative value on error
156  */
157 struct kbase_ioctl_hwcnt_reader_setup {
158 	__u32 buffer_count;
159 	__u32 fe_bm;
160 	__u32 shader_bm;
161 	__u32 tiler_bm;
162 	__u32 mmu_l2_bm;
163 };
164 
165 #define KBASE_IOCTL_HWCNT_READER_SETUP                                                             \
166 	_IOW(KBASE_IOCTL_TYPE, 8, struct kbase_ioctl_hwcnt_reader_setup)
167 
168 /**
169  * struct kbase_ioctl_hwcnt_values - Values to set dummy the dummy counters to.
170  * @data:    Counter samples for the dummy model.
171  * @size:    Size of the counter sample data.
172  * @padding: Padding.
173  */
174 struct kbase_ioctl_hwcnt_values {
175 	__u64 data;
176 	__u32 size;
177 	__u32 padding;
178 };
179 
180 #define KBASE_IOCTL_HWCNT_SET _IOW(KBASE_IOCTL_TYPE, 32, struct kbase_ioctl_hwcnt_values)
181 
182 /**
183  * struct kbase_ioctl_disjoint_query - Query the disjoint counter
184  * @counter:   A counter of disjoint events in the kernel
185  */
186 struct kbase_ioctl_disjoint_query {
187 	__u32 counter;
188 };
189 
190 #define KBASE_IOCTL_DISJOINT_QUERY _IOR(KBASE_IOCTL_TYPE, 12, struct kbase_ioctl_disjoint_query)
191 
192 /**
193  * struct kbase_ioctl_get_ddk_version - Query the kernel version
194  * @version_buffer: Buffer to receive the kernel version string
195  * @size: Size of the buffer
196  * @padding: Padding
197  *
198  * The ioctl will return the number of bytes written into version_buffer
199  * (which includes a NULL byte) or a negative error code
200  *
201  * The ioctl request code has to be _IOW because the data in ioctl struct is
202  * being copied to the kernel, even though the kernel then writes out the
203  * version info to the buffer specified in the ioctl.
204  */
205 struct kbase_ioctl_get_ddk_version {
206 	__u64 version_buffer;
207 	__u32 size;
208 	__u32 padding;
209 };
210 
211 #define KBASE_IOCTL_GET_DDK_VERSION _IOW(KBASE_IOCTL_TYPE, 13, struct kbase_ioctl_get_ddk_version)
212 
213 /**
214  * struct kbase_ioctl_mem_jit_init - Initialize the just-in-time memory
215  *                                   allocator
216  * @va_pages: Number of GPU virtual address pages to reserve for just-in-time
217  *            memory allocations
218  * @max_allocations: Maximum number of concurrent allocations
219  * @trim_level: Level of JIT allocation trimming to perform on free (0 - 100%)
220  * @group_id: Group ID to be used for physical allocations
221  * @padding: Currently unused, must be zero
222  * @phys_pages: Maximum number of physical pages to allocate just-in-time
223  *
224  * Note that depending on the VA size of the application and GPU, the value
225  * specified in @va_pages may be ignored.
226  */
227 struct kbase_ioctl_mem_jit_init {
228 	__u64 va_pages;
229 	__u8 max_allocations;
230 	__u8 trim_level;
231 	__u8 group_id;
232 	__u8 padding[5];
233 	__u64 phys_pages;
234 };
235 
236 #define KBASE_IOCTL_MEM_JIT_INIT _IOW(KBASE_IOCTL_TYPE, 14, struct kbase_ioctl_mem_jit_init)
237 
238 /**
239  * struct kbase_ioctl_mem_sync - Perform cache maintenance on memory
240  *
241  * @handle: GPU memory handle (GPU VA)
242  * @user_addr: The address where it is mapped in user space
243  * @size: The number of bytes to synchronise
244  * @type: The direction to synchronise: 0 is sync to memory (clean),
245  * 1 is sync from memory (invalidate). Use the BASE_SYNCSET_OP_xxx constants.
246  * @padding: Padding to round up to a multiple of 8 bytes, must be zero
247  */
248 struct kbase_ioctl_mem_sync {
249 	__u64 handle;
250 	__u64 user_addr;
251 	__u64 size;
252 	__u8 type;
253 	__u8 padding[7];
254 };
255 
256 #define KBASE_IOCTL_MEM_SYNC _IOW(KBASE_IOCTL_TYPE, 15, struct kbase_ioctl_mem_sync)
257 
258 /**
259  * union kbase_ioctl_mem_find_cpu_offset - Find the offset of a CPU pointer
260  *
261  * @in: Input parameters
262  * @in.gpu_addr: The GPU address of the memory region
263  * @in.cpu_addr: The CPU address to locate
264  * @in.size: A size in bytes to validate is contained within the region
265  * @out: Output parameters
266  * @out.offset: The offset from the start of the memory region to @cpu_addr
267  */
268 union kbase_ioctl_mem_find_cpu_offset {
269 	struct {
270 		__u64 gpu_addr;
271 		__u64 cpu_addr;
272 		__u64 size;
273 	} in;
274 	struct {
275 		__u64 offset;
276 	} out;
277 };
278 
279 #define KBASE_IOCTL_MEM_FIND_CPU_OFFSET                                                            \
280 	_IOWR(KBASE_IOCTL_TYPE, 16, union kbase_ioctl_mem_find_cpu_offset)
281 
282 /**
283  * struct kbase_ioctl_get_context_id - Get the kernel context ID
284  *
285  * @id: The kernel context ID
286  */
287 struct kbase_ioctl_get_context_id {
288 	__u32 id;
289 };
290 
291 #define KBASE_IOCTL_GET_CONTEXT_ID _IOR(KBASE_IOCTL_TYPE, 17, struct kbase_ioctl_get_context_id)
292 
293 /**
294  * struct kbase_ioctl_tlstream_acquire - Acquire a tlstream fd
295  *
296  * @flags: Flags
297  *
298  * The ioctl returns a file descriptor when successful
299  */
300 struct kbase_ioctl_tlstream_acquire {
301 	__u32 flags;
302 };
303 
304 #define KBASE_IOCTL_TLSTREAM_ACQUIRE _IOW(KBASE_IOCTL_TYPE, 18, struct kbase_ioctl_tlstream_acquire)
305 
306 #define KBASE_IOCTL_TLSTREAM_FLUSH _IO(KBASE_IOCTL_TYPE, 19)
307 
308 /**
309  * struct kbase_ioctl_mem_commit - Change the amount of memory backing a region
310  *
311  * @gpu_addr: The memory region to modify
312  * @pages:    The number of physical pages that should be present
313  *
314  * The ioctl may return on the following error codes or 0 for success:
315  *   -ENOMEM: Out of memory
316  *   -EINVAL: Invalid arguments
317  */
318 struct kbase_ioctl_mem_commit {
319 	__u64 gpu_addr;
320 	__u64 pages;
321 };
322 
323 #define KBASE_IOCTL_MEM_COMMIT _IOW(KBASE_IOCTL_TYPE, 20, struct kbase_ioctl_mem_commit)
324 
325 /**
326  * union kbase_ioctl_mem_alias - Create an alias of memory regions
327  * @in: Input parameters
328  * @in.flags: Flags, see BASE_MEM_xxx
329  * @in.stride: Bytes between start of each memory region
330  * @in.nents: The number of regions to pack together into the alias
331  * @in.aliasing_info: Pointer to an array of struct base_mem_aliasing_info
332  * @out: Output parameters
333  * @out.flags: Flags, see BASE_MEM_xxx
334  * @out.gpu_va: Address of the new alias
335  * @out.va_pages: Size of the new alias
336  */
337 union kbase_ioctl_mem_alias {
338 	struct {
339 		__u64 flags;
340 		__u64 stride;
341 		__u64 nents;
342 		__u64 aliasing_info;
343 	} in;
344 	struct {
345 		__u64 flags;
346 		__u64 gpu_va;
347 		__u64 va_pages;
348 	} out;
349 };
350 
351 #define KBASE_IOCTL_MEM_ALIAS _IOWR(KBASE_IOCTL_TYPE, 21, union kbase_ioctl_mem_alias)
352 
353 /**
354  * union kbase_ioctl_mem_import - Import memory for use by the GPU
355  * @in: Input parameters
356  * @in.flags: Flags, see BASE_MEM_xxx
357  * @in.phandle: Handle to the external memory
358  * @in.type: Type of external memory, see base_mem_import_type
359  * @in.padding: Amount of extra VA pages to append to the imported buffer
360  * @out: Output parameters
361  * @out.flags: Flags, see BASE_MEM_xxx
362  * @out.gpu_va: Address of the new alias
363  * @out.va_pages: Size of the new alias
364  */
365 union kbase_ioctl_mem_import {
366 	struct {
367 		__u64 flags;
368 		__u64 phandle;
369 		__u32 type;
370 		__u32 padding;
371 	} in;
372 	struct {
373 		__u64 flags;
374 		__u64 gpu_va;
375 		__u64 va_pages;
376 	} out;
377 };
378 
379 #define KBASE_IOCTL_MEM_IMPORT _IOWR(KBASE_IOCTL_TYPE, 22, union kbase_ioctl_mem_import)
380 
381 /**
382  * struct kbase_ioctl_mem_flags_change - Change the flags for a memory region
383  * @gpu_va: The GPU region to modify
384  * @flags: The new flags to set
385  * @mask: Mask of the flags to modify
386  */
387 struct kbase_ioctl_mem_flags_change {
388 	__u64 gpu_va;
389 	__u64 flags;
390 	__u64 mask;
391 };
392 
393 #define KBASE_IOCTL_MEM_FLAGS_CHANGE _IOW(KBASE_IOCTL_TYPE, 23, struct kbase_ioctl_mem_flags_change)
394 
395 /**
396  * struct kbase_ioctl_stream_create - Create a synchronisation stream
397  * @name: A name to identify this stream. Must be NULL-terminated.
398  *
399  * Note that this is also called a "timeline", but is named stream to avoid
400  * confusion with other uses of the word.
401  *
402  * Unused bytes in @name (after the first NULL byte) must be also be NULL bytes.
403  *
404  * The ioctl returns a file descriptor.
405  */
406 struct kbase_ioctl_stream_create {
407 	char name[32];
408 };
409 
410 #define KBASE_IOCTL_STREAM_CREATE _IOW(KBASE_IOCTL_TYPE, 24, struct kbase_ioctl_stream_create)
411 
412 /**
413  * struct kbase_ioctl_fence_validate - Validate a fd refers to a fence
414  * @fd: The file descriptor to validate
415  */
416 struct kbase_ioctl_fence_validate {
417 	int fd;
418 };
419 
420 #define KBASE_IOCTL_FENCE_VALIDATE _IOW(KBASE_IOCTL_TYPE, 25, struct kbase_ioctl_fence_validate)
421 
422 /**
423  * struct kbase_ioctl_mem_profile_add - Provide profiling information to kernel
424  * @buffer: Pointer to the information
425  * @len: Length
426  * @padding: Padding
427  *
428  * The data provided is accessible through a debugfs file
429  */
430 struct kbase_ioctl_mem_profile_add {
431 	__u64 buffer;
432 	__u32 len;
433 	__u32 padding;
434 };
435 
436 #define KBASE_IOCTL_MEM_PROFILE_ADD _IOW(KBASE_IOCTL_TYPE, 27, struct kbase_ioctl_mem_profile_add)
437 
438 /**
439  * struct kbase_ioctl_sticky_resource_map - Permanently map an external resource
440  * @count: Number of resources
441  * @address: Array of __u64 GPU addresses of the external resources to map
442  */
443 struct kbase_ioctl_sticky_resource_map {
444 	__u64 count;
445 	__u64 address;
446 };
447 
448 #define KBASE_IOCTL_STICKY_RESOURCE_MAP                                                            \
449 	_IOW(KBASE_IOCTL_TYPE, 29, struct kbase_ioctl_sticky_resource_map)
450 
451 /**
452  * struct kbase_ioctl_sticky_resource_unmap - Unmap a resource mapped which was
453  *                                          previously permanently mapped
454  * @count: Number of resources
455  * @address: Array of __u64 GPU addresses of the external resources to unmap
456  */
457 struct kbase_ioctl_sticky_resource_unmap {
458 	__u64 count;
459 	__u64 address;
460 };
461 
462 #define KBASE_IOCTL_STICKY_RESOURCE_UNMAP                                                          \
463 	_IOW(KBASE_IOCTL_TYPE, 30, struct kbase_ioctl_sticky_resource_unmap)
464 
465 /**
466  * union kbase_ioctl_mem_find_gpu_start_and_offset - Find the start address of
467  *                                                   the GPU memory region for
468  *                                                   the given gpu address and
469  *                                                   the offset of that address
470  *                                                   into the region
471  * @in: Input parameters
472  * @in.gpu_addr: GPU virtual address
473  * @in.size: Size in bytes within the region
474  * @out: Output parameters
475  * @out.start: Address of the beginning of the memory region enclosing @gpu_addr
476  *             for the length of @offset bytes
477  * @out.offset: The offset from the start of the memory region to @gpu_addr
478  */
479 union kbase_ioctl_mem_find_gpu_start_and_offset {
480 	struct {
481 		__u64 gpu_addr;
482 		__u64 size;
483 	} in;
484 	struct {
485 		__u64 start;
486 		__u64 offset;
487 	} out;
488 };
489 
490 #define KBASE_IOCTL_MEM_FIND_GPU_START_AND_OFFSET                                                  \
491 	_IOWR(KBASE_IOCTL_TYPE, 31, union kbase_ioctl_mem_find_gpu_start_and_offset)
492 
493 #define KBASE_IOCTL_CINSTR_GWT_START _IO(KBASE_IOCTL_TYPE, 33)
494 
495 #define KBASE_IOCTL_CINSTR_GWT_STOP _IO(KBASE_IOCTL_TYPE, 34)
496 
497 /**
498  * union kbase_ioctl_cinstr_gwt_dump - Used to collect all GPU write fault
499  *                                     addresses.
500  * @in: Input parameters
501  * @in.addr_buffer: Address of buffer to hold addresses of gpu modified areas.
502  * @in.size_buffer: Address of buffer to hold size of modified areas (in pages)
503  * @in.len: Number of addresses the buffers can hold.
504  * @in.padding: padding
505  * @out: Output parameters
506  * @out.no_of_addr_collected: Number of addresses collected into addr_buffer.
507  * @out.more_data_available: Status indicating if more addresses are available.
508  * @out.padding: padding
509  *
510  * This structure is used when performing a call to dump GPU write fault
511  * addresses.
512  */
513 union kbase_ioctl_cinstr_gwt_dump {
514 	struct {
515 		__u64 addr_buffer;
516 		__u64 size_buffer;
517 		__u32 len;
518 		__u32 padding;
519 
520 	} in;
521 	struct {
522 		__u32 no_of_addr_collected;
523 		__u8 more_data_available;
524 		__u8 padding[27];
525 	} out;
526 };
527 
528 #define KBASE_IOCTL_CINSTR_GWT_DUMP _IOWR(KBASE_IOCTL_TYPE, 35, union kbase_ioctl_cinstr_gwt_dump)
529 
530 /**
531  * struct kbase_ioctl_mem_exec_init - Initialise the EXEC_VA memory zone
532  *
533  * @va_pages: Number of VA pages to reserve for EXEC_VA
534  */
535 struct kbase_ioctl_mem_exec_init {
536 	__u64 va_pages;
537 };
538 
539 #define KBASE_IOCTL_MEM_EXEC_INIT _IOW(KBASE_IOCTL_TYPE, 38, struct kbase_ioctl_mem_exec_init)
540 
541 /**
542  * union kbase_ioctl_get_cpu_gpu_timeinfo - Request zero or more types of
543  *                                          cpu/gpu time (counter values)
544  * @in: Input parameters
545  * @in.request_flags: Bit-flags indicating the requested types.
546  * @in.paddings:      Unused, size alignment matching the out.
547  * @out: Output parameters
548  * @out.sec:           Integer field of the monotonic time, unit in seconds.
549  * @out.nsec:          Fractional sec of the monotonic time, in nano-seconds.
550  * @out.padding:       Unused, for __u64 alignment
551  * @out.timestamp:     System wide timestamp (counter) value.
552  * @out.cycle_counter: GPU cycle counter value.
553  */
554 union kbase_ioctl_get_cpu_gpu_timeinfo {
555 	struct {
556 		__u32 request_flags;
557 		__u32 paddings[7];
558 	} in;
559 	struct {
560 		__u64 sec;
561 		__u32 nsec;
562 		__u32 padding;
563 		__u64 timestamp;
564 		__u64 cycle_counter;
565 	} out;
566 };
567 
568 #define KBASE_IOCTL_GET_CPU_GPU_TIMEINFO                                                           \
569 	_IOWR(KBASE_IOCTL_TYPE, 50, union kbase_ioctl_get_cpu_gpu_timeinfo)
570 
571 /**
572  * struct kbase_ioctl_context_priority_check - Check the max possible priority
573  * @priority: Input priority & output priority
574  */
575 
576 struct kbase_ioctl_context_priority_check {
577 	__u8 priority;
578 };
579 
580 #define KBASE_IOCTL_CONTEXT_PRIORITY_CHECK                                                         \
581 	_IOWR(KBASE_IOCTL_TYPE, 54, struct kbase_ioctl_context_priority_check)
582 
583 /**
584  * struct kbase_ioctl_set_limited_core_count - Set the limited core count.
585  *
586  * @max_core_count: Maximum core count
587  */
588 struct kbase_ioctl_set_limited_core_count {
589 	__u8 max_core_count;
590 };
591 
592 #define KBASE_IOCTL_SET_LIMITED_CORE_COUNT                                                         \
593 	_IOW(KBASE_IOCTL_TYPE, 55, struct kbase_ioctl_set_limited_core_count)
594 
595 /**
596  * struct kbase_ioctl_kinstr_prfcnt_enum_info - Enum Performance counter
597  *                                              information
598  * @info_item_size:  Performance counter item size in bytes.
599  * @info_item_count: Performance counter item count in the info_list_ptr.
600  * @info_list_ptr:   Performance counter item list pointer which points to a
601  *                   list with info_item_count of items.
602  *
603  * On success: returns info_item_size and info_item_count if info_list_ptr is
604  * NULL, returns performance counter information if info_list_ptr is not NULL.
605  * On error: returns a negative error code.
606  */
607 struct kbase_ioctl_kinstr_prfcnt_enum_info {
608 	__u32 info_item_size;
609 	__u32 info_item_count;
610 	__u64 info_list_ptr;
611 };
612 
613 #define KBASE_IOCTL_KINSTR_PRFCNT_ENUM_INFO                                                        \
614 	_IOWR(KBASE_IOCTL_TYPE, 56, struct kbase_ioctl_kinstr_prfcnt_enum_info)
615 
616 /**
617  * struct kbase_ioctl_kinstr_prfcnt_setup - Setup HWC dumper/reader
618  * @in: input parameters.
619  * @in.request_item_count: Number of requests in the requests array.
620  * @in.request_item_size:  Size in bytes of each request in the requests array.
621  * @in.requests_ptr:       Pointer to the requests array.
622  * @out: output parameters.
623  * @out.prfcnt_metadata_item_size: Size of each item in the metadata array for
624  *                                 each sample.
625  * @out.prfcnt_mmap_size_bytes:    Size in bytes that user-space should mmap
626  *                                 for reading performance counter samples.
627  *
628  * A fd is returned from the ioctl if successful, or a negative value on error.
629  */
630 union kbase_ioctl_kinstr_prfcnt_setup {
631 	struct {
632 		__u32 request_item_count;
633 		__u32 request_item_size;
634 		__u64 requests_ptr;
635 	} in;
636 	struct {
637 		__u32 prfcnt_metadata_item_size;
638 		__u32 prfcnt_mmap_size_bytes;
639 	} out;
640 };
641 
642 #define KBASE_IOCTL_KINSTR_PRFCNT_SETUP                                                            \
643 	_IOWR(KBASE_IOCTL_TYPE, 57, union kbase_ioctl_kinstr_prfcnt_setup)
644 
645 /***************
646  * test ioctls *
647  ***************/
648 #if MALI_UNIT_TEST
649 /* These ioctls are purely for test purposes and are not used in the production
650  * driver, they therefore may change without notice
651  */
652 
653 #define KBASE_IOCTL_TEST_TYPE (KBASE_IOCTL_TYPE + 1)
654 
655 
656 /**
657  * struct kbase_ioctl_tlstream_stats - Read tlstream stats for test purposes
658  * @bytes_collected: number of bytes read by user
659  * @bytes_generated: number of bytes generated by tracepoints
660  */
661 struct kbase_ioctl_tlstream_stats {
662 	__u32 bytes_collected;
663 	__u32 bytes_generated;
664 };
665 
666 #define KBASE_IOCTL_TLSTREAM_STATS _IOR(KBASE_IOCTL_TEST_TYPE, 2, struct kbase_ioctl_tlstream_stats)
667 
668 #endif /* MALI_UNIT_TEST */
669 
670 /* Customer extension range */
671 #define KBASE_IOCTL_EXTRA_TYPE (KBASE_IOCTL_TYPE + 2)
672 
673 /* If the integration needs extra ioctl add them there
674  * like this:
675  *
676  * struct my_ioctl_args {
677  *  ....
678  * }
679  *
680  * #define KBASE_IOCTL_MY_IOCTL \
681  *         _IOWR(KBASE_IOCTL_EXTRA_TYPE, 0, struct my_ioctl_args)
682  */
683 
684 /**********************************
685  * Definitions for GPU properties *
686  **********************************/
687 #define KBASE_GPUPROP_VALUE_SIZE_U8 (0x0)
688 #define KBASE_GPUPROP_VALUE_SIZE_U16 (0x1)
689 #define KBASE_GPUPROP_VALUE_SIZE_U32 (0x2)
690 #define KBASE_GPUPROP_VALUE_SIZE_U64 (0x3)
691 
692 #define KBASE_GPUPROP_PRODUCT_ID 1
693 #define KBASE_GPUPROP_VERSION_STATUS 2
694 #define KBASE_GPUPROP_MINOR_REVISION 3
695 #define KBASE_GPUPROP_MAJOR_REVISION 4
696 /* 5 previously used for GPU speed */
697 #define KBASE_GPUPROP_GPU_FREQ_KHZ_MAX 6
698 /* 7 previously used for minimum GPU speed */
699 #define KBASE_GPUPROP_LOG2_PROGRAM_COUNTER_SIZE 8
700 #define KBASE_GPUPROP_TEXTURE_FEATURES_0 9
701 #define KBASE_GPUPROP_TEXTURE_FEATURES_1 10
702 #define KBASE_GPUPROP_TEXTURE_FEATURES_2 11
703 #define KBASE_GPUPROP_GPU_AVAILABLE_MEMORY_SIZE 12
704 
705 #define KBASE_GPUPROP_L2_LOG2_LINE_SIZE 13
706 #define KBASE_GPUPROP_L2_LOG2_CACHE_SIZE 14
707 #define KBASE_GPUPROP_L2_NUM_L2_SLICES 15
708 
709 #define KBASE_GPUPROP_TILER_BIN_SIZE_BYTES 16
710 #define KBASE_GPUPROP_TILER_MAX_ACTIVE_LEVELS 17
711 
712 #define KBASE_GPUPROP_MAX_THREADS 18
713 #define KBASE_GPUPROP_MAX_WORKGROUP_SIZE 19
714 #define KBASE_GPUPROP_MAX_BARRIER_SIZE 20
715 #define KBASE_GPUPROP_MAX_REGISTERS 21
716 #define KBASE_GPUPROP_MAX_TASK_QUEUE 22
717 #define KBASE_GPUPROP_MAX_THREAD_GROUP_SPLIT 23
718 #define KBASE_GPUPROP_IMPL_TECH 24
719 
720 #define KBASE_GPUPROP_RAW_SHADER_PRESENT 25
721 #define KBASE_GPUPROP_RAW_TILER_PRESENT 26
722 #define KBASE_GPUPROP_RAW_L2_PRESENT 27
723 #define KBASE_GPUPROP_RAW_STACK_PRESENT 28
724 #define KBASE_GPUPROP_RAW_L2_FEATURES 29
725 #define KBASE_GPUPROP_RAW_CORE_FEATURES 30
726 #define KBASE_GPUPROP_RAW_MEM_FEATURES 31
727 #define KBASE_GPUPROP_RAW_MMU_FEATURES 32
728 #define KBASE_GPUPROP_RAW_AS_PRESENT 33
729 #define KBASE_GPUPROP_RAW_JS_PRESENT 34
730 #define KBASE_GPUPROP_RAW_JS_FEATURES_0 35
731 #define KBASE_GPUPROP_RAW_JS_FEATURES_1 36
732 #define KBASE_GPUPROP_RAW_JS_FEATURES_2 37
733 #define KBASE_GPUPROP_RAW_JS_FEATURES_3 38
734 #define KBASE_GPUPROP_RAW_JS_FEATURES_4 39
735 #define KBASE_GPUPROP_RAW_JS_FEATURES_5 40
736 #define KBASE_GPUPROP_RAW_JS_FEATURES_6 41
737 #define KBASE_GPUPROP_RAW_JS_FEATURES_7 42
738 #define KBASE_GPUPROP_RAW_JS_FEATURES_8 43
739 #define KBASE_GPUPROP_RAW_JS_FEATURES_9 44
740 #define KBASE_GPUPROP_RAW_JS_FEATURES_10 45
741 #define KBASE_GPUPROP_RAW_JS_FEATURES_11 46
742 #define KBASE_GPUPROP_RAW_JS_FEATURES_12 47
743 #define KBASE_GPUPROP_RAW_JS_FEATURES_13 48
744 #define KBASE_GPUPROP_RAW_JS_FEATURES_14 49
745 #define KBASE_GPUPROP_RAW_JS_FEATURES_15 50
746 #define KBASE_GPUPROP_RAW_TILER_FEATURES 51
747 #define KBASE_GPUPROP_RAW_TEXTURE_FEATURES_0 52
748 #define KBASE_GPUPROP_RAW_TEXTURE_FEATURES_1 53
749 #define KBASE_GPUPROP_RAW_TEXTURE_FEATURES_2 54
750 #define KBASE_GPUPROP_RAW_GPU_ID 55
751 #define KBASE_GPUPROP_RAW_THREAD_MAX_THREADS 56
752 #define KBASE_GPUPROP_RAW_THREAD_MAX_WORKGROUP_SIZE 57
753 #define KBASE_GPUPROP_RAW_THREAD_MAX_BARRIER_SIZE 58
754 #define KBASE_GPUPROP_RAW_THREAD_FEATURES 59
755 #define KBASE_GPUPROP_RAW_COHERENCY_MODE 60
756 
757 #define KBASE_GPUPROP_COHERENCY_NUM_GROUPS 61
758 #define KBASE_GPUPROP_COHERENCY_NUM_CORE_GROUPS 62
759 #define KBASE_GPUPROP_COHERENCY_COHERENCY 63
760 #define KBASE_GPUPROP_COHERENCY_GROUP_0 64
761 #define KBASE_GPUPROP_COHERENCY_GROUP_1 65
762 #define KBASE_GPUPROP_COHERENCY_GROUP_2 66
763 #define KBASE_GPUPROP_COHERENCY_GROUP_3 67
764 #define KBASE_GPUPROP_COHERENCY_GROUP_4 68
765 #define KBASE_GPUPROP_COHERENCY_GROUP_5 69
766 #define KBASE_GPUPROP_COHERENCY_GROUP_6 70
767 #define KBASE_GPUPROP_COHERENCY_GROUP_7 71
768 #define KBASE_GPUPROP_COHERENCY_GROUP_8 72
769 #define KBASE_GPUPROP_COHERENCY_GROUP_9 73
770 #define KBASE_GPUPROP_COHERENCY_GROUP_10 74
771 #define KBASE_GPUPROP_COHERENCY_GROUP_11 75
772 #define KBASE_GPUPROP_COHERENCY_GROUP_12 76
773 #define KBASE_GPUPROP_COHERENCY_GROUP_13 77
774 #define KBASE_GPUPROP_COHERENCY_GROUP_14 78
775 #define KBASE_GPUPROP_COHERENCY_GROUP_15 79
776 
777 #define KBASE_GPUPROP_TEXTURE_FEATURES_3 80
778 #define KBASE_GPUPROP_RAW_TEXTURE_FEATURES_3 81
779 
780 #define KBASE_GPUPROP_NUM_EXEC_ENGINES 82
781 
782 #define KBASE_GPUPROP_RAW_THREAD_TLS_ALLOC 83
783 #define KBASE_GPUPROP_TLS_ALLOC 84
784 #define KBASE_GPUPROP_RAW_GPU_FEATURES 85
785 #ifdef __cpluscplus
786 }
787 #endif
788 
789 #endif /* _UAPI_KBASE_IOCTL_H_ */
790