summaryrefslogtreecommitdiff
path: root/dvalin/kernel/drivers/gpu/arm/midgard/mali_kbase_mem_pool_debugfs.h
blob: 207b58536a58b21da9957de386f4f68f9ca0e111 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
 *
 * (C) COPYRIGHT 2014-2021 ARM Limited. All rights reserved.
 *
 * This program is free software and is provided to you under the terms of the
 * GNU General Public License version 2 as published by the Free Software
 * Foundation, and any use by you of this program is subject to the terms
 * of such GNU license.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, you can access it online at
 * http://www.gnu.org/licenses/gpl-2.0.html.
 *
 */

#ifndef _KBASE_MEM_POOL_DEBUGFS_H_
#define _KBASE_MEM_POOL_DEBUGFS_H_

#include <mali_kbase.h>

/**
 * kbase_mem_pool_debugfs_init - add debugfs knobs for @pool
 * @parent:  Parent debugfs dentry
 * @kctx:    The kbase context
 *
 * Adds four debugfs files under @parent:
 * - mem_pool_size: get/set the current sizes of @kctx: mem_pools
 * - mem_pool_max_size: get/set the max sizes of @kctx: mem_pools
 * - lp_mem_pool_size: get/set the current sizes of @kctx: lp_mem_pool
 * - lp_mem_pool_max_size: get/set the max sizes of @kctx:lp_mem_pool
 */
void kbase_mem_pool_debugfs_init(struct dentry *parent,
		struct kbase_context *kctx);

/**
 * kbase_mem_pool_debugfs_trim - Grow or shrink a memory pool to a new size
 *
 * @array: Address of the first in an array of physical memory pools.
 * @index: A memory group ID to be used as an index into the array of memory
 *         pools. Valid range is 0..(MEMORY_GROUP_MANAGER_NR_GROUPS-1).
 * @value: New number of pages in the pool.
 *
 * If @value > current size, fill the pool with new pages from the kernel, but
 * not above the max_size for the pool.
 * If @value < current size, shrink the pool by freeing pages to the kernel.
 */
void kbase_mem_pool_debugfs_trim(void *array, size_t index, size_t value);

/**
 * kbase_mem_pool_debugfs_set_max_size - Set maximum number of free pages in
 *                                       memory pool
 *
 * @array: Address of the first in an array of physical memory pools.
 * @index: A memory group ID to be used as an index into the array of memory
 *         pools. Valid range is 0..(MEMORY_GROUP_MANAGER_NR_GROUPS-1).
 * @value: Maximum number of free pages the pool can hold.
 *
 * If the maximum size is reduced, the pool will be shrunk to adhere to the
 * new limit. For details see kbase_mem_pool_shrink().
 */
void kbase_mem_pool_debugfs_set_max_size(void *array, size_t index,
	size_t value);

/**
 * kbase_mem_pool_debugfs_size - Get number of free pages in a memory pool
 *
 * @array: Address of the first in an array of physical memory pools.
 * @index: A memory group ID to be used as an index into the array of memory
 *         pools. Valid range is 0..(MEMORY_GROUP_MANAGER_NR_GROUPS-1).
 *
 * Note: the size of the pool may in certain corner cases exceed @max_size!
 *
 * Return: Number of free pages in the pool
 */
size_t kbase_mem_pool_debugfs_size(void *array, size_t index);

/**
 * kbase_mem_pool_debugfs_max_size - Get maximum number of free pages in a
 *                                   memory pool
 *
 * @array: Address of the first in an array of physical memory pools.
 * @index: A memory group ID to be used as an index into the array of memory
 *         pools. Valid range is 0..(MEMORY_GROUP_MANAGER_NR_GROUPS-1).
 *
 * Return: Maximum number of free pages in the pool
 */
size_t kbase_mem_pool_debugfs_max_size(void *array, size_t index);

/**
 * kbase_mem_pool_config_debugfs_set_max_size - Set maximum number of free pages
 *                                              in initial configuration of pool
 *
 * @array:  Array of initial configurations for a set of physical memory pools.
 * @index:  A memory group ID to be used as an index into the array.
 *          Valid range is 0..(MEMORY_GROUP_MANAGER_NR_GROUPS-1).
 * @value : Maximum number of free pages that a memory pool created from the
 *          selected configuration can hold.
 */
void kbase_mem_pool_config_debugfs_set_max_size(void *array, size_t index,
	size_t value);

/**
 * kbase_mem_pool_config_debugfs_max_size - Get maximum number of free pages
 *                                          from initial configuration of pool
 *
 * @array:  Array of initial configurations for a set of physical memory pools.
 * @index:  A memory group ID to be used as an index into the array.
 *          Valid range is 0..(MEMORY_GROUP_MANAGER_NR_GROUPS-1).
 *
 * Return: Maximum number of free pages that a memory pool created from the
 *         selected configuration can hold.
 */
size_t kbase_mem_pool_config_debugfs_max_size(void *array, size_t index);

#endif  /*_KBASE_MEM_POOL_DEBUGFS_H_ */