xref: /OK3568_Linux_fs/kernel/drivers/gpu/arm/bifrost/hwcnt/backend/mali_kbase_hwcnt_backend_jm_watchdog.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  *
4  * (C) COPYRIGHT 2021-2022 ARM Limited. All rights reserved.
5  *
6  * This program is free software and is provided to you under the terms of the
7  * GNU General Public License version 2 as published by the Free Software
8  * Foundation, and any use by you of this program is subject to the terms
9  * of such GNU license.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, you can access it online at
18  * http://www.gnu.org/licenses/gpl-2.0.html.
19  *
20  */
21 
22 /*
23  * Concrete implementation of mali_kbase_hwcnt_backend interface for job manager
24  * backend. This module functionally interleaves between the hardware counter
25  * (hwcnt_accumulator) module (the interface consumer) and the job manager
26  * backend module (hwcnt_backend_jm). This module provides buffering
27  * functionality for the dumping requests requested by the hwcnt_accumulator
28  * consumer. This module is NOT multi-thread safe. The programmer must
29  * ensure the exposed methods are called by at most one thread at any time.
30  */
31 
32 #ifndef _KBASE_HWCNT_BACKEND_JM_WATCHDOG_H_
33 #define _KBASE_HWCNT_BACKEND_JM_WATCHDOG_H_
34 
35 #include <hwcnt/backend/mali_kbase_hwcnt_backend.h>
36 #include <hwcnt/mali_kbase_hwcnt_watchdog_if.h>
37 
38 /**
39  * kbase_hwcnt_backend_jm_watchdog_create() - Create a job manager hardware counter watchdog
40  *                                            backend interface.
41  * @backend_iface:  Non-NULL pointer to the backend interface structure that this module will
42  *                  extend.
43  * @watchdog_iface: Non-NULL pointer to an hardware counter watchdog interface.
44  * @out_iface:      Non-NULL pointer to backend interface structure that is filled in
45  *                  on creation success.
46  *
47  * Calls to out_iface->dump_enable_nolock() require kbdev->hwaccess_lock held.
48  *
49  * Return: 0 on success, error otherwise.
50  */
51 int kbase_hwcnt_backend_jm_watchdog_create(struct kbase_hwcnt_backend_interface *backend_iface,
52 					   struct kbase_hwcnt_watchdog_interface *watchdog_iface,
53 					   struct kbase_hwcnt_backend_interface *out_iface);
54 
55 /**
56  * kbase_hwcnt_backend_jm_watchdog_destroy() - Destroy a job manager hardware counter watchdog
57  *                                             backend interface.
58  * @iface: Pointer to interface to destroy.
59  *
60  * Can be safely called on an all-zeroed interface, or on an already destroyed
61  * interface.
62  */
63 void kbase_hwcnt_backend_jm_watchdog_destroy(struct kbase_hwcnt_backend_interface *iface);
64 
65 #endif /* _KBASE_HWCNT_BACKEND_JM_WATCHDOG_H_ */
66