3 * (C) COPYRIGHT 2015 ARM Limited. All rights reserved.
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
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.
18 #ifndef _KBASE_VINSTR_H_
19 #define _KBASE_VINSTR_H_
21 #include <mali_kbase.h>
22 #include <mali_kbase_hwcnt_reader.h>
24 /*****************************************************************************/
26 struct kbase_vinstr_context;
27 struct kbase_vinstr_client;
29 /*****************************************************************************/
32 * kbase_vinstr_init() - initialize the vinstr core
33 * @kbdev: kbase device
35 * Return: pointer to the vinstr context on success or NULL on failure
37 struct kbase_vinstr_context *kbase_vinstr_init(struct kbase_device *kbdev);
40 * kbase_vinstr_term() - terminate the vinstr core
41 * @vinstr_ctx: vinstr context
43 void kbase_vinstr_term(struct kbase_vinstr_context *vinstr_ctx);
46 * kbase_vinstr_hwcnt_reader_setup - configure hw counters reader
47 * @vinstr_ctx: vinstr context
48 * @setup: reader's configuration
50 * Return: zero on success
52 int kbase_vinstr_hwcnt_reader_setup(
53 struct kbase_vinstr_context *vinstr_ctx,
54 struct kbase_uk_hwcnt_reader_setup *setup);
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
62 * Return: zero on success
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);
70 * kbase_vinstr_hwcnt_kernel_setup - configure hw counters for kernel side
72 * @vinstr_ctx: vinstr context
73 * @setup: reader's configuration
74 * @kernel_buffer: pointer to dump buffer
76 * setup->buffer_count and setup->fd are not used for kernel side clients.
78 * Return: pointer to client structure, or NULL on failure
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,
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
90 * Return: zero on success
92 int kbase_vinstr_hwc_dump(
93 struct kbase_vinstr_client *cli,
94 enum base_hwcnt_reader_event event_id);
97 * kbase_vinstr_hwc_clear - performs a reset of the hardware counters for
98 * a given kbase context
99 * @cli: pointer to vinstr client
101 * Return: zero on success
103 int kbase_vinstr_hwc_clear(struct kbase_vinstr_client *cli);
106 * kbase_vinstr_hwc_suspend - suspends hardware counter collection for
107 * a given kbase context
108 * @vinstr_ctx: vinstr context
110 void kbase_vinstr_hwc_suspend(struct kbase_vinstr_context *vinstr_ctx);
113 * kbase_vinstr_hwc_resume - resumes hardware counter collection for
114 * a given kbase context
115 * @vinstr_ctx: vinstr context
117 void kbase_vinstr_hwc_resume(struct kbase_vinstr_context *vinstr_ctx);
120 * kbase_vinstr_dump_size - Return required size of dump buffer
121 * @kbdev: device pointer
123 * Return : buffer size in bytes
125 size_t kbase_vinstr_dump_size(struct kbase_device *kbdev);
128 * kbase_vinstr_detach_client - Detach a client from the vinstr core
129 * @cli: Pointer to vinstr client
131 void kbase_vinstr_detach_client(struct kbase_vinstr_client *cli);
133 #endif /* _KBASE_VINSTR_H_ */