summaryrefslogtreecommitdiff
path: root/driver/product/kernel/drivers/gpu/arm/midgard/mali_kbase_tlstream.h
blob: 7349ab2af8ed539e6e34c3cfaa3b097bc6aabc4e (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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
/*
 *
 * (C) COPYRIGHT 2015-2016 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 licence.
 *
 * A copy of the licence is included with the program, and can also be obtained
 * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301, USA.
 *
 */



#if !defined(_KBASE_TLSTREAM_H)
#define _KBASE_TLSTREAM_H

#include <mali_kbase.h>

/*****************************************************************************/

/**
 * kbase_tlstream_init - initialize timeline infrastructure in kernel
 * Return: zero on success, negative number on error
 */
int kbase_tlstream_init(void);

/**
 * kbase_tlstream_term - terminate timeline infrastructure in kernel
 *
 * Timeline need have to been previously enabled with kbase_tlstream_init().
 */
void kbase_tlstream_term(void);

/**
 * kbase_tlstream_acquire - acquire timeline stream file descriptor
 * @kctx:  kernel common context
 * @fd:    timeline stream file descriptor
 * @flags: timeline stream flags
 *
 * This descriptor is meant to be used by userspace timeline to gain access to
 * kernel timeline stream. This stream is later broadcasted by user space to the
 * timeline client.
 * Only one entity can own the descriptor at any given time. Descriptor shall be
 * closed if unused. If descriptor cannot be obtained (i.e. when it is already
 * being used) argument fd will contain negative value.
 *
 * Return: zero on success (this does not necessarily mean that stream
 *         descriptor could be returned), negative number on error
 */
int kbase_tlstream_acquire(struct kbase_context *kctx, int *fd, u32 flags);

/**
 * kbase_tlstream_flush_streams - flush timeline streams.
 *
 * Function will flush pending data in all timeline streams.
 */
void kbase_tlstream_flush_streams(void);

/**
 * kbase_tlstream_reset_body_streams - reset timeline body streams.
 *
 * Function will discard pending data in all timeline body streams.
 */
void kbase_tlstream_reset_body_streams(void);

#if MALI_UNIT_TEST
/**
 * kbase_tlstream_test - start timeline stream data generator
 * @tpw_count: number of trace point writers in each context
 * @msg_delay: time delay in milliseconds between trace points written by one
 *             writer
 * @msg_count: number of trace points written by one writer
 * @aux_msg:   if non-zero aux messages will be included
 *
 * This test starts a requested number of asynchronous writers in both IRQ and
 * thread context. Each writer will generate required number of test
 * tracepoints (tracepoints with embedded information about writer that
 * should be verified by user space reader). Tracepoints will be emitted in
 * all timeline body streams. If aux_msg is non-zero writer will also
 * generate not testable tracepoints (tracepoints without information about
 * writer). These tracepoints are used to check correctness of remaining
 * timeline message generating functions. Writer will wait requested time
 * between generating another set of messages. This call blocks until all
 * writers finish.
 */
void kbase_tlstream_test(
		unsigned int tpw_count,
		unsigned int msg_delay,
		unsigned int msg_count,
		int          aux_msg);

/**
 * kbase_tlstream_stats - read timeline stream statistics
 * @bytes_collected: will hold number of bytes read by the user
 * @bytes_generated: will hold number of bytes generated by trace points
 */
void kbase_tlstream_stats(u32 *bytes_collected, u32 *bytes_generated);
#endif /* MALI_UNIT_TEST */

/*****************************************************************************/

#define TL_ATOM_STATE_IDLE 0
#define TL_ATOM_STATE_READY 1
#define TL_ATOM_STATE_DONE 2
#define TL_ATOM_STATE_POSTED 3

void __kbase_tlstream_tl_summary_new_ctx(void *context, u32 nr, u32 tgid);
void __kbase_tlstream_tl_summary_new_gpu(void *gpu, u32 id, u32 core_count);
void __kbase_tlstream_tl_summary_new_lpu(void *lpu, u32 nr, u32 fn);
void __kbase_tlstream_tl_summary_lifelink_lpu_gpu(void *lpu, void *gpu);
void __kbase_tlstream_tl_summary_new_as(void *as, u32 nr);
void __kbase_tlstream_tl_summary_lifelink_as_gpu(void *as, void *gpu);
void __kbase_tlstream_tl_new_ctx(void *context, u32 nr, u32 tgid);
void __kbase_tlstream_tl_new_atom(void *atom, u32 nr);
void __kbase_tlstream_tl_del_ctx(void *context);
void __kbase_tlstream_tl_del_atom(void *atom);
void __kbase_tlstream_tl_ret_ctx_lpu(void *context, void *lpu);
void __kbase_tlstream_tl_ret_atom_ctx(void *atom, void *context);
void __kbase_tlstream_tl_ret_atom_lpu(
		void *atom, void *lpu, const char *attrib_match_list);
void __kbase_tlstream_tl_nret_ctx_lpu(void *context, void *lpu);
void __kbase_tlstream_tl_nret_atom_ctx(void *atom, void *context);
void __kbase_tlstream_tl_nret_atom_lpu(void *atom, void *lpu);
void __kbase_tlstream_tl_ret_as_ctx(void *as, void *ctx);
void __kbase_tlstream_tl_nret_as_ctx(void *as, void *ctx);
void __kbase_tlstream_tl_ret_atom_as(void *atom, void *as);
void __kbase_tlstream_tl_nret_atom_as(void *atom, void *as);
void __kbase_tlstream_tl_dep_atom_atom(void *atom1, void *atom2);
void __kbase_tlstream_tl_ndep_atom_atom(void *atom1, void *atom2);
void __kbase_tlstream_tl_rdep_atom_atom(void *atom1, void *atom2);
void __kbase_tlstream_tl_attrib_atom_config(
		void *atom, u64 jd, u64 affinity, u32 config);
void __kbase_tlstream_tl_attrib_atom_priority(void *atom, u32 prio);
void __kbase_tlstream_tl_attrib_atom_state(void *atom, u32 state);
void __kbase_tlstream_tl_attrib_atom_priority_change(void *atom);
void __kbase_tlstream_tl_attrib_as_config(
		void *as, u64 transtab, u64 memattr, u64 transcfg);
void __kbase_tlstream_tl_event_atom_softstop_ex(void *atom);
void __kbase_tlstream_tl_event_lpu_softstop(void *lpu);
void __kbase_tlstream_tl_event_atom_softstop_issue(void *atom);
void __kbase_tlstream_jd_gpu_soft_reset(void *gpu);
void __kbase_tlstream_aux_pm_state(u32 core_type, u64 state);
void __kbase_tlstream_aux_pagefault(u32 ctx_nr, u64 page_count_change);
void __kbase_tlstream_aux_pagesalloc(u32 ctx_nr, u64 page_count);
void __kbase_tlstream_aux_devfreq_target(u64 target_freq);
void __kbase_tlstream_aux_protected_enter_start(void *gpu);
void __kbase_tlstream_aux_protected_enter_end(void *gpu);
void __kbase_tlstream_aux_protected_leave_start(void *gpu);
void __kbase_tlstream_aux_protected_leave_end(void *gpu);

#define TLSTREAM_ENABLED (1 << 31)

extern atomic_t kbase_tlstream_enabled;

#define __TRACE_IF_ENABLED(trace_name, ...)                         \
	do {                                                        \
		int enabled = atomic_read(&kbase_tlstream_enabled); \
		if (enabled & TLSTREAM_ENABLED)                     \
			__kbase_tlstream_##trace_name(__VA_ARGS__); \
	} while (0)

#define __TRACE_IF_ENABLED_LATENCY(trace_name, ...)                     \
	do {                                                            \
		int enabled = atomic_read(&kbase_tlstream_enabled);     \
		if (enabled & BASE_TLSTREAM_ENABLE_LATENCY_TRACEPOINTS) \
			__kbase_tlstream_##trace_name(__VA_ARGS__);     \
	} while (0)

/*****************************************************************************/

/**
 * KBASE_TLSTREAM_TL_SUMMARY_NEW_CTX - create context object in timeline
 *                                     summary
 * @context: name of the context object
 * @nr:      context number
 * @tgid:    thread Group Id
 *
 * Function emits a timeline message informing about context creation. Context
 * is created with context number (its attribute), that can be used to link
 * kbase context with userspace context.
 * This message is directed to timeline summary stream.
 */
#define KBASE_TLSTREAM_TL_SUMMARY_NEW_CTX(context, nr, tgid) \
	__TRACE_IF_ENABLED(tl_summary_new_ctx, context, nr, tgid)

/**
 * KBASE_TLSTREAM_TL_SUMMARY_NEW_GPU - create GPU object in timeline summary
 * @gpu:        name of the GPU object
 * @id:         id value of this GPU
 * @core_count: number of cores this GPU hosts
 *
 * Function emits a timeline message informing about GPU creation. GPU is
 * created with two attributes: id and core count.
 * This message is directed to timeline summary stream.
 */
#define KBASE_TLSTREAM_TL_SUMMARY_NEW_GPU(gpu, id, core_count) \
	__TRACE_IF_ENABLED(tl_summary_new_gpu, gpu, id, core_count)

/**
 * KBASE_TLSTREAM_TL_SUMMARY_NEW_LPU - create LPU object in timeline summary
 * @lpu: name of the Logical Processing Unit object
 * @nr:  sequential number assigned to this LPU
 * @fn:  property describing this LPU's functional abilities
 *
 * Function emits a timeline message informing about LPU creation. LPU is
 * created with two attributes: number linking this LPU with GPU's job slot
 * and function bearing information about this LPU abilities.
 * This message is directed to timeline summary stream.
 */
#define KBASE_TLSTREAM_TL_SUMMARY_NEW_LPU(lpu, nr, fn) \
	__TRACE_IF_ENABLED(tl_summary_new_lpu, lpu, nr, fn)

/**
 * KBASE_TLSTREAM_TL_SUMMARY_LIFELINK_LPU_GPU - lifelink LPU object to GPU
 * @lpu: name of the Logical Processing Unit object
 * @gpu: name of the GPU object
 *
 * Function emits a timeline message informing that LPU object shall be deleted
 * along with GPU object.
 * This message is directed to timeline summary stream.
 */
#define KBASE_TLSTREAM_TL_SUMMARY_LIFELINK_LPU_GPU(lpu, gpu) \
	__TRACE_IF_ENABLED(tl_summary_lifelink_lpu_gpu, lpu, gpu)

/**
 * KBASE_TLSTREAM_TL_SUMMARY_NEW_AS - create address space object in timeline summary
 * @as: name of the address space object
 * @nr: sequential number assigned to this address space
 *
 * Function emits a timeline message informing about address space creation.
 * Address space is created with one attribute: number identifying this
 * address space.
 * This message is directed to timeline summary stream.
 */
#define KBASE_TLSTREAM_TL_SUMMARY_NEW_AS(as, nr) \
	__TRACE_IF_ENABLED(tl_summary_new_as, as, nr)

/**
 * KBASE_TLSTREAM_TL_SUMMARY_LIFELINK_AS_GPU - lifelink address space object to GPU
 * @as:  name of the address space object
 * @gpu: name of the GPU object
 *
 * Function emits a timeline message informing that address space object
 * shall be deleted along with GPU object.
 * This message is directed to timeline summary stream.
 */
#define KBASE_TLSTREAM_TL_SUMMARY_LIFELINK_AS_GPU(as, gpu) \
	__TRACE_IF_ENABLED(tl_summary_lifelink_as_gpu, as, gpu)

/**
 * KBASE_TLSTREAM_TL_NEW_CTX - create context object in timeline
 * @context: name of the context object
 * @nr:      context number
 * @tgid:    thread Group Id
 *
 * Function emits a timeline message informing about context creation. Context
 * is created with context number (its attribute), that can be used to link
 * kbase context with userspace context.
 */
#define KBASE_TLSTREAM_TL_NEW_CTX(context, nr, tgid) \
	__TRACE_IF_ENABLED(tl_new_ctx, context, nr, tgid)

/**
 * KBASE_TLSTREAM_TL_NEW_ATOM - create atom object in timeline
 * @atom: name of the atom object
 * @nr:   sequential number assigned to this atom
 *
 * Function emits a timeline message informing about atom creation. Atom is
 * created with atom number (its attribute) that links it with actual work
 * bucket id understood by hardware.
 */
#define KBASE_TLSTREAM_TL_NEW_ATOM(atom, nr) \
	__TRACE_IF_ENABLED(tl_new_atom, atom, nr)

/**
 * KBASE_TLSTREAM_TL_DEL_CTX - destroy context object in timeline
 * @context: name of the context object
 *
 * Function emits a timeline message informing that context object ceased to
 * exist.
 */
#define KBASE_TLSTREAM_TL_DEL_CTX(context) \
	__TRACE_IF_ENABLED(tl_del_ctx, context)

/**
 * KBASE_TLSTREAM_TL_DEL_ATOM - destroy atom object in timeline
 * @atom: name of the atom object
 *
 * Function emits a timeline message informing that atom object ceased to
 * exist.
 */
#define KBASE_TLSTREAM_TL_DEL_ATOM(atom) \
	__TRACE_IF_ENABLED(tl_del_atom, atom)

/**
 * KBASE_TLSTREAM_TL_RET_CTX_LPU - retain context by LPU
 * @context: name of the context object
 * @lpu:     name of the Logical Processing Unit object
 *
 * Function emits a timeline message informing that context is being held
 * by LPU and must not be deleted unless it is released.
 */
#define KBASE_TLSTREAM_TL_RET_CTX_LPU(context, lpu) \
	__TRACE_IF_ENABLED(tl_ret_ctx_lpu, context, lpu)

/**
 * KBASE_TLSTREAM_TL_RET_ATOM_CTX - retain atom by context
 * @atom:    name of the atom object
 * @context: name of the context object
 *
 * Function emits a timeline message informing that atom object is being held
 * by context and must not be deleted unless it is released.
 */
#define KBASE_TLSTREAM_TL_RET_ATOM_CTX(atom, context) \
	__TRACE_IF_ENABLED(tl_ret_atom_ctx, atom, context)

/**
 * KBASE_TLSTREAM_TL_RET_ATOM_LPU - retain atom by LPU
 * @atom:              name of the atom object
 * @lpu:               name of the Logical Processing Unit object
 * @attrib_match_list: list containing match operator attributes
 *
 * Function emits a timeline message informing that atom object is being held
 * by LPU and must not be deleted unless it is released.
 */
#define KBASE_TLSTREAM_TL_RET_ATOM_LPU(atom, lpu, attrib_match_list) \
	__TRACE_IF_ENABLED(tl_ret_atom_lpu, atom, lpu, attrib_match_list)

/**
 * KBASE_TLSTREAM_TL_NRET_CTX_LPU - release context by LPU
 * @context: name of the context object
 * @lpu:     name of the Logical Processing Unit object
 *
 * Function emits a timeline message informing that context is being released
 * by LPU object.
 */
#define KBASE_TLSTREAM_TL_NRET_CTX_LPU(context, lpu) \
	__TRACE_IF_ENABLED(tl_nret_ctx_lpu, context, lpu)

/**
 * KBASE_TLSTREAM_TL_NRET_ATOM_CTX - release atom by context
 * @atom:    name of the atom object
 * @context: name of the context object
 *
 * Function emits a timeline message informing that atom object is being
 * released by context.
 */
#define KBASE_TLSTREAM_TL_NRET_ATOM_CTX(atom, context) \
	__TRACE_IF_ENABLED(tl_nret_atom_ctx, atom, context)

/**
 * KBASE_TLSTREAM_TL_NRET_ATOM_LPU - release atom by LPU
 * @atom: name of the atom object
 * @lpu:  name of the Logical Processing Unit object
 *
 * Function emits a timeline message informing that atom object is being
 * released by LPU.
 */
#define KBASE_TLSTREAM_TL_NRET_ATOM_LPU(atom, lpu) \
	__TRACE_IF_ENABLED(tl_nret_atom_lpu, atom, lpu)

/**
 * KBASE_TLSTREAM_TL_RET_AS_CTX - lifelink address space object to context
 * @as:  name of the address space object
 * @ctx: name of the context object
 *
 * Function emits a timeline message informing that address space object
 * is being held by the context object.
 */
#define KBASE_TLSTREAM_TL_RET_AS_CTX(as, ctx) \
	__TRACE_IF_ENABLED(tl_ret_as_ctx, as, ctx)

/**
 * KBASE_TLSTREAM_TL_NRET_AS_CTX - release address space by context
 * @as:  name of the address space object
 * @ctx: name of the context object
 *
 * Function emits a timeline message informing that address space object
 * is being released by atom.
 */
#define KBASE_TLSTREAM_TL_NRET_AS_CTX(as, ctx) \
	__TRACE_IF_ENABLED(tl_nret_as_ctx, as, ctx)

/**
 * KBASE_TLSTREAM_TL_RET_ATOM_AS - retain atom by address space
 * @atom: name of the atom object
 * @as:   name of the address space object
 *
 * Function emits a timeline message informing that atom object is being held
 * by address space and must not be deleted unless it is released.
 */
#define KBASE_TLSTREAM_TL_RET_ATOM_AS(atom, as) \
	__TRACE_IF_ENABLED(tl_ret_atom_as, atom, as)

/**
 * KBASE_TLSTREAM_TL_NRET_ATOM_AS - release atom by address space
 * @atom: name of the atom object
 * @as:   name of the address space object
 *
 * Function emits a timeline message informing that atom object is being
 * released by address space.
 */
#define KBASE_TLSTREAM_TL_NRET_ATOM_AS(atom, as) \
	__TRACE_IF_ENABLED(tl_nret_atom_as, atom, as)

/**
 * KBASE_TLSTREAM_TL_DEP_ATOM_ATOM - parent atom depends on child atom
 * @atom1: name of the child atom object
 * @atom2: name of the parent atom object that depends on child atom
 *
 * Function emits a timeline message informing that parent atom waits for
 * child atom object to be completed before start its execution.
 */
#define KBASE_TLSTREAM_TL_DEP_ATOM_ATOM(atom1, atom2) \
	__TRACE_IF_ENABLED(tl_dep_atom_atom, atom1, atom2)

/**
 * KBASE_TLSTREAM_TL_NDEP_ATOM_ATOM - dependency between atoms resolved
 * @atom1: name of the child atom object
 * @atom2: name of the parent atom object that depended on child atom
 *
 * Function emits a timeline message informing that parent atom execution
 * dependency on child atom has been resolved.
 */
#define KBASE_TLSTREAM_TL_NDEP_ATOM_ATOM(atom1, atom2) \
	__TRACE_IF_ENABLED(tl_ndep_atom_atom, atom1, atom2)

/**
 * KBASE_TLSTREAM_TL_RDEP_ATOM_ATOM - information about already resolved dependency between atoms
 * @atom1: name of the child atom object
 * @atom2: name of the parent atom object that depended on child atom
 *
 * Function emits a timeline message informing that parent atom execution
 * dependency on child atom has been resolved.
 */
#define KBASE_TLSTREAM_TL_RDEP_ATOM_ATOM(atom1, atom2) \
	__TRACE_IF_ENABLED(tl_rdep_atom_atom, atom1, atom2)

/**
 * KBASE_TLSTREAM_TL_ATTRIB_ATOM_CONFIG - atom job slot attributes
 * @atom:     name of the atom object
 * @jd:       job descriptor address
 * @affinity: job affinity
 * @config:   job config
 *
 * Function emits a timeline message containing atom attributes.
 */
#define KBASE_TLSTREAM_TL_ATTRIB_ATOM_CONFIG(atom, jd, affinity, config) \
	__TRACE_IF_ENABLED(tl_attrib_atom_config, atom, jd, affinity, config)

/**
 * KBASE_TLSTREAM_TL_ATTRIB_ATOM_PRIORITY - atom priority
 * @atom: name of the atom object
 * @prio: atom priority
 *
 * Function emits a timeline message containing atom priority.
 */
#define KBASE_TLSTREAM_TL_ATTRIB_ATOM_PRIORITY(atom, prio) \
	__TRACE_IF_ENABLED_LATENCY(tl_attrib_atom_priority, atom, prio)

/**
 * KBASE_TLSTREAM_TL_ATTRIB_ATOM_STATE - atom state
 * @atom:  name of the atom object
 * @state: atom state
 *
 * Function emits a timeline message containing atom state.
 */
#define KBASE_TLSTREAM_TL_ATTRIB_ATOM_STATE(atom, state) \
	__TRACE_IF_ENABLED_LATENCY(tl_attrib_atom_state, atom, state)

/**
 * KBASE_TLSTREAM_TL_ATTRIB_ATOM_PRIORITY_CHANGE - atom caused priority change
 * @atom:  name of the atom object
 *
 * Function emits a timeline message signalling priority change
 */
#define KBASE_TLSTREAM_TL_ATTRIB_ATOM_PRIORITY_CHANGE(atom) \
	__TRACE_IF_ENABLED_LATENCY(tl_attrib_atom_priority_change, atom)

/**
 * KBASE_TLSTREAM_TL_ATTRIB_AS_CONFIG - address space attributes
 * @as:       assigned address space
 * @transtab: configuration of the TRANSTAB register
 * @memattr:  configuration of the MEMATTR register
 * @transcfg: configuration of the TRANSCFG register (or zero if not present)
 *
 * Function emits a timeline message containing address space attributes.
 */
#define KBASE_TLSTREAM_TL_ATTRIB_AS_CONFIG(as, transtab, memattr, transcfg) \
	__TRACE_IF_ENABLED(tl_attrib_as_config, as, transtab, memattr, transcfg)

/**
 * KBASE_TLSTREAM_TL_EVENT_ATOM_SOFTSTOP_ex
 * @atom:       atom identifier
 */
#define KBASE_TLSTREAM_TL_EVENT_ATOM_SOFTSTOP_EX(atom) \
	__TRACE_IF_ENABLED(tl_event_atom_softstop_ex, atom)

/**
 * KBASE_TLSTREAM_TL_EVENT_LPU_softstop
 * @lpu:        name of the LPU object
 */
#define KBASE_TLSTREAM_TL_EVENT_LPU_SOFTSTOP(lpu) \
	__TRACE_IF_ENABLED(tl_event_lpu_softstop, lpu)

/**
 * KBASE_TLSTREAM_TL_EVENT_ATOM_SOFTSTOP_issue
 * @atom:       atom identifier
 */
#define KBASE_TLSTREAM_TL_EVENT_ATOM_SOFTSTOP_ISSUE(atom) \
	__TRACE_IF_ENABLED(tl_event_atom_softstop_issue, atom)

/**
 * KBASE_TLSTREAM_JD_GPU_SOFT_RESET - The GPU is being soft reset
 * @gpu:        name of the GPU object
 *
 * This imperative tracepoint is specific to job dumping.
 * Function emits a timeline message indicating GPU soft reset.
 */
#define KBASE_TLSTREAM_JD_GPU_SOFT_RESET(gpu) \
	__TRACE_IF_ENABLED(jd_gpu_soft_reset, gpu)


/**
 * KBASE_TLSTREAM_AUX_PM_STATE - timeline message: power management state
 * @core_type: core type (shader, tiler, l2 cache, l3 cache)
 * @state:     64bits bitmask reporting power state of the cores (1-ON, 0-OFF)
 */
#define KBASE_TLSTREAM_AUX_PM_STATE(core_type, state) \
	__TRACE_IF_ENABLED(aux_pm_state, core_type, state)

/**
 * KBASE_TLSTREAM_AUX_PAGEFAULT - timeline message: MMU page fault event
 *                                resulting in new pages being mapped
 * @ctx_nr:            kernel context number
 * @page_count_change: number of pages to be added
 */
#define KBASE_TLSTREAM_AUX_PAGEFAULT(ctx_nr, page_count_change) \
	__TRACE_IF_ENABLED(aux_pagefault, ctx_nr, page_count_change)

/**
 * KBASE_TLSTREAM_AUX_PAGESALLOC - timeline message: total number of allocated
 *                                 pages is changed
 * @ctx_nr:     kernel context number
 * @page_count: number of pages used by the context
 */
#define KBASE_TLSTREAM_AUX_PAGESALLOC(ctx_nr, page_count) \
	__TRACE_IF_ENABLED(aux_pagesalloc, ctx_nr, page_count)

/**
 * KBASE_TLSTREAM_AUX_DEVFREQ_TARGET - timeline message: new target DVFS
 *                                     frequency
 * @target_freq: new target frequency
 */
#define KBASE_TLSTREAM_AUX_DEVFREQ_TARGET(target_freq) \
	__TRACE_IF_ENABLED(aux_devfreq_target, target_freq)

/**
 * KBASE_TLSTREAM_AUX_PROTECTED_ENTER_START - The GPU has started transitioning
 *                                            to protected mode
 * @gpu: name of the GPU object
 *
 * Function emits a timeline message indicating the GPU is starting to
 * transition to protected mode.
 */
#define KBASE_TLSTREAM_AUX_PROTECTED_ENTER_START(gpu) \
	__TRACE_IF_ENABLED_LATENCY(aux_protected_enter_start, gpu)

/**
 * KBASE_TLSTREAM_AUX_PROTECTED_ENTER_END - The GPU has finished transitioning
 *                                          to protected mode
 * @gpu: name of the GPU object
 *
 * Function emits a timeline message indicating the GPU has finished
 * transitioning to protected mode.
 */
#define KBASE_TLSTREAM_AUX_PROTECTED_ENTER_END(gpu) \
	__TRACE_IF_ENABLED_LATENCY(aux_protected_enter_end, gpu)

/**
 * KBASE_TLSTREAM_AUX_PROTECTED_LEAVE_START - The GPU has started transitioning
 *                                            to non-protected mode
 * @gpu: name of the GPU object
 *
 * Function emits a timeline message indicating the GPU is starting to
 * transition to non-protected mode.
 */
#define KBASE_TLSTREAM_AUX_PROTECTED_LEAVE_START(gpu) \
	__TRACE_IF_ENABLED_LATENCY(aux_protected_leave_start, gpu)

/**
 * KBASE_TLSTREAM_AUX_PROTECTED_LEAVE_END - The GPU has finished transitioning
 *                                          to non-protected mode
 * @gpu: name of the GPU object
 *
 * Function emits a timeline message indicating the GPU has finished
 * transitioning to non-protected mode.
 */
#define KBASE_TLSTREAM_AUX_PROTECTED_LEAVE_END(gpu) \
	__TRACE_IF_ENABLED_LATENCY(aux_protected_leave_end, gpu)

#endif /* _KBASE_TLSTREAM_H */