summaryrefslogtreecommitdiff
path: root/dvalin/kernel/drivers/gpu/arm/midgard/debug/backend/mali_kbase_debug_ktrace_defs_jm.h
blob: c01f930ca76f681d41568e844fcaf72c5ac24d8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
 *
 * (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved.
 *
 * This program is free software and is provided to you under the terms of the
 * GNU General Public License version 2 as published by the Free Software
 * Foundation, and any use by you of this program is subject to the terms
 * of such GNU license.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, you can access it online at
 * http://www.gnu.org/licenses/gpl-2.0.html.
 *
 */

#ifndef _KBASE_DEBUG_KTRACE_DEFS_JM_H_
#define _KBASE_DEBUG_KTRACE_DEFS_JM_H_

#if KBASE_KTRACE_TARGET_RBUF
/**
 * DOC: KTrace version history, JM variant
 *
 * 1.0:
 * Original version (implicit, header did not carry version information).
 *
 * 2.0:
 * Introduced version information into the header.
 *
 * Some changes of parameter names in header.
 *
 * Trace now uses all 64-bits of info_val.
 *
 * Non-JM specific parts moved to using info_val instead of refcount/gpu_addr.
 *
 * 2.1:
 * kctx field is no longer a pointer, and is now an ID of the format %d_%u as
 * used by kctx directories in mali debugfs entries: (tgid creating the kctx),
 * (unique kctx id).
 *
 * ftrace backend now outputs kctx field (as %d_%u format).
 *
 */
#define KBASE_KTRACE_VERSION_MAJOR 2
#define KBASE_KTRACE_VERSION_MINOR 1
#endif /* KBASE_KTRACE_TARGET_RBUF */

/*
 * Note: mali_kbase_debug_ktrace_jm.h needs these value even if the RBUF target
 * is disabled (they get discarded with CSTD_UNUSED(), but they're still
 * referenced)
 */

/* indicates if the trace message has a valid refcount member */
#define KBASE_KTRACE_FLAG_JM_REFCOUNT (((kbase_ktrace_flag_t)1) << 0)
/* indicates if the trace message has a valid jobslot member */
#define KBASE_KTRACE_FLAG_JM_JOBSLOT  (((kbase_ktrace_flag_t)1) << 1)
/* indicates if the trace message has valid atom related info. */
#define KBASE_KTRACE_FLAG_JM_ATOM     (((kbase_ktrace_flag_t)1) << 2)

#if KBASE_KTRACE_TARGET_RBUF
/* Collect all the flags together for debug checking */
#define KBASE_KTRACE_FLAG_BACKEND_ALL \
		(KBASE_KTRACE_FLAG_JM_REFCOUNT | KBASE_KTRACE_FLAG_JM_JOBSLOT \
		| KBASE_KTRACE_FLAG_JM_ATOM)

/**
 * union kbase_ktrace_backend - backend specific part of a trace message
 * Contains only a struct but is a union such that it is compatible with
 * generic JM and CSF KTrace calls.
 *
 * @gpu:             gpu union member
 * @gpu.atom_udata:  Copy of the user data sent for the atom in base_jd_submit.
 *                   Only valid if KBASE_KTRACE_FLAG_JM_ATOM is set in @flags
 * @gpu.gpu_addr:    GPU address, usually of the job-chain represented by an
 *                   atom.
 * @gpu.atom_number: id of the atom for which trace message was added. Only
 *                   valid if KBASE_KTRACE_FLAG_JM_ATOM is set in @flags
 * @gpu.code:        Identifies the event, refer to enum kbase_ktrace_code.
 * @gpu.flags:       indicates information about the trace message itself. Used
 *                   during dumping of the message.
 * @gpu.jobslot:     job-slot for which trace message was added, valid only for
 *                   job-slot management events.
 * @gpu.refcount:    reference count for the context, valid for certain events
 *                   related to scheduler core and policy.
 */
union kbase_ktrace_backend {
	struct {
		/* Place 64 and 32-bit members together */
		u64 atom_udata[2]; /* Only valid for
				    * KBASE_KTRACE_FLAG_JM_ATOM
				    */
		u64 gpu_addr;
		int atom_number; /* Only valid for KBASE_KTRACE_FLAG_JM_ATOM */
		/* Pack smaller members together */
		kbase_ktrace_code_t code;
		kbase_ktrace_flag_t flags;
		u8 jobslot;
		u8 refcount;
	} gpu;
};
#endif /* KBASE_KTRACE_TARGET_RBUF */

#endif /* _KBASE_DEBUG_KTRACE_DEFS_JM_H_ */