MALI: rockchip: upgrade midgard DDK to r14p0-01rel0
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / arm / midgard / mali_kbase_hwaccess_instr.h
1 /*
2  *
3  * (C) COPYRIGHT 2014-2015 ARM Limited. All rights reserved.
4  *
5  * This program is free software and is provided to you under the terms of the
6  * GNU General Public License version 2 as published by the Free Software
7  * Foundation, and any use by you of this program is subject to the terms
8  * of such GNU licence.
9  *
10  * A copy of the licence is included with the program, and can also be obtained
11  * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
12  * Boston, MA  02110-1301, USA.
13  *
14  */
15
16
17
18
19
20 /*
21  * HW Access instrumentation common APIs
22  */
23
24 #ifndef _KBASE_HWACCESS_INSTR_H_
25 #define _KBASE_HWACCESS_INSTR_H_
26
27 #include <mali_kbase_instr_defs.h>
28
29 /**
30  * kbase_instr_hwcnt_enable_internal - Enable HW counters collection
31  * @kbdev:      Kbase device
32  * @kctx:       Kbase context
33  * @setup:      HW counter setup parameters
34  *
35  * Context: might sleep, waiting for reset to complete
36  *
37  * Return: 0 on success
38  */
39 int kbase_instr_hwcnt_enable_internal(struct kbase_device *kbdev,
40                                         struct kbase_context *kctx,
41                                         struct kbase_uk_hwcnt_setup *setup);
42
43 /**
44  * kbase_instr_hwcnt_disable_internal - Disable HW counters collection
45  * @kctx: Kbase context
46  *
47  * Context: might sleep, waiting for an ongoing dump to complete
48  *
49  * Return: 0 on success
50  */
51 int kbase_instr_hwcnt_disable_internal(struct kbase_context *kctx);
52
53 /**
54  * kbase_instr_hwcnt_request_dump() - Request HW counter dump from GPU
55  * @kctx:       Kbase context
56  *
57  * Caller must either wait for kbase_instr_hwcnt_dump_complete() to return true,
58  * of call kbase_instr_hwcnt_wait_for_dump().
59  *
60  * Return: 0 on success
61  */
62 int kbase_instr_hwcnt_request_dump(struct kbase_context *kctx);
63
64 /**
65  * kbase_instr_hwcnt_wait_for_dump() - Wait until pending HW counter dump has
66  *                                     completed.
67  * @kctx:       Kbase context
68  *
69  * Context: will sleep, waiting for dump to complete
70  *
71  * Return: 0 on success
72  */
73 int kbase_instr_hwcnt_wait_for_dump(struct kbase_context *kctx);
74
75 /**
76  * kbase_instr_hwcnt_dump_complete - Tell whether the HW counters dump has
77  *                                   completed
78  * @kctx:       Kbase context
79  * @success:    Set to true if successful
80  *
81  * Context: does not sleep.
82  *
83  * Return: true if the dump is complete
84  */
85 bool kbase_instr_hwcnt_dump_complete(struct kbase_context *kctx,
86                                                 bool * const success);
87
88 /**
89  * kbase_instr_hwcnt_clear() - Clear HW counters
90  * @kctx:       Kbase context
91  *
92  * Context: might sleep, waiting for reset to complete
93  *
94  * Return: 0 on success
95  */
96 int kbase_instr_hwcnt_clear(struct kbase_context *kctx);
97
98 /**
99  * kbase_instr_backend_init() - Initialise the instrumentation backend
100  * @kbdev:      Kbase device
101  *
102  * This function should be called during driver initialization.
103  *
104  * Return: 0 on success
105  */
106 int kbase_instr_backend_init(struct kbase_device *kbdev);
107
108 /**
109  * kbase_instr_backend_init() - Terminate the instrumentation backend
110  * @kbdev:      Kbase device
111  *
112  * This function should be called during driver termination.
113  */
114 void kbase_instr_backend_term(struct kbase_device *kbdev);
115
116 #endif /* _KBASE_HWACCESS_INSTR_H_ */