1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 /* 3 * 4 * (C) COPYRIGHT 2020-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 _KBASE_DEBUG_KTRACE_DEFS_JM_H_ 23 #define _KBASE_DEBUG_KTRACE_DEFS_JM_H_ 24 25 #if KBASE_KTRACE_TARGET_RBUF 26 /** 27 * DOC: KTrace version history, JM variant 28 * 29 * 1.0: 30 * Original version (implicit, header did not carry version information). 31 * 32 * 2.0: 33 * Introduced version information into the header. 34 * 35 * Some changes of parameter names in header. 36 * 37 * Trace now uses all 64-bits of info_val. 38 * 39 * Non-JM specific parts moved to using info_val instead of refcount/gpu_addr. 40 * 41 * 2.1: 42 * kctx field is no longer a pointer, and is now an ID of the format %d_%u as 43 * used by kctx directories in mali debugfs entries: (tgid creating the kctx), 44 * (unique kctx id). 45 * 46 * ftrace backend now outputs kctx field (as %d_%u format). 47 * 48 * 2.2: 49 * Add tracing codes for pulling, unpulling, and returns atoms to JS for 50 * diagnosing soft-stop path and preemption problems 51 */ 52 #define KBASE_KTRACE_VERSION_MAJOR 2 53 #define KBASE_KTRACE_VERSION_MINOR 2 54 #endif /* KBASE_KTRACE_TARGET_RBUF */ 55 56 /* 57 * Note: mali_kbase_debug_ktrace_jm.h needs these value even if the RBUF target 58 * is disabled (they get discarded with CSTD_UNUSED(), but they're still 59 * referenced) 60 */ 61 62 /* indicates if the trace message has a valid refcount member */ 63 #define KBASE_KTRACE_FLAG_JM_REFCOUNT (((kbase_ktrace_flag_t)1) << 0) 64 /* indicates if the trace message has a valid jobslot member */ 65 #define KBASE_KTRACE_FLAG_JM_JOBSLOT (((kbase_ktrace_flag_t)1) << 1) 66 /* indicates if the trace message has valid atom related info. */ 67 #define KBASE_KTRACE_FLAG_JM_ATOM (((kbase_ktrace_flag_t)1) << 2) 68 69 #if KBASE_KTRACE_TARGET_RBUF 70 /* Collect all the flags together for debug checking */ 71 #define KBASE_KTRACE_FLAG_BACKEND_ALL \ 72 (KBASE_KTRACE_FLAG_JM_REFCOUNT | KBASE_KTRACE_FLAG_JM_JOBSLOT \ 73 | KBASE_KTRACE_FLAG_JM_ATOM) 74 75 /** 76 * union kbase_ktrace_backend - backend specific part of a trace message 77 * Contains only a struct but is a union such that it is compatible with 78 * generic JM and CSF KTrace calls. 79 * 80 * @gpu: gpu union member 81 * @gpu.atom_udata: Copy of the user data sent for the atom in base_jd_submit. 82 * Only valid if KBASE_KTRACE_FLAG_JM_ATOM is set in @flags 83 * @gpu.gpu_addr: GPU address, usually of the job-chain represented by an 84 * atom. 85 * @gpu.atom_number: id of the atom for which trace message was added. Only 86 * valid if KBASE_KTRACE_FLAG_JM_ATOM is set in @flags 87 * @gpu.code: Identifies the event, refer to enum kbase_ktrace_code. 88 * @gpu.flags: indicates information about the trace message itself. Used 89 * during dumping of the message. 90 * @gpu.jobslot: job-slot for which trace message was added, valid only for 91 * job-slot management events. 92 * @gpu.refcount: reference count for the context, valid for certain events 93 * related to scheduler core and policy. 94 */ 95 union kbase_ktrace_backend { 96 struct { 97 /* Place 64 and 32-bit members together */ 98 u64 atom_udata[2]; /* Only valid for 99 * KBASE_KTRACE_FLAG_JM_ATOM 100 */ 101 u64 gpu_addr; 102 int atom_number; /* Only valid for KBASE_KTRACE_FLAG_JM_ATOM */ 103 /* Pack smaller members together */ 104 kbase_ktrace_code_t code; 105 kbase_ktrace_flag_t flags; 106 u8 jobslot; 107 u8 refcount; 108 } gpu; 109 }; 110 #endif /* KBASE_KTRACE_TARGET_RBUF */ 111 112 #endif /* _KBASE_DEBUG_KTRACE_DEFS_JM_H_ */ 113