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