3 * (C) COPYRIGHT 2014-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.
21 * HW Access instrumentation common APIs
24 #ifndef _KBASE_HWACCESS_INSTR_H_
25 #define _KBASE_HWACCESS_INSTR_H_
27 #include <mali_kbase_instr_defs.h>
30 * kbase_instr_hwcnt_enable_internal - Enable HW counters collection
31 * @kbdev: Kbase device
32 * @kctx: Kbase context
33 * @setup: HW counter setup parameters
35 * Context: might sleep, waiting for reset to complete
37 * Return: 0 on success
39 int kbase_instr_hwcnt_enable_internal(struct kbase_device *kbdev,
40 struct kbase_context *kctx,
41 struct kbase_uk_hwcnt_setup *setup);
44 * kbase_instr_hwcnt_disable_internal - Disable HW counters collection
45 * @kctx: Kbase context
47 * Context: might sleep, waiting for an ongoing dump to complete
49 * Return: 0 on success
51 int kbase_instr_hwcnt_disable_internal(struct kbase_context *kctx);
54 * kbase_instr_hwcnt_request_dump() - Request HW counter dump from GPU
55 * @kctx: Kbase context
57 * Caller must either wait for kbase_instr_hwcnt_dump_complete() to return true,
58 * of call kbase_instr_hwcnt_wait_for_dump().
60 * Return: 0 on success
62 int kbase_instr_hwcnt_request_dump(struct kbase_context *kctx);
65 * kbase_instr_hwcnt_wait_for_dump() - Wait until pending HW counter dump has
67 * @kctx: Kbase context
69 * Context: will sleep, waiting for dump to complete
71 * Return: 0 on success
73 int kbase_instr_hwcnt_wait_for_dump(struct kbase_context *kctx);
76 * kbase_instr_hwcnt_dump_complete - Tell whether the HW counters dump has
78 * @kctx: Kbase context
79 * @success: Set to true if successful
81 * Context: does not sleep.
83 * Return: true if the dump is complete
85 bool kbase_instr_hwcnt_dump_complete(struct kbase_context *kctx,
86 bool * const success);
89 * kbase_instr_hwcnt_clear() - Clear HW counters
90 * @kctx: Kbase context
92 * Context: might sleep, waiting for reset to complete
94 * Return: 0 on success
96 int kbase_instr_hwcnt_clear(struct kbase_context *kctx);
99 * kbase_instr_backend_init() - Initialise the instrumentation backend
100 * @kbdev: Kbase device
102 * This function should be called during driver initialization.
104 * Return: 0 on success
106 int kbase_instr_backend_init(struct kbase_device *kbdev);
109 * kbase_instr_backend_init() - Terminate the instrumentation backend
110 * @kbdev: Kbase device
112 * This function should be called during driver termination.
114 void kbase_instr_backend_term(struct kbase_device *kbdev);
116 #endif /* _KBASE_HWACCESS_INSTR_H_ */