| 1 | + | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ |
| 2 | + | /* |
| 3 | + | * |
| 4 | + | * (C) COPYRIGHT 2019-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_BASE_JM_KERNEL_H_ |
| 23 | + | #define _UAPI_BASE_JM_KERNEL_H_ |
| 24 | + | |
| 25 | + | #include <linux/types.h> |
| 26 | + | |
| 27 | + | typedef __u32 base_mem_alloc_flags; |
| 28 | + | /* Memory allocation, access/hint flags. |
| 29 | + | * |
| 30 | + | * See base_mem_alloc_flags. |
| 31 | + | */ |
| 32 | + | |
| 33 | + | /* IN */ |
| 34 | + | /* Read access CPU side |
| 35 | + | */ |
| 36 | + | #define BASE_MEM_PROT_CPU_RD ((base_mem_alloc_flags)1 << 0) |
| 37 | + | |
| 38 | + | /* Write access CPU side |
| 39 | + | */ |
| 40 | + | #define BASE_MEM_PROT_CPU_WR ((base_mem_alloc_flags)1 << 1) |
| 41 | + | |
| 42 | + | /* Read access GPU side |
| 43 | + | */ |
| 44 | + | #define BASE_MEM_PROT_GPU_RD ((base_mem_alloc_flags)1 << 2) |
| 45 | + | |
| 46 | + | /* Write access GPU side |
| 47 | + | */ |
| 48 | + | #define BASE_MEM_PROT_GPU_WR ((base_mem_alloc_flags)1 << 3) |
| 49 | + | |
| 50 | + | /* Execute allowed on the GPU side |
| 51 | + | */ |
| 52 | + | #define BASE_MEM_PROT_GPU_EX ((base_mem_alloc_flags)1 << 4) |
| 53 | + | |
| 54 | + | /* Will be permanently mapped in kernel space. |
| 55 | + | * Flag is only allowed on allocations originating from kbase. |
| 56 | + | */ |
| 57 | + | #define BASEP_MEM_PERMANENT_KERNEL_MAPPING ((base_mem_alloc_flags)1 << 5) |
| 58 | + | |
| 59 | + | /* The allocation will completely reside within the same 4GB chunk in the GPU |
| 60 | + | * virtual space. |
| 61 | + | * Since this flag is primarily required only for the TLS memory which will |
| 62 | + | * not be used to contain executable code and also not used for Tiler heap, |
| 63 | + | * it can't be used along with BASE_MEM_PROT_GPU_EX and TILER_ALIGN_TOP flags. |
| 64 | + | */ |
| 65 | + | #define BASE_MEM_GPU_VA_SAME_4GB_PAGE ((base_mem_alloc_flags)1 << 6) |
| 66 | + | |
| 67 | + | /* Userspace is not allowed to free this memory. |
| 68 | + | * Flag is only allowed on allocations originating from kbase. |
| 69 | + | */ |
| 70 | + | #define BASEP_MEM_NO_USER_FREE ((base_mem_alloc_flags)1 << 7) |
| 71 | + | |
| 72 | + | #define BASE_MEM_RESERVED_BIT_8 ((base_mem_alloc_flags)1 << 8) |
| 73 | + | |
| 74 | + | /* Grow backing store on GPU Page Fault |
| 75 | + | */ |
| 76 | + | #define BASE_MEM_GROW_ON_GPF ((base_mem_alloc_flags)1 << 9) |
| 77 | + | |
| 78 | + | /* Page coherence Outer shareable, if available |
| 79 | + | */ |
| 80 | + | #define BASE_MEM_COHERENT_SYSTEM ((base_mem_alloc_flags)1 << 10) |
| 81 | + | |
| 82 | + | /* Page coherence Inner shareable |
| 83 | + | */ |
| 84 | + | #define BASE_MEM_COHERENT_LOCAL ((base_mem_alloc_flags)1 << 11) |
| 85 | + | |
| 86 | + | /* IN/OUT */ |
| 87 | + | /* Should be cached on the CPU, returned if actually cached |
| 88 | + | */ |
| 89 | + | #define BASE_MEM_CACHED_CPU ((base_mem_alloc_flags)1 << 12) |
| 90 | + | |
| 91 | + | /* IN/OUT */ |
| 92 | + | /* Must have same VA on both the GPU and the CPU |
| 93 | + | */ |
| 94 | + | #define BASE_MEM_SAME_VA ((base_mem_alloc_flags)1 << 13) |
| 95 | + | |
| 96 | + | /* OUT */ |
| 97 | + | /* Must call mmap to acquire a GPU address for the allocation |
| 98 | + | */ |
| 99 | + | #define BASE_MEM_NEED_MMAP ((base_mem_alloc_flags)1 << 14) |
| 100 | + | |
| 101 | + | /* IN */ |
| 102 | + | /* Page coherence Outer shareable, required. |
| 103 | + | */ |
| 104 | + | #define BASE_MEM_COHERENT_SYSTEM_REQUIRED ((base_mem_alloc_flags)1 << 15) |
| 105 | + | |
| 106 | + | /* Protected memory |
| 107 | + | */ |
| 108 | + | #define BASE_MEM_PROTECTED ((base_mem_alloc_flags)1 << 16) |
| 109 | + | |
| 110 | + | /* Not needed physical memory |
| 111 | + | */ |
| 112 | + | #define BASE_MEM_DONT_NEED ((base_mem_alloc_flags)1 << 17) |
| 113 | + | |
| 114 | + | /* Must use shared CPU/GPU zone (SAME_VA zone) but doesn't require the |
| 115 | + | * addresses to be the same |
| 116 | + | */ |
| 117 | + | #define BASE_MEM_IMPORT_SHARED ((base_mem_alloc_flags)1 << 18) |
| 118 | + | |
| 119 | + | /** |
| 120 | + | * Bit 19 is reserved. |
| 121 | + | * |
| 122 | + | * Do not remove, use the next unreserved bit for new flags |
| 123 | + | */ |
| 124 | + | #define BASE_MEM_RESERVED_BIT_19 ((base_mem_alloc_flags)1 << 19) |
| 125 | + | |
| 126 | + | /** |
| 127 | + | * Memory starting from the end of the initial commit is aligned to 'extension' |
| 128 | + | * pages, where 'extension' must be a power of 2 and no more than |
| 129 | + | * BASE_MEM_TILER_ALIGN_TOP_EXTENSION_MAX_PAGES |
| 130 | + | */ |
| 131 | + | #define BASE_MEM_TILER_ALIGN_TOP ((base_mem_alloc_flags)1 << 20) |
| 132 | + | |
| 133 | + | /* Should be uncached on the GPU, will work only for GPUs using AARCH64 mmu |
| 134 | + | * mode. Some components within the GPU might only be able to access memory |
| 135 | + | * that is GPU cacheable. Refer to the specific GPU implementation for more |
| 136 | + | * details. The 3 shareability flags will be ignored for GPU uncached memory. |
| 137 | + | * If used while importing USER_BUFFER type memory, then the import will fail |
| 138 | + | * if the memory is not aligned to GPU and CPU cache line width. |
| 139 | + | */ |
| 140 | + | #define BASE_MEM_UNCACHED_GPU ((base_mem_alloc_flags)1 << 21) |
| 141 | + | |
| 142 | + | /* |
| 143 | + | * Bits [22:25] for group_id (0~15). |
| 144 | + | * |
| 145 | + | * base_mem_group_id_set() should be used to pack a memory group ID into a |
| 146 | + | * base_mem_alloc_flags value instead of accessing the bits directly. |
| 147 | + | * base_mem_group_id_get() should be used to extract the memory group ID from |
| 148 | + | * a base_mem_alloc_flags value. |
| 149 | + | */ |
| 150 | + | #define BASEP_MEM_GROUP_ID_SHIFT 22 |
| 151 | + | #define BASE_MEM_GROUP_ID_MASK \ |
| 152 | + | ((base_mem_alloc_flags)0xF << BASEP_MEM_GROUP_ID_SHIFT) |
| 153 | + | |
| 154 | + | /* Must do CPU cache maintenance when imported memory is mapped/unmapped |
| 155 | + | * on GPU. Currently applicable to dma-buf type only. |
| 156 | + | */ |
| 157 | + | #define BASE_MEM_IMPORT_SYNC_ON_MAP_UNMAP ((base_mem_alloc_flags)1 << 26) |
| 158 | + | |
| 159 | + | /* Use the GPU VA chosen by the kernel client */ |
| 160 | + | #define BASE_MEM_FLAG_MAP_FIXED ((base_mem_alloc_flags)1 << 27) |
| 161 | + | |
| 162 | + | /* OUT */ |
| 163 | + | /* Kernel side cache sync ops required */ |
| 164 | + | #define BASE_MEM_KERNEL_SYNC ((base_mem_alloc_flags)1 << 28) |
| 165 | + | |
| 166 | + | /* Force trimming of JIT allocations when creating a new allocation */ |
| 167 | + | #define BASEP_MEM_PERFORM_JIT_TRIM ((base_mem_alloc_flags)1 << 29) |
| 168 | + | |
| 169 | + | /* Number of bits used as flags for base memory management |
| 170 | + | * |
| 171 | + | * Must be kept in sync with the base_mem_alloc_flags flags |
| 172 | + | */ |
| 173 | + | #define BASE_MEM_FLAGS_NR_BITS 30 |
| 174 | + | |
| 175 | + | /* A mask of all the flags which are only valid for allocations within kbase, |
| 176 | + | * and may not be passed from user space. |
| 177 | + | */ |
| 178 | + | #define BASEP_MEM_FLAGS_KERNEL_ONLY \ |
| 179 | + | (BASEP_MEM_PERMANENT_KERNEL_MAPPING | BASEP_MEM_NO_USER_FREE | \ |
| 180 | + | BASE_MEM_FLAG_MAP_FIXED | BASEP_MEM_PERFORM_JIT_TRIM) |
| 181 | + | |
| 182 | + | /* A mask for all output bits, excluding IN/OUT bits. |
| 183 | + | */ |
| 184 | + | #define BASE_MEM_FLAGS_OUTPUT_MASK BASE_MEM_NEED_MMAP |
| 185 | + | |
| 186 | + | /* A mask for all input bits, including IN/OUT bits. |
| 187 | + | */ |
| 188 | + | #define BASE_MEM_FLAGS_INPUT_MASK \ |
| 189 | + | (((1 << BASE_MEM_FLAGS_NR_BITS) - 1) & ~BASE_MEM_FLAGS_OUTPUT_MASK) |
| 190 | + | |
| 191 | + | /* A mask of all currently reserved flags |
| 192 | + | */ |
| 193 | + | #define BASE_MEM_FLAGS_RESERVED \ |
| 194 | + | (BASE_MEM_RESERVED_BIT_8 | BASE_MEM_RESERVED_BIT_19) |
| 195 | + | |
| 196 | + | #define BASEP_MEM_INVALID_HANDLE (0ull << 12) |
| 197 | + | #define BASE_MEM_MMU_DUMP_HANDLE (1ull << 12) |
| 198 | + | #define BASE_MEM_TRACE_BUFFER_HANDLE (2ull << 12) |
| 199 | + | #define BASE_MEM_MAP_TRACKING_HANDLE (3ull << 12) |
| 200 | + | #define BASEP_MEM_WRITE_ALLOC_PAGES_HANDLE (4ull << 12) |
| 201 | + | /* reserved handles ..-47<<PAGE_SHIFT> for future special handles */ |
| 202 | + | #define BASE_MEM_COOKIE_BASE (64ul << 12) |
| 203 | + | #define BASE_MEM_FIRST_FREE_ADDRESS ((BITS_PER_LONG << 12) + \ |
| 204 | + | BASE_MEM_COOKIE_BASE) |
| 205 | + | |
| 206 | + | /* Similar to BASE_MEM_TILER_ALIGN_TOP, memory starting from the end of the |
| 207 | + | * initial commit is aligned to 'extension' pages, where 'extension' must be a power |
| 208 | + | * of 2 and no more than BASE_MEM_TILER_ALIGN_TOP_EXTENSION_MAX_PAGES |
| 209 | + | */ |
| 210 | + | #define BASE_JIT_ALLOC_MEM_TILER_ALIGN_TOP (1 << 0) |
| 211 | + | |
| 212 | + | /** |
| 213 | + | * If set, the heap info address points to a __u32 holding the used size in bytes; |
| 214 | + | * otherwise it points to a __u64 holding the lowest address of unused memory. |
| 215 | + | */ |
| 216 | + | #define BASE_JIT_ALLOC_HEAP_INFO_IS_SIZE (1 << 1) |
| 217 | + | |
| 218 | + | /** |
| 219 | + | * Valid set of just-in-time memory allocation flags |
| 220 | + | * |
| 221 | + | * Note: BASE_JIT_ALLOC_HEAP_INFO_IS_SIZE cannot be set if heap_info_gpu_addr |
| 222 | + | * in %base_jit_alloc_info is 0 (atom with BASE_JIT_ALLOC_HEAP_INFO_IS_SIZE set |
| 223 | + | * and heap_info_gpu_addr being 0 will be rejected). |
| 224 | + | */ |
| 225 | + | #define BASE_JIT_ALLOC_VALID_FLAGS \ |
| 226 | + | (BASE_JIT_ALLOC_MEM_TILER_ALIGN_TOP | BASE_JIT_ALLOC_HEAP_INFO_IS_SIZE) |
| 227 | + | |
| 228 | + | /** |
| 229 | + | * typedef base_context_create_flags - Flags to pass to ::base_context_init. |
| 230 | + | * |
| 231 | + | * Flags can be ORed together to enable multiple things. |
| 232 | + | * |
| 233 | + | * These share the same space as BASEP_CONTEXT_FLAG_*, and so must |
| 234 | + | * not collide with them. |
| 235 | + | */ |
| 236 | + | typedef __u32 base_context_create_flags; |
| 237 | + | |
| 238 | + | /* No flags set */ |
| 239 | + | #define BASE_CONTEXT_CREATE_FLAG_NONE ((base_context_create_flags)0) |
| 240 | + | |
| 241 | + | /* Base context is embedded in a cctx object (flag used for CINSTR |
| 242 | + | * software counter macros) |
| 243 | + | */ |
| 244 | + | #define BASE_CONTEXT_CCTX_EMBEDDED ((base_context_create_flags)1 << 0) |
| 245 | + | |
| 246 | + | /* Base context is a 'System Monitor' context for Hardware counters. |
| 247 | + | * |
| 248 | + | * One important side effect of this is that job submission is disabled. |
| 249 | + | */ |
| 250 | + | #define BASE_CONTEXT_SYSTEM_MONITOR_SUBMIT_DISABLED \ |
| 251 | + | ((base_context_create_flags)1 << 1) |
| 252 | + | |
| 253 | + | /* Bit-shift used to encode a memory group ID in base_context_create_flags |
| 254 | + | */ |
| 255 | + | #define BASEP_CONTEXT_MMU_GROUP_ID_SHIFT (3) |
| 256 | + | |
| 257 | + | /* Bitmask used to encode a memory group ID in base_context_create_flags |
| 258 | + | */ |
| 259 | + | #define BASEP_CONTEXT_MMU_GROUP_ID_MASK \ |
| 260 | + | ((base_context_create_flags)0xF << BASEP_CONTEXT_MMU_GROUP_ID_SHIFT) |
| 261 | + | |
| 262 | + | /* Bitpattern describing the base_context_create_flags that can be |
| 263 | + | * passed to the kernel |
| 264 | + | */ |
| 265 | + | #define BASEP_CONTEXT_CREATE_KERNEL_FLAGS \ |
| 266 | + | (BASE_CONTEXT_SYSTEM_MONITOR_SUBMIT_DISABLED | \ |
| 267 | + | BASEP_CONTEXT_MMU_GROUP_ID_MASK) |
| 268 | + | |
| 269 | + | /* Bitpattern describing the ::base_context_create_flags that can be |
| 270 | + | * passed to base_context_init() |
| 271 | + | */ |
| 272 | + | #define BASEP_CONTEXT_CREATE_ALLOWED_FLAGS \ |
| 273 | + | (BASE_CONTEXT_CCTX_EMBEDDED | BASEP_CONTEXT_CREATE_KERNEL_FLAGS) |
| 274 | + | |
| 275 | + | /* |
| 276 | + | * Private flags used on the base context |
| 277 | + | * |
| 278 | + | * These start at bit 31, and run down to zero. |
| 279 | + | * |
| 280 | + | * They share the same space as base_context_create_flags, and so must |
| 281 | + | * not collide with them. |
| 282 | + | */ |
| 283 | + | |
| 284 | + | /* Private flag tracking whether job descriptor dumping is disabled */ |
| 285 | + | #define BASEP_CONTEXT_FLAG_JOB_DUMP_DISABLED \ |
| 286 | + | ((base_context_create_flags)(1 << 31)) |
| 287 | + | |
| 288 | + | /* Enable additional tracepoints for latency measurements (TL_ATOM_READY, |
| 289 | + | * TL_ATOM_DONE, TL_ATOM_PRIO_CHANGE, TL_ATOM_EVENT_POST) |
| 290 | + | */ |
| 291 | + | #define BASE_TLSTREAM_ENABLE_LATENCY_TRACEPOINTS (1 << 0) |
| 292 | + | |
| 293 | + | /* Indicate that job dumping is enabled. This could affect certain timers |
| 294 | + | * to account for the performance impact. |
| 295 | + | */ |
| 296 | + | #define BASE_TLSTREAM_JOB_DUMPING_ENABLED (1 << 1) |
| 297 | + | |
| 298 | + | #define BASE_TLSTREAM_FLAGS_MASK (BASE_TLSTREAM_ENABLE_LATENCY_TRACEPOINTS | \ |
| 299 | + | BASE_TLSTREAM_JOB_DUMPING_ENABLED) |
| 300 | + | /* |
| 301 | + | * Dependency stuff, keep it private for now. May want to expose it if |
| 302 | + | * we decide to make the number of semaphores a configurable |
| 303 | + | * option. |
| 304 | + | */ |
| 305 | + | #define BASE_JD_ATOM_COUNT 256 |
| 306 | + | |
| 307 | + | /* Maximum number of concurrent render passes. |
| 308 | + | */ |
| 309 | + | #define BASE_JD_RP_COUNT (256) |
| 310 | + | |
| 311 | + | /* Set/reset values for a software event */ |
| 312 | + | #define BASE_JD_SOFT_EVENT_SET ((unsigned char)1) |
| 313 | + | #define BASE_JD_SOFT_EVENT_RESET ((unsigned char)0) |
| 314 | + | |
| 315 | + | /** |
| 316 | + | * struct base_jd_udata - Per-job data |
| 317 | + | * |
| 318 | + | * This structure is used to store per-job data, and is completely unused |
| 319 | + | * by the Base driver. It can be used to store things such as callback |
| 320 | + | * function pointer, data to handle job completion. It is guaranteed to be |
| 321 | + | * untouched by the Base driver. |
| 322 | + | * |
| 323 | + | * @blob: per-job data array |
| 324 | + | */ |
| 325 | + | struct base_jd_udata { |
| 326 | + | __u64 blob[2]; |
| 327 | + | }; |
| 328 | + | |
| 329 | + | /** |
| 330 | + | * typedef base_jd_dep_type - Job dependency type. |
| 331 | + | * |
| 332 | + | * A flags field will be inserted into the atom structure to specify whether a |
| 333 | + | * dependency is a data or ordering dependency (by putting it before/after |
| 334 | + | * 'core_req' in the structure it should be possible to add without changing |
| 335 | + | * the structure size). |
| 336 | + | * When the flag is set for a particular dependency to signal that it is an |
| 337 | + | * ordering only dependency then errors will not be propagated. |
| 338 | + | */ |
| 339 | + | typedef __u8 base_jd_dep_type; |
| 340 | + | |
| 341 | + | #define BASE_JD_DEP_TYPE_INVALID (0) /**< Invalid dependency */ |
| 342 | + | #define BASE_JD_DEP_TYPE_DATA (1U << 0) /**< Data dependency */ |
| 343 | + | #define BASE_JD_DEP_TYPE_ORDER (1U << 1) /**< Order dependency */ |
| 344 | + | |
| 345 | + | /** |
| 346 | + | * typedef base_jd_core_req - Job chain hardware requirements. |
| 347 | + | * |
| 348 | + | * A job chain must specify what GPU features it needs to allow the |
| 349 | + | * driver to schedule the job correctly. By not specifying the |
| 350 | + | * correct settings can/will cause an early job termination. Multiple |
| 351 | + | * values can be ORed together to specify multiple requirements. |
| 352 | + | * Special case is ::BASE_JD_REQ_DEP, which is used to express complex |
| 353 | + | * dependencies, and that doesn't execute anything on the hardware. |
| 354 | + | */ |
| 355 | + | typedef __u32 base_jd_core_req; |
| 356 | + | |
| 357 | + | /* Requirements that come from the HW */ |
| 358 | + | |
| 359 | + | /* No requirement, dependency only |
| 360 | + | */ |
| 361 | + | #define BASE_JD_REQ_DEP ((base_jd_core_req)0) |
| 362 | + | |
| 363 | + | /* Requires fragment shaders |
| 364 | + | */ |
| 365 | + | #define BASE_JD_REQ_FS ((base_jd_core_req)1 << 0) |
| 366 | + | |
| 367 | + | /* Requires compute shaders |
| 368 | + | * |
| 369 | + | * This covers any of the following GPU job types: |
| 370 | + | * - Vertex Shader Job |
| 371 | + | * - Geometry Shader Job |
| 372 | + | * - An actual Compute Shader Job |
| 373 | + | * |
| 374 | + | * Compare this with BASE_JD_REQ_ONLY_COMPUTE, which specifies that the |
| 375 | + | * job is specifically just the "Compute Shader" job type, and not the "Vertex |
| 376 | + | * Shader" nor the "Geometry Shader" job type. |
| 377 | + | */ |
| 378 | + | #define BASE_JD_REQ_CS ((base_jd_core_req)1 << 1) |
| 379 | + | |
| 380 | + | /* Requires tiling */ |
| 381 | + | #define BASE_JD_REQ_T ((base_jd_core_req)1 << 2) |
| 382 | + | |
| 383 | + | /* Requires cache flushes */ |
| 384 | + | #define BASE_JD_REQ_CF ((base_jd_core_req)1 << 3) |
| 385 | + | |
| 386 | + | /* Requires value writeback */ |
| 387 | + | #define BASE_JD_REQ_V ((base_jd_core_req)1 << 4) |
| 388 | + | |
| 389 | + | /* SW-only requirements - the HW does not expose these as part of the job slot |
| 390 | + | * capabilities |
| 391 | + | */ |
| 392 | + | |
| 393 | + | /* Requires fragment job with AFBC encoding */ |
| 394 | + | #define BASE_JD_REQ_FS_AFBC ((base_jd_core_req)1 << 13) |
| 395 | + | |
| 396 | + | /* SW-only requirement: coalesce completion events. |
| 397 | + | * If this bit is set then completion of this atom will not cause an event to |
| 398 | + | * be sent to userspace, whether successful or not; completion events will be |
| 399 | + | * deferred until an atom completes which does not have this bit set. |
| 400 | + | * |
| 401 | + | * This bit may not be used in combination with BASE_JD_REQ_EXTERNAL_RESOURCES. |
| 402 | + | */ |
| 403 | + | #define BASE_JD_REQ_EVENT_COALESCE ((base_jd_core_req)1 << 5) |
| 404 | + | |
| 405 | + | /* SW Only requirement: the job chain requires a coherent core group. We don't |
| 406 | + | * mind which coherent core group is used. |
| 407 | + | */ |
| 408 | + | #define BASE_JD_REQ_COHERENT_GROUP ((base_jd_core_req)1 << 6) |
| 409 | + | |
| 410 | + | /* SW Only requirement: The performance counters should be enabled only when |
| 411 | + | * they are needed, to reduce power consumption. |
| 412 | + | */ |
| 413 | + | #define BASE_JD_REQ_PERMON ((base_jd_core_req)1 << 7) |
| 414 | + | |
| 415 | + | /* SW Only requirement: External resources are referenced by this atom. |
| 416 | + | * |
| 417 | + | * This bit may not be used in combination with BASE_JD_REQ_EVENT_COALESCE and |
| 418 | + | * BASE_JD_REQ_SOFT_EVENT_WAIT. |
| 419 | + | */ |
| 420 | + | #define BASE_JD_REQ_EXTERNAL_RESOURCES ((base_jd_core_req)1 << 8) |
| 421 | + | |
| 422 | + | /* SW Only requirement: Software defined job. Jobs with this bit set will not be |
| 423 | + | * submitted to the hardware but will cause some action to happen within the |
| 424 | + | * driver |
| 425 | + | */ |
| 426 | + | #define BASE_JD_REQ_SOFT_JOB ((base_jd_core_req)1 << 9) |
| 427 | + | |
| 428 | + | #define BASE_JD_REQ_SOFT_DUMP_CPU_GPU_TIME (BASE_JD_REQ_SOFT_JOB | 0x1) |
| 429 | + | #define BASE_JD_REQ_SOFT_FENCE_TRIGGER (BASE_JD_REQ_SOFT_JOB | 0x2) |
| 430 | + | #define BASE_JD_REQ_SOFT_FENCE_WAIT (BASE_JD_REQ_SOFT_JOB | 0x3) |
| 431 | + | |
| 432 | + | /* 0x4 RESERVED for now */ |
| 433 | + | |
| 434 | + | /* SW only requirement: event wait/trigger job. |
| 435 | + | * |
| 436 | + | * - BASE_JD_REQ_SOFT_EVENT_WAIT: this job will block until the event is set. |
| 437 | + | * - BASE_JD_REQ_SOFT_EVENT_SET: this job sets the event, thus unblocks the |
| 438 | + | * other waiting jobs. It completes immediately. |
| 439 | + | * - BASE_JD_REQ_SOFT_EVENT_RESET: this job resets the event, making it |
| 440 | + | * possible for other jobs to wait upon. It completes immediately. |
| 441 | + | */ |
| 442 | + | #define BASE_JD_REQ_SOFT_EVENT_WAIT (BASE_JD_REQ_SOFT_JOB | 0x5) |
| 443 | + | #define BASE_JD_REQ_SOFT_EVENT_SET (BASE_JD_REQ_SOFT_JOB | 0x6) |
| 444 | + | #define BASE_JD_REQ_SOFT_EVENT_RESET (BASE_JD_REQ_SOFT_JOB | 0x7) |
| 445 | + | |
| 446 | + | #define BASE_JD_REQ_SOFT_DEBUG_COPY (BASE_JD_REQ_SOFT_JOB | 0x8) |
| 447 | + | |
| 448 | + | /* SW only requirement: Just In Time allocation |
| 449 | + | * |
| 450 | + | * This job requests a single or multiple just-in-time allocations through a |
| 451 | + | * list of base_jit_alloc_info structure which is passed via the jc element of |
| 452 | + | * the atom. The number of base_jit_alloc_info structures present in the |
| 453 | + | * list is passed via the nr_extres element of the atom |
| 454 | + | * |
| 455 | + | * It should be noted that the id entry in base_jit_alloc_info must not |
| 456 | + | * be reused until it has been released via BASE_JD_REQ_SOFT_JIT_FREE. |
| 457 | + | * |
| 458 | + | * Should this soft job fail it is expected that a BASE_JD_REQ_SOFT_JIT_FREE |
| 459 | + | * soft job to free the JIT allocation is still made. |
| 460 | + | * |
| 461 | + | * The job will complete immediately. |
| 462 | + | */ |
| 463 | + | #define BASE_JD_REQ_SOFT_JIT_ALLOC (BASE_JD_REQ_SOFT_JOB | 0x9) |
| 464 | + | |
| 465 | + | /* SW only requirement: Just In Time free |
| 466 | + | * |
| 467 | + | * This job requests a single or multiple just-in-time allocations created by |
| 468 | + | * BASE_JD_REQ_SOFT_JIT_ALLOC to be freed. The ID list of the just-in-time |
| 469 | + | * allocations is passed via the jc element of the atom. |
| 470 | + | * |
| 471 | + | * The job will complete immediately. |
| 472 | + | */ |
| 473 | + | #define BASE_JD_REQ_SOFT_JIT_FREE (BASE_JD_REQ_SOFT_JOB | 0xa) |
| 474 | + | |
| 475 | + | /* SW only requirement: Map external resource |
| 476 | + | * |
| 477 | + | * This job requests external resource(s) are mapped once the dependencies |
| 478 | + | * of the job have been satisfied. The list of external resources are |
| 479 | + | * passed via the jc element of the atom which is a pointer to a |
| 480 | + | * base_external_resource_list. |
| 481 | + | */ |
| 482 | + | #define BASE_JD_REQ_SOFT_EXT_RES_MAP (BASE_JD_REQ_SOFT_JOB | 0xb) |
| 483 | + | |
| 484 | + | /* SW only requirement: Unmap external resource |
| 485 | + | * |
| 486 | + | * This job requests external resource(s) are unmapped once the dependencies |
| 487 | + | * of the job has been satisfied. The list of external resources are |
| 488 | + | * passed via the jc element of the atom which is a pointer to a |
| 489 | + | * base_external_resource_list. |
| 490 | + | */ |
| 491 | + | #define BASE_JD_REQ_SOFT_EXT_RES_UNMAP (BASE_JD_REQ_SOFT_JOB | 0xc) |
| 492 | + | |
| 493 | + | /* HW Requirement: Requires Compute shaders (but not Vertex or Geometry Shaders) |
| 494 | + | * |
| 495 | + | * This indicates that the Job Chain contains GPU jobs of the 'Compute |
| 496 | + | * Shaders' type. |
| 497 | + | * |
| 498 | + | * In contrast to BASE_JD_REQ_CS, this does not indicate that the Job |
| 499 | + | * Chain contains 'Geometry Shader' or 'Vertex Shader' jobs. |
| 500 | + | */ |
| 501 | + | #define BASE_JD_REQ_ONLY_COMPUTE ((base_jd_core_req)1 << 10) |
| 502 | + | |
| 503 | + | /* HW Requirement: Use the base_jd_atom::device_nr field to specify a |
| 504 | + | * particular core group |
| 505 | + | * |
| 506 | + | * If both BASE_JD_REQ_COHERENT_GROUP and this flag are set, this flag |
| 507 | + | * takes priority |
| 508 | + | * |
| 509 | + | * This is only guaranteed to work for BASE_JD_REQ_ONLY_COMPUTE atoms. |
| 510 | + | * |
| 511 | + | * If the core availability policy is keeping the required core group turned |
| 512 | + | * off, then the job will fail with a BASE_JD_EVENT_PM_EVENT error code. |
| 513 | + | */ |
| 514 | + | #define BASE_JD_REQ_SPECIFIC_COHERENT_GROUP ((base_jd_core_req)1 << 11) |
| 515 | + | |
| 516 | + | /* SW Flag: If this bit is set then the successful completion of this atom |
| 517 | + | * will not cause an event to be sent to userspace |
| 518 | + | */ |
| 519 | + | #define BASE_JD_REQ_EVENT_ONLY_ON_FAILURE ((base_jd_core_req)1 << 12) |
| 520 | + | |
| 521 | + | /* SW Flag: If this bit is set then completion of this atom will not cause an |
| 522 | + | * event to be sent to userspace, whether successful or not. |
| 523 | + | */ |
| 524 | + | #define BASEP_JD_REQ_EVENT_NEVER ((base_jd_core_req)1 << 14) |
| 525 | + | |
| 526 | + | /* SW Flag: Skip GPU cache clean and invalidation before starting a GPU job. |
| 527 | + | * |
| 528 | + | * If this bit is set then the GPU's cache will not be cleaned and invalidated |
| 529 | + | * until a GPU job starts which does not have this bit set or a job completes |
| 530 | + | * which does not have the BASE_JD_REQ_SKIP_CACHE_END bit set. Do not use |
| 531 | + | * if the CPU may have written to memory addressed by the job since the last job |
| 532 | + | * without this bit set was submitted. |
| 533 | + | */ |
| 534 | + | #define BASE_JD_REQ_SKIP_CACHE_START ((base_jd_core_req)1 << 15) |
| 535 | + | |
| 536 | + | /* SW Flag: Skip GPU cache clean and invalidation after a GPU job completes. |
| 537 | + | * |
| 538 | + | * If this bit is set then the GPU's cache will not be cleaned and invalidated |
| 539 | + | * until a GPU job completes which does not have this bit set or a job starts |
| 540 | + | * which does not have the BASE_JD_REQ_SKIP_CACHE_START bit set. Do not use |
| 541 | + | * if the CPU may read from or partially overwrite memory addressed by the job |
| 542 | + | * before the next job without this bit set completes. |
| 543 | + | */ |
| 544 | + | #define BASE_JD_REQ_SKIP_CACHE_END ((base_jd_core_req)1 << 16) |
| 545 | + | |
| 546 | + | /* Request the atom be executed on a specific job slot. |
| 547 | + | * |
| 548 | + | * When this flag is specified, it takes precedence over any existing job slot |
| 549 | + | * selection logic. |
| 550 | + | */ |
| 551 | + | #define BASE_JD_REQ_JOB_SLOT ((base_jd_core_req)1 << 17) |
| 552 | + | |
| 553 | + | /* SW-only requirement: The atom is the start of a renderpass. |
| 554 | + | * |
| 555 | + | * If this bit is set then the job chain will be soft-stopped if it causes the |
| 556 | + | * GPU to write beyond the end of the physical pages backing the tiler heap, and |
| 557 | + | * committing more memory to the heap would exceed an internal threshold. It may |
| 558 | + | * be resumed after running one of the job chains attached to an atom with |
| 559 | + | * BASE_JD_REQ_END_RENDERPASS set and the same renderpass ID. It may be |
| 560 | + | * resumed multiple times until it completes without memory usage exceeding the |
| 561 | + | * threshold. |
| 562 | + | * |
| 563 | + | * Usually used with BASE_JD_REQ_T. |
| 564 | + | */ |
| 565 | + | #define BASE_JD_REQ_START_RENDERPASS ((base_jd_core_req)1 << 18) |
| 566 | + | |
| 567 | + | /* SW-only requirement: The atom is the end of a renderpass. |
| 568 | + | * |
| 569 | + | * If this bit is set then the atom incorporates the CPU address of a |
| 570 | + | * base_jd_fragment object instead of the GPU address of a job chain. |
| 571 | + | * |
| 572 | + | * Which job chain is run depends upon whether the atom with the same renderpass |
| 573 | + | * ID and the BASE_JD_REQ_START_RENDERPASS bit set completed normally or |
| 574 | + | * was soft-stopped when it exceeded an upper threshold for tiler heap memory |
| 575 | + | * usage. |
| 576 | + | * |
| 577 | + | * It also depends upon whether one of the job chains attached to the atom has |
| 578 | + | * already been run as part of the same renderpass (in which case it would have |
| 579 | + | * written unresolved multisampled and otherwise-discarded output to temporary |
| 580 | + | * buffers that need to be read back). The job chain for doing a forced read and |
| 581 | + | * forced write (from/to temporary buffers) is run as many times as necessary. |
| 582 | + | * |
| 583 | + | * Usually used with BASE_JD_REQ_FS. |
| 584 | + | */ |
| 585 | + | #define BASE_JD_REQ_END_RENDERPASS ((base_jd_core_req)1 << 19) |
| 586 | + | |
| 587 | + | /* SW-only requirement: The atom needs to run on a limited core mask affinity. |
| 588 | + | * |
| 589 | + | * If this bit is set then the kbase_context.limited_core_mask will be applied |
| 590 | + | * to the affinity. |
| 591 | + | */ |
| 592 | + | #define BASE_JD_REQ_LIMITED_CORE_MASK ((base_jd_core_req)1 << 20) |
| 593 | + | |
| 594 | + | /* These requirement bits are currently unused in base_jd_core_req |
| 595 | + | */ |
| 596 | + | #define BASEP_JD_REQ_RESERVED \ |
| 597 | + | (~(BASE_JD_REQ_ATOM_TYPE | BASE_JD_REQ_EXTERNAL_RESOURCES | \ |
| 598 | + | BASE_JD_REQ_EVENT_ONLY_ON_FAILURE | BASEP_JD_REQ_EVENT_NEVER | \ |
| 599 | + | BASE_JD_REQ_EVENT_COALESCE | \ |
| 600 | + | BASE_JD_REQ_COHERENT_GROUP | BASE_JD_REQ_SPECIFIC_COHERENT_GROUP | \ |
| 601 | + | BASE_JD_REQ_FS_AFBC | BASE_JD_REQ_PERMON | \ |
| 602 | + | BASE_JD_REQ_SKIP_CACHE_START | BASE_JD_REQ_SKIP_CACHE_END | \ |
| 603 | + | BASE_JD_REQ_JOB_SLOT | BASE_JD_REQ_START_RENDERPASS | \ |
| 604 | + | BASE_JD_REQ_END_RENDERPASS | BASE_JD_REQ_LIMITED_CORE_MASK)) |
| 605 | + | |
| 606 | + | /* Mask of all bits in base_jd_core_req that control the type of the atom. |
| 607 | + | * |
| 608 | + | * This allows dependency only atoms to have flags set |
| 609 | + | */ |
| 610 | + | #define BASE_JD_REQ_ATOM_TYPE \ |
| 611 | + | (BASE_JD_REQ_FS | BASE_JD_REQ_CS | BASE_JD_REQ_T | BASE_JD_REQ_CF | \ |
| 612 | + | BASE_JD_REQ_V | BASE_JD_REQ_SOFT_JOB | BASE_JD_REQ_ONLY_COMPUTE) |
| 613 | + | |
| 614 | + | /** |
| 615 | + | * Mask of all bits in base_jd_core_req that control the type of a soft job. |
| 616 | + | */ |
| 617 | + | #define BASE_JD_REQ_SOFT_JOB_TYPE (BASE_JD_REQ_SOFT_JOB | 0x1f) |
| 618 | + | |
| 619 | + | /* Returns non-zero value if core requirements passed define a soft job or |
| 620 | + | * a dependency only job. |
| 621 | + | */ |
| 622 | + | #define BASE_JD_REQ_SOFT_JOB_OR_DEP(core_req) \ |
| 623 | + | (((core_req) & BASE_JD_REQ_SOFT_JOB) || \ |
| 624 | + | ((core_req) & BASE_JD_REQ_ATOM_TYPE) == BASE_JD_REQ_DEP) |
| 625 | + | |
| 626 | + | /** |
| 627 | + | * enum kbase_jd_atom_state |
| 628 | + | * |
| 629 | + | * @KBASE_JD_ATOM_STATE_UNUSED: Atom is not used. |
| 630 | + | * @KBASE_JD_ATOM_STATE_QUEUED: Atom is queued in JD. |
| 631 | + | * @KBASE_JD_ATOM_STATE_IN_JS: Atom has been given to JS (is runnable/running). |
| 632 | + | * @KBASE_JD_ATOM_STATE_HW_COMPLETED: Atom has been completed, but not yet |
| 633 | + | * handed back to job dispatcher for |
| 634 | + | * dependency resolution. |
| 635 | + | * @KBASE_JD_ATOM_STATE_COMPLETED: Atom has been completed, but not yet handed |
| 636 | + | * back to userspace. |
| 637 | + | */ |
| 638 | + | enum kbase_jd_atom_state { |
| 639 | + | KBASE_JD_ATOM_STATE_UNUSED, |
| 640 | + | KBASE_JD_ATOM_STATE_QUEUED, |
| 641 | + | KBASE_JD_ATOM_STATE_IN_JS, |
| 642 | + | KBASE_JD_ATOM_STATE_HW_COMPLETED, |
| 643 | + | KBASE_JD_ATOM_STATE_COMPLETED |
| 644 | + | }; |
| 645 | + | |
| 646 | + | /** |
| 647 | + | * typedef base_atom_id - Type big enough to store an atom number in. |
| 648 | + | */ |
| 649 | + | typedef __u8 base_atom_id; |
| 650 | + | |
| 651 | + | /** |
| 652 | + | * struct base_dependency - |
| 653 | + | * |
| 654 | + | * @atom_id: An atom number |
| 655 | + | * @dependency_type: Dependency type |
| 656 | + | */ |
| 657 | + | struct base_dependency { |
| 658 | + | base_atom_id atom_id; |
| 659 | + | base_jd_dep_type dependency_type; |
| 660 | + | }; |
| 661 | + | |
| 662 | + | /** |
| 663 | + | * struct base_jd_fragment - Set of GPU fragment job chains used for rendering. |
| 664 | + | * |
| 665 | + | * @norm_read_norm_write: Job chain for full rendering. |
| 666 | + | * GPU address of a fragment job chain to render in the |
| 667 | + | * circumstance where the tiler job chain did not exceed |
| 668 | + | * its memory usage threshold and no fragment job chain |
| 669 | + | * was previously run for the same renderpass. |
| 670 | + | * It is used no more than once per renderpass. |
| 671 | + | * @norm_read_forced_write: Job chain for starting incremental |
| 672 | + | * rendering. |
| 673 | + | * GPU address of a fragment job chain to render in |
| 674 | + | * the circumstance where the tiler job chain exceeded |
| 675 | + | * its memory usage threshold for the first time and |
| 676 | + | * no fragment job chain was previously run for the |
| 677 | + | * same renderpass. |
| 678 | + | * Writes unresolved multisampled and normally- |
| 679 | + | * discarded output to temporary buffers that must be |
| 680 | + | * read back by a subsequent forced_read job chain |
| 681 | + | * before the renderpass is complete. |
| 682 | + | * It is used no more than once per renderpass. |
| 683 | + | * @forced_read_forced_write: Job chain for continuing incremental |
| 684 | + | * rendering. |
| 685 | + | * GPU address of a fragment job chain to render in |
| 686 | + | * the circumstance where the tiler job chain |
| 687 | + | * exceeded its memory usage threshold again |
| 688 | + | * and a fragment job chain was previously run for |
| 689 | + | * the same renderpass. |
| 690 | + | * Reads unresolved multisampled and |
| 691 | + | * normally-discarded output from temporary buffers |
| 692 | + | * written by a previous forced_write job chain and |
| 693 | + | * writes the same to temporary buffers again. |
| 694 | + | * It is used as many times as required until |
| 695 | + | * rendering completes. |
| 696 | + | * @forced_read_norm_write: Job chain for ending incremental rendering. |
| 697 | + | * GPU address of a fragment job chain to render in the |
| 698 | + | * circumstance where the tiler job chain did not |
| 699 | + | * exceed its memory usage threshold this time and a |
| 700 | + | * fragment job chain was previously run for the same |
| 701 | + | * renderpass. |
| 702 | + | * Reads unresolved multisampled and normally-discarded |
| 703 | + | * output from temporary buffers written by a previous |
| 704 | + | * forced_write job chain in order to complete a |
| 705 | + | * renderpass. |
| 706 | + | * It is used no more than once per renderpass. |
| 707 | + | * |
| 708 | + | * This structure is referenced by the main atom structure if |
| 709 | + | * BASE_JD_REQ_END_RENDERPASS is set in the base_jd_core_req. |
| 710 | + | */ |
| 711 | + | struct base_jd_fragment { |
| 712 | + | __u64 norm_read_norm_write; |
| 713 | + | __u64 norm_read_forced_write; |
| 714 | + | __u64 forced_read_forced_write; |
| 715 | + | __u64 forced_read_norm_write; |
| 716 | + | }; |
| 717 | + | |
| 718 | + | /** |
| 719 | + | * typedef base_jd_prio - Base Atom priority. |
| 720 | + | * |
| 721 | + | * Only certain priority levels are actually implemented, as specified by the |
| 722 | + | * BASE_JD_PRIO_<...> definitions below. It is undefined to use a priority |
| 723 | + | * level that is not one of those defined below. |
| 724 | + | * |
| 725 | + | * Priority levels only affect scheduling after the atoms have had dependencies |
| 726 | + | * resolved. For example, a low priority atom that has had its dependencies |
| 727 | + | * resolved might run before a higher priority atom that has not had its |
| 728 | + | * dependencies resolved. |
| 729 | + | * |
| 730 | + | * In general, fragment atoms do not affect non-fragment atoms with |
| 731 | + | * lower priorities, and vice versa. One exception is that there is only one |
| 732 | + | * priority value for each context. So a high-priority (e.g.) fragment atom |
| 733 | + | * could increase its context priority, causing its non-fragment atoms to also |
| 734 | + | * be scheduled sooner. |
| 735 | + | * |
| 736 | + | * The atoms are scheduled as follows with respect to their priorities: |
| 737 | + | * * Let atoms 'X' and 'Y' be for the same job slot who have dependencies |
| 738 | + | * resolved, and atom 'X' has a higher priority than atom 'Y' |
| 739 | + | * * If atom 'Y' is currently running on the HW, then it is interrupted to |
| 740 | + | * allow atom 'X' to run soon after |
| 741 | + | * * If instead neither atom 'Y' nor atom 'X' are running, then when choosing |
| 742 | + | * the next atom to run, atom 'X' will always be chosen instead of atom 'Y' |
| 743 | + | * * Any two atoms that have the same priority could run in any order with |
| 744 | + | * respect to each other. That is, there is no ordering constraint between |
| 745 | + | * atoms of the same priority. |
| 746 | + | * |
| 747 | + | * The sysfs file 'js_ctx_scheduling_mode' is used to control how atoms are |
| 748 | + | * scheduled between contexts. The default value, 0, will cause higher-priority |
| 749 | + | * atoms to be scheduled first, regardless of their context. The value 1 will |
| 750 | + | * use a round-robin algorithm when deciding which context's atoms to schedule |
| 751 | + | * next, so higher-priority atoms can only preempt lower priority atoms within |
| 752 | + | * the same context. See KBASE_JS_SYSTEM_PRIORITY_MODE and |
| 753 | + | * KBASE_JS_PROCESS_LOCAL_PRIORITY_MODE for more details. |
| 754 | + | */ |
| 755 | + | typedef __u8 base_jd_prio; |
| 756 | + | |
| 757 | + | /* Medium atom priority. This is a priority higher than BASE_JD_PRIO_LOW */ |
| 758 | + | #define BASE_JD_PRIO_MEDIUM ((base_jd_prio)0) |
| 759 | + | /* High atom priority. This is a priority higher than BASE_JD_PRIO_MEDIUM and |
| 760 | + | * BASE_JD_PRIO_LOW |
| 761 | + | */ |
| 762 | + | #define BASE_JD_PRIO_HIGH ((base_jd_prio)1) |
| 763 | + | /* Low atom priority. */ |
| 764 | + | #define BASE_JD_PRIO_LOW ((base_jd_prio)2) |
| 765 | + | /* Real-Time atom priority. This is a priority higher than BASE_JD_PRIO_HIGH, |
| 766 | + | * BASE_JD_PRIO_MEDIUM, and BASE_JD_PRIO_LOW |
| 767 | + | */ |
| 768 | + | #define BASE_JD_PRIO_REALTIME ((base_jd_prio)3) |
| 769 | + | |
| 770 | + | /* Count of the number of priority levels. This itself is not a valid |
| 771 | + | * base_jd_prio setting |
| 772 | + | */ |
| 773 | + | #define BASE_JD_NR_PRIO_LEVELS 4 |
| 774 | + | |
| 775 | + | /** |
| 776 | + | * struct base_jd_atom_v2 - Node of a dependency graph used to submit a |
| 777 | + | * GPU job chain or soft-job to the kernel driver. |
| 778 | + | * |
| 779 | + | * @jc: GPU address of a job chain or (if BASE_JD_REQ_END_RENDERPASS |
| 780 | + | * is set in the base_jd_core_req) the CPU address of a |
| 781 | + | * base_jd_fragment object. |
| 782 | + | * @udata: User data. |
| 783 | + | * @extres_list: List of external resources. |
| 784 | + | * @nr_extres: Number of external resources or JIT allocations. |
| 785 | + | * @jit_id: Zero-terminated array of IDs of just-in-time memory |
| 786 | + | * allocations written to by the atom. When the atom |
| 787 | + | * completes, the value stored at the |
| 788 | + | * &struct_base_jit_alloc_info.heap_info_gpu_addr of |
| 789 | + | * each allocation is read in order to enforce an |
| 790 | + | * overall physical memory usage limit. |
| 791 | + | * @pre_dep: Pre-dependencies. One need to use SETTER function to assign |
| 792 | + | * this field; this is done in order to reduce possibility of |
| 793 | + | * improper assignment of a dependency field. |
| 794 | + | * @atom_number: Unique number to identify the atom. |
| 795 | + | * @prio: Atom priority. Refer to base_jd_prio for more details. |
| 796 | + | * @device_nr: Core group when BASE_JD_REQ_SPECIFIC_COHERENT_GROUP |
| 797 | + | * specified. |
| 798 | + | * @jobslot: Job slot to use when BASE_JD_REQ_JOB_SLOT is specified. |
| 799 | + | * @core_req: Core requirements. |
| 800 | + | * @renderpass_id: Renderpass identifier used to associate an atom that has |
| 801 | + | * BASE_JD_REQ_START_RENDERPASS set in its core requirements |
| 802 | + | * with an atom that has BASE_JD_REQ_END_RENDERPASS set. |
| 803 | + | * @padding: Unused. Must be zero. |
| 804 | + | * |
| 805 | + | * This structure has changed since UK 10.2 for which base_jd_core_req was a |
| 806 | + | * __u16 value. |
| 807 | + | * |
| 808 | + | * In UK 10.3 a core_req field of a __u32 type was added to the end of the |
| 809 | + | * structure, and the place in the structure previously occupied by __u16 |
| 810 | + | * core_req was kept but renamed to compat_core_req. |
| 811 | + | * |
| 812 | + | * From UK 11.20 - compat_core_req is now occupied by __u8 jit_id[2]. |
| 813 | + | * Compatibility with UK 10.x from UK 11.y is not handled because |
| 814 | + | * the major version increase prevents this. |
| 815 | + | * |
| 816 | + | * For UK 11.20 jit_id[2] must be initialized to zero. |
| 817 | + | */ |
| 818 | + | struct base_jd_atom_v2 { |
| 819 | + | __u64 jc; |
| 820 | + | struct base_jd_udata udata; |
| 821 | + | __u64 extres_list; |
| 822 | + | __u16 nr_extres; |
| 823 | + | __u8 jit_id[2]; |
| 824 | + | struct base_dependency pre_dep[2]; |
| 825 | + | base_atom_id atom_number; |
| 826 | + | base_jd_prio prio; |
| 827 | + | __u8 device_nr; |
| 828 | + | __u8 jobslot; |
| 829 | + | base_jd_core_req core_req; |
| 830 | + | __u8 renderpass_id; |
| 831 | + | __u8 padding[7]; |
| 832 | + | }; |
| 833 | + | |
| 834 | + | /** |
| 835 | + | * struct base_jd_atom - Same as base_jd_atom_v2, but has an extra seq_nr |
| 836 | + | * at the beginning. |
| 837 | + | * |
| 838 | + | * @seq_nr: Sequence number of logical grouping of atoms. |
| 839 | + | * @jc: GPU address of a job chain or (if BASE_JD_REQ_END_RENDERPASS |
| 840 | + | * is set in the base_jd_core_req) the CPU address of a |
| 841 | + | * base_jd_fragment object. |
| 842 | + | * @udata: User data. |
| 843 | + | * @extres_list: List of external resources. |
| 844 | + | * @nr_extres: Number of external resources or JIT allocations. |
| 845 | + | * @jit_id: Zero-terminated array of IDs of just-in-time memory |
| 846 | + | * allocations written to by the atom. When the atom |
| 847 | + | * completes, the value stored at the |
| 848 | + | * &struct_base_jit_alloc_info.heap_info_gpu_addr of |
| 849 | + | * each allocation is read in order to enforce an |
| 850 | + | * overall physical memory usage limit. |
| 851 | + | * @pre_dep: Pre-dependencies. One need to use SETTER function to assign |
| 852 | + | * this field; this is done in order to reduce possibility of |
| 853 | + | * improper assignment of a dependency field. |
| 854 | + | * @atom_number: Unique number to identify the atom. |
| 855 | + | * @prio: Atom priority. Refer to base_jd_prio for more details. |
| 856 | + | * @device_nr: Core group when BASE_JD_REQ_SPECIFIC_COHERENT_GROUP |
| 857 | + | * specified. |
| 858 | + | * @jobslot: Job slot to use when BASE_JD_REQ_JOB_SLOT is specified. |
| 859 | + | * @core_req: Core requirements. |
| 860 | + | * @renderpass_id: Renderpass identifier used to associate an atom that has |
| 861 | + | * BASE_JD_REQ_START_RENDERPASS set in its core requirements |
| 862 | + | * with an atom that has BASE_JD_REQ_END_RENDERPASS set. |
| 863 | + | * @padding: Unused. Must be zero. |
| 864 | + | */ |
| 865 | + | typedef struct base_jd_atom { |
| 866 | + | __u64 seq_nr; |
| 867 | + | __u64 jc; |
| 868 | + | struct base_jd_udata udata; |
| 869 | + | __u64 extres_list; |
| 870 | + | __u16 nr_extres; |
| 871 | + | __u8 jit_id[2]; |
| 872 | + | struct base_dependency pre_dep[2]; |
| 873 | + | base_atom_id atom_number; |
| 874 | + | base_jd_prio prio; |
| 875 | + | __u8 device_nr; |
| 876 | + | __u8 jobslot; |
| 877 | + | base_jd_core_req core_req; |
| 878 | + | __u8 renderpass_id; |
| 879 | + | __u8 padding[7]; |
| 880 | + | } base_jd_atom; |
| 881 | + | |
| 882 | + | /* Job chain event code bits |
| 883 | + | * Defines the bits used to create ::base_jd_event_code |
| 884 | + | */ |
| 885 | + | enum { |
| 886 | + | BASE_JD_SW_EVENT_KERNEL = (1u << 15), /* Kernel side event */ |
| 887 | + | BASE_JD_SW_EVENT = (1u << 14), /* SW defined event */ |
| 888 | + | /* Event indicates success (SW events only) */ |
| 889 | + | BASE_JD_SW_EVENT_SUCCESS = (1u << 13), |
| 890 | + | BASE_JD_SW_EVENT_JOB = (0u << 11), /* Job related event */ |
| 891 | + | BASE_JD_SW_EVENT_BAG = (1u << 11), /* Bag related event */ |
| 892 | + | BASE_JD_SW_EVENT_INFO = (2u << 11), /* Misc/info event */ |
| 893 | + | BASE_JD_SW_EVENT_RESERVED = (3u << 11), /* Reserved event type */ |
| 894 | + | /* Mask to extract the type from an event code */ |
| 895 | + | BASE_JD_SW_EVENT_TYPE_MASK = (3u << 11) |
| 896 | + | }; |
| 897 | + | |
| 898 | + | /** |
| 899 | + | * enum base_jd_event_code - Job chain event codes |
| 900 | + | * |
| 901 | + | * @BASE_JD_EVENT_RANGE_HW_NONFAULT_START: Start of hardware non-fault status |
| 902 | + | * codes. |
| 903 | + | * Obscurely, BASE_JD_EVENT_TERMINATED |
| 904 | + | * indicates a real fault, because the |
| 905 | + | * job was hard-stopped. |
| 906 | + | * @BASE_JD_EVENT_NOT_STARTED: Can't be seen by userspace, treated as |
| 907 | + | * 'previous job done'. |
| 908 | + | * @BASE_JD_EVENT_STOPPED: Can't be seen by userspace, becomes |
| 909 | + | * TERMINATED, DONE or JOB_CANCELLED. |
| 910 | + | * @BASE_JD_EVENT_TERMINATED: This is actually a fault status code - the job |
| 911 | + | * was hard stopped. |
| 912 | + | * @BASE_JD_EVENT_ACTIVE: Can't be seen by userspace, jobs only returned on |
| 913 | + | * complete/fail/cancel. |
| 914 | + | * @BASE_JD_EVENT_RANGE_HW_NONFAULT_END: End of hardware non-fault status codes. |
| 915 | + | * Obscurely, BASE_JD_EVENT_TERMINATED |
| 916 | + | * indicates a real fault, |
| 917 | + | * because the job was hard-stopped. |
| 918 | + | * @BASE_JD_EVENT_RANGE_HW_FAULT_OR_SW_ERROR_START: Start of hardware fault and |
| 919 | + | * software error status codes. |
| 920 | + | * @BASE_JD_EVENT_RANGE_HW_FAULT_OR_SW_ERROR_END: End of hardware fault and |
| 921 | + | * software error status codes. |
| 922 | + | * @BASE_JD_EVENT_RANGE_SW_SUCCESS_START: Start of software success status |
| 923 | + | * codes. |
| 924 | + | * @BASE_JD_EVENT_RANGE_SW_SUCCESS_END: End of software success status codes. |
| 925 | + | * @BASE_JD_EVENT_RANGE_KERNEL_ONLY_START: Start of kernel-only status codes. |
| 926 | + | * Such codes are never returned to |
| 927 | + | * user-space. |
| 928 | + | * @BASE_JD_EVENT_RANGE_KERNEL_ONLY_END: End of kernel-only status codes. |
| 929 | + | * @BASE_JD_EVENT_DONE: atom has completed successfull |
| 930 | + | * @BASE_JD_EVENT_JOB_CONFIG_FAULT: Atom dependencies configuration error which |
| 931 | + | * shall result in a failed atom |
| 932 | + | * @BASE_JD_EVENT_JOB_POWER_FAULT: The job could not be executed because the |
| 933 | + | * part of the memory system required to access |
| 934 | + | * job descriptors was not powered on |
| 935 | + | * @BASE_JD_EVENT_JOB_READ_FAULT: Reading a job descriptor into the Job |
| 936 | + | * manager failed |
| 937 | + | * @BASE_JD_EVENT_JOB_WRITE_FAULT: Writing a job descriptor from the Job |
| 938 | + | * manager failed |
| 939 | + | * @BASE_JD_EVENT_JOB_AFFINITY_FAULT: The job could not be executed because the |
| 940 | + | * specified affinity mask does not intersect |
| 941 | + | * any available cores |
| 942 | + | * @BASE_JD_EVENT_JOB_BUS_FAULT: A bus access failed while executing a job |
| 943 | + | * @BASE_JD_EVENT_INSTR_INVALID_PC: A shader instruction with an illegal program |
| 944 | + | * counter was executed. |
| 945 | + | * @BASE_JD_EVENT_INSTR_INVALID_ENC: A shader instruction with an illegal |
| 946 | + | * encoding was executed. |
| 947 | + | * @BASE_JD_EVENT_INSTR_TYPE_MISMATCH: A shader instruction was executed where |
| 948 | + | * the instruction encoding did not match the |
| 949 | + | * instruction type encoded in the program |
| 950 | + | * counter. |
| 951 | + | * @BASE_JD_EVENT_INSTR_OPERAND_FAULT: A shader instruction was executed that |
| 952 | + | * contained invalid combinations of operands. |
| 953 | + | * @BASE_JD_EVENT_INSTR_TLS_FAULT: A shader instruction was executed that tried |
| 954 | + | * to access the thread local storage section |
| 955 | + | * of another thread. |
| 956 | + | * @BASE_JD_EVENT_INSTR_ALIGN_FAULT: A shader instruction was executed that |
| 957 | + | * tried to do an unsupported unaligned memory |
| 958 | + | * access. |
| 959 | + | * @BASE_JD_EVENT_INSTR_BARRIER_FAULT: A shader instruction was executed that |
| 960 | + | * failed to complete an instruction barrier. |
| 961 | + | * @BASE_JD_EVENT_DATA_INVALID_FAULT: Any data structure read as part of the job |
| 962 | + | * contains invalid combinations of data. |
| 963 | + | * @BASE_JD_EVENT_TILE_RANGE_FAULT: Tile or fragment shading was asked to |
| 964 | + | * process a tile that is entirely outside the |
| 965 | + | * bounding box of the frame. |
| 966 | + | * @BASE_JD_EVENT_STATE_FAULT: Matches ADDR_RANGE_FAULT. A virtual address |
| 967 | + | * has been found that exceeds the virtual |
| 968 | + | * address range. |
| 969 | + | * @BASE_JD_EVENT_OUT_OF_MEMORY: The tiler ran out of memory when executing a job. |
| 970 | + | * @BASE_JD_EVENT_UNKNOWN: If multiple jobs in a job chain fail, only |
| 971 | + | * the first one the reports an error will set |
| 972 | + | * and return full error information. |
| 973 | + | * Subsequent failing jobs will not update the |
| 974 | + | * error status registers, and may write an |
| 975 | + | * error status of UNKNOWN. |
| 976 | + | * @BASE_JD_EVENT_DELAYED_BUS_FAULT: The GPU received a bus fault for access to |
| 977 | + | * physical memory where the original virtual |
| 978 | + | * address is no longer available. |
| 979 | + | * @BASE_JD_EVENT_SHAREABILITY_FAULT: Matches GPU_SHAREABILITY_FAULT. A cache |
| 980 | + | * has detected that the same line has been |
| 981 | + | * accessed as both shareable and non-shareable |
| 982 | + | * memory from inside the GPU. |
| 983 | + | * @BASE_JD_EVENT_TRANSLATION_FAULT_LEVEL1: A memory access hit an invalid table |
| 984 | + | * entry at level 1 of the translation table. |
| 985 | + | * @BASE_JD_EVENT_TRANSLATION_FAULT_LEVEL2: A memory access hit an invalid table |
| 986 | + | * entry at level 2 of the translation table. |
| 987 | + | * @BASE_JD_EVENT_TRANSLATION_FAULT_LEVEL3: A memory access hit an invalid table |
| 988 | + | * entry at level 3 of the translation table. |
| 989 | + | * @BASE_JD_EVENT_TRANSLATION_FAULT_LEVEL4: A memory access hit an invalid table |
| 990 | + | * entry at level 4 of the translation table. |
| 991 | + | * @BASE_JD_EVENT_PERMISSION_FAULT: A memory access could not be allowed due to |
| 992 | + | * the permission flags set in translation |
| 993 | + | * table |
| 994 | + | * @BASE_JD_EVENT_TRANSTAB_BUS_FAULT_LEVEL1: A bus fault occurred while reading |
| 995 | + | * level 0 of the translation tables. |
| 996 | + | * @BASE_JD_EVENT_TRANSTAB_BUS_FAULT_LEVEL2: A bus fault occurred while reading |
| 997 | + | * level 1 of the translation tables. |
| 998 | + | * @BASE_JD_EVENT_TRANSTAB_BUS_FAULT_LEVEL3: A bus fault occurred while reading |
| 999 | + | * level 2 of the translation tables. |
| 1000 | + | * @BASE_JD_EVENT_TRANSTAB_BUS_FAULT_LEVEL4: A bus fault occurred while reading |
| 1001 | + | * level 3 of the translation tables. |
| 1002 | + | * @BASE_JD_EVENT_ACCESS_FLAG: Matches ACCESS_FLAG_0. A memory access hit a |
| 1003 | + | * translation table entry with the ACCESS_FLAG |
| 1004 | + | * bit set to zero in level 0 of the |
| 1005 | + | * page table, and the DISABLE_AF_FAULT flag |
| 1006 | + | * was not set. |
| 1007 | + | * @BASE_JD_EVENT_MEM_GROWTH_FAILED: raised for JIT_ALLOC atoms that failed to |
| 1008 | + | * grow memory on demand |
| 1009 | + | * @BASE_JD_EVENT_JOB_CANCELLED: raised when this atom was hard-stopped or its |
| 1010 | + | * dependencies failed |
| 1011 | + | * @BASE_JD_EVENT_JOB_INVALID: raised for many reasons, including invalid data |
| 1012 | + | * in the atom which overlaps with |
| 1013 | + | * BASE_JD_EVENT_JOB_CONFIG_FAULT, or if the |
| 1014 | + | * platform doesn't support the feature specified in |
| 1015 | + | * the atom. |
| 1016 | + | * @BASE_JD_EVENT_PM_EVENT: TODO: remove as it's not used |
| 1017 | + | * @BASE_JD_EVENT_TIMED_OUT: TODO: remove as it's not used |
| 1018 | + | * @BASE_JD_EVENT_BAG_INVALID: TODO: remove as it's not used |
| 1019 | + | * @BASE_JD_EVENT_PROGRESS_REPORT: TODO: remove as it's not used |
| 1020 | + | * @BASE_JD_EVENT_BAG_DONE: TODO: remove as it's not used |
| 1021 | + | * @BASE_JD_EVENT_DRV_TERMINATED: this is a special event generated to indicate |
| 1022 | + | * to userspace that the KBase context has been |
| 1023 | + | * destroyed and Base should stop listening for |
| 1024 | + | * further events |
| 1025 | + | * @BASE_JD_EVENT_REMOVED_FROM_NEXT: raised when an atom that was configured in |
| 1026 | + | * the GPU has to be retried (but it has not |
| 1027 | + | * started) due to e.g., GPU reset |
| 1028 | + | * @BASE_JD_EVENT_END_RP_DONE: this is used for incremental rendering to signal |
| 1029 | + | * the completion of a renderpass. This value |
| 1030 | + | * shouldn't be returned to userspace but I haven't |
| 1031 | + | * seen where it is reset back to JD_EVENT_DONE. |
| 1032 | + | * |
| 1033 | + | * HW and low-level SW events are represented by event codes. |
| 1034 | + | * The status of jobs which succeeded are also represented by |
| 1035 | + | * an event code (see @BASE_JD_EVENT_DONE). |
| 1036 | + | * Events are usually reported as part of a &struct base_jd_event. |
| 1037 | + | * |
| 1038 | + | * The event codes are encoded in the following way: |
| 1039 | + | * * 10:0 - subtype |
| 1040 | + | * * 12:11 - type |
| 1041 | + | * * 13 - SW success (only valid if the SW bit is set) |
| 1042 | + | * * 14 - SW event (HW event if not set) |
| 1043 | + | * * 15 - Kernel event (should never be seen in userspace) |
| 1044 | + | * |
| 1045 | + | * Events are split up into ranges as follows: |
| 1046 | + | * * BASE_JD_EVENT_RANGE_<description>_START |
| 1047 | + | * * BASE_JD_EVENT_RANGE_<description>_END |
| 1048 | + | * |
| 1049 | + | * code is in <description>'s range when: |
| 1050 | + | * BASE_JD_EVENT_RANGE_<description>_START <= code < |
| 1051 | + | * BASE_JD_EVENT_RANGE_<description>_END |
| 1052 | + | * |
| 1053 | + | * Ranges can be asserted for adjacency by testing that the END of the previous |
| 1054 | + | * is equal to the START of the next. This is useful for optimizing some tests |
| 1055 | + | * for range. |
| 1056 | + | * |
| 1057 | + | * A limitation is that the last member of this enum must explicitly be handled |
| 1058 | + | * (with an assert-unreachable statement) in switch statements that use |
| 1059 | + | * variables of this type. Otherwise, the compiler warns that we have not |
| 1060 | + | * handled that enum value. |
| 1061 | + | */ |
| 1062 | + | enum base_jd_event_code { |
| 1063 | + | /* HW defined exceptions */ |
| 1064 | + | BASE_JD_EVENT_RANGE_HW_NONFAULT_START = 0, |
| 1065 | + | |
| 1066 | + | /* non-fatal exceptions */ |
| 1067 | + | BASE_JD_EVENT_NOT_STARTED = 0x00, |
| 1068 | + | BASE_JD_EVENT_DONE = 0x01, |
| 1069 | + | BASE_JD_EVENT_STOPPED = 0x03, |
| 1070 | + | BASE_JD_EVENT_TERMINATED = 0x04, |
| 1071 | + | BASE_JD_EVENT_ACTIVE = 0x08, |
| 1072 | + | |
| 1073 | + | BASE_JD_EVENT_RANGE_HW_NONFAULT_END = 0x40, |
| 1074 | + | BASE_JD_EVENT_RANGE_HW_FAULT_OR_SW_ERROR_START = 0x40, |
| 1075 | + | |
| 1076 | + | /* job exceptions */ |
| 1077 | + | BASE_JD_EVENT_JOB_CONFIG_FAULT = 0x40, |
| 1078 | + | BASE_JD_EVENT_JOB_POWER_FAULT = 0x41, |
| 1079 | + | BASE_JD_EVENT_JOB_READ_FAULT = 0x42, |
| 1080 | + | BASE_JD_EVENT_JOB_WRITE_FAULT = 0x43, |
| 1081 | + | BASE_JD_EVENT_JOB_AFFINITY_FAULT = 0x44, |
| 1082 | + | BASE_JD_EVENT_JOB_BUS_FAULT = 0x48, |
| 1083 | + | BASE_JD_EVENT_INSTR_INVALID_PC = 0x50, |
| 1084 | + | BASE_JD_EVENT_INSTR_INVALID_ENC = 0x51, |
| 1085 | + | BASE_JD_EVENT_INSTR_TYPE_MISMATCH = 0x52, |
| 1086 | + | BASE_JD_EVENT_INSTR_OPERAND_FAULT = 0x53, |
| 1087 | + | BASE_JD_EVENT_INSTR_TLS_FAULT = 0x54, |
| 1088 | + | BASE_JD_EVENT_INSTR_BARRIER_FAULT = 0x55, |
| 1089 | + | BASE_JD_EVENT_INSTR_ALIGN_FAULT = 0x56, |
| 1090 | + | BASE_JD_EVENT_DATA_INVALID_FAULT = 0x58, |
| 1091 | + | BASE_JD_EVENT_TILE_RANGE_FAULT = 0x59, |
| 1092 | + | BASE_JD_EVENT_STATE_FAULT = 0x5A, |
| 1093 | + | BASE_JD_EVENT_OUT_OF_MEMORY = 0x60, |
| 1094 | + | BASE_JD_EVENT_UNKNOWN = 0x7F, |
| 1095 | + | |
| 1096 | + | /* GPU exceptions */ |
| 1097 | + | BASE_JD_EVENT_DELAYED_BUS_FAULT = 0x80, |
| 1098 | + | BASE_JD_EVENT_SHAREABILITY_FAULT = 0x88, |
| 1099 | + | |
| 1100 | + | /* MMU exceptions */ |
| 1101 | + | BASE_JD_EVENT_TRANSLATION_FAULT_LEVEL1 = 0xC1, |
| 1102 | + | BASE_JD_EVENT_TRANSLATION_FAULT_LEVEL2 = 0xC2, |
| 1103 | + | BASE_JD_EVENT_TRANSLATION_FAULT_LEVEL3 = 0xC3, |
| 1104 | + | BASE_JD_EVENT_TRANSLATION_FAULT_LEVEL4 = 0xC4, |
| 1105 | + | BASE_JD_EVENT_PERMISSION_FAULT = 0xC8, |
| 1106 | + | BASE_JD_EVENT_TRANSTAB_BUS_FAULT_LEVEL1 = 0xD1, |
| 1107 | + | BASE_JD_EVENT_TRANSTAB_BUS_FAULT_LEVEL2 = 0xD2, |
| 1108 | + | BASE_JD_EVENT_TRANSTAB_BUS_FAULT_LEVEL3 = 0xD3, |
| 1109 | + | BASE_JD_EVENT_TRANSTAB_BUS_FAULT_LEVEL4 = 0xD4, |
| 1110 | + | BASE_JD_EVENT_ACCESS_FLAG = 0xD8, |
| 1111 | + | |
| 1112 | + | /* SW defined exceptions */ |
| 1113 | + | BASE_JD_EVENT_MEM_GROWTH_FAILED = |
| 1114 | + | BASE_JD_SW_EVENT | BASE_JD_SW_EVENT_JOB | 0x000, |
| 1115 | + | BASE_JD_EVENT_TIMED_OUT = |
| 1116 | + | BASE_JD_SW_EVENT | BASE_JD_SW_EVENT_JOB | 0x001, |
| 1117 | + | BASE_JD_EVENT_JOB_CANCELLED = |
| 1118 | + | BASE_JD_SW_EVENT | BASE_JD_SW_EVENT_JOB | 0x002, |
| 1119 | + | BASE_JD_EVENT_JOB_INVALID = |
| 1120 | + | BASE_JD_SW_EVENT | BASE_JD_SW_EVENT_JOB | 0x003, |
| 1121 | + | BASE_JD_EVENT_PM_EVENT = |
| 1122 | + | BASE_JD_SW_EVENT | BASE_JD_SW_EVENT_JOB | 0x004, |
| 1123 | + | |
| 1124 | + | BASE_JD_EVENT_BAG_INVALID = |
| 1125 | + | BASE_JD_SW_EVENT | BASE_JD_SW_EVENT_BAG | 0x003, |
| 1126 | + | |
| 1127 | + | BASE_JD_EVENT_RANGE_HW_FAULT_OR_SW_ERROR_END = BASE_JD_SW_EVENT | |
| 1128 | + | BASE_JD_SW_EVENT_RESERVED | 0x3FF, |
| 1129 | + | |
| 1130 | + | BASE_JD_EVENT_RANGE_SW_SUCCESS_START = BASE_JD_SW_EVENT | |
| 1131 | + | BASE_JD_SW_EVENT_SUCCESS | 0x000, |
| 1132 | + | |
| 1133 | + | BASE_JD_EVENT_PROGRESS_REPORT = BASE_JD_SW_EVENT | |
| 1134 | + | BASE_JD_SW_EVENT_SUCCESS | BASE_JD_SW_EVENT_JOB | 0x000, |
| 1135 | + | BASE_JD_EVENT_BAG_DONE = BASE_JD_SW_EVENT | BASE_JD_SW_EVENT_SUCCESS | |
| 1136 | + | BASE_JD_SW_EVENT_BAG | 0x000, |
| 1137 | + | BASE_JD_EVENT_DRV_TERMINATED = BASE_JD_SW_EVENT | |
| 1138 | + | BASE_JD_SW_EVENT_SUCCESS | BASE_JD_SW_EVENT_INFO | 0x000, |
| 1139 | + | |
| 1140 | + | BASE_JD_EVENT_RANGE_SW_SUCCESS_END = BASE_JD_SW_EVENT | |
| 1141 | + | BASE_JD_SW_EVENT_SUCCESS | BASE_JD_SW_EVENT_RESERVED | 0x3FF, |
| 1142 | + | |
| 1143 | + | BASE_JD_EVENT_RANGE_KERNEL_ONLY_START = BASE_JD_SW_EVENT | |
| 1144 | + | BASE_JD_SW_EVENT_KERNEL | 0x000, |
| 1145 | + | BASE_JD_EVENT_REMOVED_FROM_NEXT = BASE_JD_SW_EVENT | |
| 1146 | + | BASE_JD_SW_EVENT_KERNEL | BASE_JD_SW_EVENT_JOB | 0x000, |
| 1147 | + | BASE_JD_EVENT_END_RP_DONE = BASE_JD_SW_EVENT | |
| 1148 | + | BASE_JD_SW_EVENT_KERNEL | BASE_JD_SW_EVENT_JOB | 0x001, |
| 1149 | + | |
| 1150 | + | BASE_JD_EVENT_RANGE_KERNEL_ONLY_END = BASE_JD_SW_EVENT | |
| 1151 | + | BASE_JD_SW_EVENT_KERNEL | BASE_JD_SW_EVENT_RESERVED | 0x3FF |
| 1152 | + | }; |
| 1153 | + | |
| 1154 | + | /** |
| 1155 | + | * struct base_jd_event_v2 - Event reporting structure |
| 1156 | + | * |
| 1157 | + | * @event_code: event code. |
| 1158 | + | * @atom_number: the atom number that has completed. |
| 1159 | + | * @udata: user data. |
| 1160 | + | * |
| 1161 | + | * This structure is used by the kernel driver to report information |
| 1162 | + | * about GPU events. They can either be HW-specific events or low-level |
| 1163 | + | * SW events, such as job-chain completion. |
| 1164 | + | * |
| 1165 | + | * The event code contains an event type field which can be extracted |
| 1166 | + | * by ANDing with BASE_JD_SW_EVENT_TYPE_MASK. |
| 1167 | + | */ |
| 1168 | + | struct base_jd_event_v2 { |
| 1169 | + | enum base_jd_event_code event_code; |
| 1170 | + | base_atom_id atom_number; |
| 1171 | + | struct base_jd_udata udata; |
| 1172 | + | }; |
| 1173 | + | |
| 1174 | + | /** |
| 1175 | + | * struct base_dump_cpu_gpu_counters - Structure for |
| 1176 | + | * BASE_JD_REQ_SOFT_DUMP_CPU_GPU_COUNTERS |
| 1177 | + | * jobs. |
| 1178 | + | * @system_time: gpu timestamp |
| 1179 | + | * @cycle_counter: gpu cycle count |
| 1180 | + | * @sec: cpu time(sec) |
| 1181 | + | * @usec: cpu time(usec) |
| 1182 | + | * @padding: padding |
| 1183 | + | * |
| 1184 | + | * This structure is stored into the memory pointed to by the @jc field |
| 1185 | + | * of &struct base_jd_atom. |
| 1186 | + | * |
| 1187 | + | * It must not occupy the same CPU cache line(s) as any neighboring data. |
| 1188 | + | * This is to avoid cases where access to pages containing the structure |
| 1189 | + | * is shared between cached and un-cached memory regions, which would |
| 1190 | + | * cause memory corruption. |
| 1191 | + | */ |
| 1192 | + | |
| 1193 | + | struct base_dump_cpu_gpu_counters { |
| 1194 | + | __u64 system_time; |
| 1195 | + | __u64 cycle_counter; |
| 1196 | + | __u64 sec; |
| 1197 | + | __u32 usec; |
| 1198 | + | __u8 padding[36]; |
| 1199 | + | }; |
| 1200 | + | |
| 1201 | + | #endif /* _UAPI_BASE_JM_KERNEL_H_ */ |
| 1202 | + | |
| 1203 | + | |