MALI: rockchip: upgrade DDK to r8p0-02rel0.
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / arm / midgard / mali_kbase_vinstr.h
1 /*
2  *
3  * (C) COPYRIGHT 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 #ifndef _KBASE_VINSTR_H_
19 #define _KBASE_VINSTR_H_
20
21 #include <mali_kbase.h>
22 #include <mali_kbase_hwcnt_reader.h>
23
24 /*****************************************************************************/
25
26 struct kbase_vinstr_context;
27 struct kbase_vinstr_client;
28
29 /*****************************************************************************/
30
31 /**
32  * kbase_vinstr_init() - initialize the vinstr core
33  * @kbdev: kbase device
34  *
35  * Return: pointer to the vinstr context on success or NULL on failure
36  */
37 struct kbase_vinstr_context *kbase_vinstr_init(struct kbase_device *kbdev);
38
39 /**
40  * kbase_vinstr_term() - terminate the vinstr core
41  * @vinstr_ctx: vinstr context
42  */
43 void kbase_vinstr_term(struct kbase_vinstr_context *vinstr_ctx);
44
45 /**
46  * kbase_vinstr_hwcnt_reader_setup - configure hw counters reader
47  * @vinstr_ctx: vinstr context
48  * @setup:      reader's configuration
49  *
50  * Return: zero on success
51  */
52 int kbase_vinstr_hwcnt_reader_setup(
53                 struct kbase_vinstr_context        *vinstr_ctx,
54                 struct kbase_uk_hwcnt_reader_setup *setup);
55
56 /**
57  * kbase_vinstr_legacy_hwc_setup - configure hw counters for dumping
58  * @vinstr_ctx: vinstr context
59  * @cli:        pointer where to store pointer to new vinstr client structure
60  * @setup:      hwc configuration
61  *
62  * Return: zero on success
63  */
64 int kbase_vinstr_legacy_hwc_setup(
65                 struct kbase_vinstr_context *vinstr_ctx,
66                 struct kbase_vinstr_client  **cli,
67                 struct kbase_uk_hwcnt_setup *setup);
68
69 /**
70  * kbase_vinstr_hwcnt_kernel_setup - configure hw counters for kernel side
71  *                                   client
72  * @vinstr_ctx:    vinstr context
73  * @setup:         reader's configuration
74  * @kernel_buffer: pointer to dump buffer
75  *
76  * setup->buffer_count and setup->fd are not used for kernel side clients.
77  *
78  * Return: pointer to client structure, or NULL on failure
79  */
80 struct kbase_vinstr_client *kbase_vinstr_hwcnt_kernel_setup(
81                 struct kbase_vinstr_context *vinstr_ctx,
82                 struct kbase_uk_hwcnt_reader_setup *setup,
83                 void *kernel_buffer);
84
85 /**
86  * kbase_vinstr_hwc_dump - issue counter dump for vinstr client
87  * @cli:      pointer to vinstr client
88  * @event_id: id of event that triggered hwcnt dump
89  *
90  * Return: zero on success
91  */
92 int kbase_vinstr_hwc_dump(
93                 struct kbase_vinstr_client   *cli,
94                 enum base_hwcnt_reader_event event_id);
95
96 /**
97  * kbase_vinstr_hwc_clear - performs a reset of the hardware counters for
98  *                          a given kbase context
99  * @cli: pointer to vinstr client
100  *
101  * Return: zero on success
102  */
103 int kbase_vinstr_hwc_clear(struct kbase_vinstr_client *cli);
104
105 /**
106  * kbase_vinstr_hwc_suspend - suspends hardware counter collection for
107  *                            a given kbase context
108  * @vinstr_ctx: vinstr context
109  */
110 void kbase_vinstr_hwc_suspend(struct kbase_vinstr_context *vinstr_ctx);
111
112 /**
113  * kbase_vinstr_hwc_resume - resumes hardware counter collection for
114  *                            a given kbase context
115  * @vinstr_ctx: vinstr context
116  */
117 void kbase_vinstr_hwc_resume(struct kbase_vinstr_context *vinstr_ctx);
118
119 /**
120  * kbase_vinstr_dump_size - Return required size of dump buffer
121  * @kbdev: device pointer
122  *
123  * Return : buffer size in bytes
124  */
125 size_t kbase_vinstr_dump_size(struct kbase_device *kbdev);
126
127 /**
128  * kbase_vinstr_detach_client - Detach a client from the vinstr core
129  * @cli: Pointer to vinstr client
130  */
131 void kbase_vinstr_detach_client(struct kbase_vinstr_client *cli);
132
133 #endif /* _KBASE_VINSTR_H_ */
134