xref: /OK3568_Linux_fs/kernel/drivers/gpu/arm/bifrost/mali_kbase_mem_profile_debugfs.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  *
4  * (C) COPYRIGHT 2012-2016, 2020-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  * DOC: Header file for mem profiles entries in debugfs
24  *
25  */
26 
27 #ifndef _KBASE_MEM_PROFILE_DEBUGFS_H
28 #define _KBASE_MEM_PROFILE_DEBUGFS_H
29 
30 #include <linux/debugfs.h>
31 #include <linux/seq_file.h>
32 
33 /**
34  * kbasep_mem_profile_debugfs_remove - Remove entry from Mali memory profile debugfs
35  *
36  * @kctx: The context whose debugfs file @p data should be removed from
37  */
38 void kbasep_mem_profile_debugfs_remove(struct kbase_context *kctx);
39 
40 /**
41  * kbasep_mem_profile_debugfs_insert - Insert @p data to the debugfs file
42  *                                     so it can be read by userspace
43  *
44  * @kctx: The context whose debugfs file @p data should be inserted to
45  * @data: A NULL-terminated string to be inserted to the debugfs file,
46  *             without the trailing new line character
47  * @size: The length of the @p data string
48  *
49  * The function takes ownership of @p data and frees it later when new data
50  * is inserted.
51  *
52  * If the debugfs entry corresponding to the @p kctx doesn't exist,
53  * an attempt will be made to create it.
54  *
55  * Return: 0 if @p data inserted correctly, -EAGAIN in case of error
56  *
57  * @post @ref mem_profile_initialized will be set to @c true
58  *       the first time this function succeeds.
59  */
60 int kbasep_mem_profile_debugfs_insert(struct kbase_context *kctx, char *data,
61 					size_t size);
62 
63 #endif  /*_KBASE_MEM_PROFILE_DEBUGFS_H*/
64 
65