1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3 *
4 * (C) COPYRIGHT 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: Driver Capability Queries.
24 */
25
26 #ifndef _KBASE_CAPS_H_
27 #define _KBASE_CAPS_H_
28
29 #include <linux/types.h>
30
31 /**
32 * enum mali_kbase_cap - Enumeration for kbase capability
33 *
34 * @MALI_KBASE_CAP_SYSTEM_MONITOR: System Monitor
35 * @MALI_KBASE_CAP_JIT_PRESSURE_LIMIT: JIT Pressure limit
36 * @MALI_KBASE_CAP_MEM_GROW_ON_GPF: Memory grow on page fault
37 * @MALI_KBASE_CAP_MEM_PROTECTED: Protected memory
38 * @MALI_KBASE_NUM_CAPS: Delimiter
39 */
40 enum mali_kbase_cap {
41 MALI_KBASE_CAP_SYSTEM_MONITOR = 0,
42 MALI_KBASE_CAP_JIT_PRESSURE_LIMIT,
43 MALI_KBASE_CAP_MEM_GROW_ON_GPF,
44 MALI_KBASE_CAP_MEM_PROTECTED,
45 MALI_KBASE_NUM_CAPS
46 };
47
48 extern bool mali_kbase_supports_cap(unsigned long api_version, enum mali_kbase_cap cap);
49
mali_kbase_supports_system_monitor(unsigned long api_version)50 static inline bool mali_kbase_supports_system_monitor(unsigned long api_version)
51 {
52 return mali_kbase_supports_cap(api_version, MALI_KBASE_CAP_SYSTEM_MONITOR);
53 }
54
mali_kbase_supports_jit_pressure_limit(unsigned long api_version)55 static inline bool mali_kbase_supports_jit_pressure_limit(unsigned long api_version)
56 {
57 return mali_kbase_supports_cap(api_version, MALI_KBASE_CAP_JIT_PRESSURE_LIMIT);
58 }
59
mali_kbase_supports_mem_grow_on_gpf(unsigned long api_version)60 static inline bool mali_kbase_supports_mem_grow_on_gpf(unsigned long api_version)
61 {
62 return mali_kbase_supports_cap(api_version, MALI_KBASE_CAP_MEM_GROW_ON_GPF);
63 }
64
mali_kbase_supports_mem_protected(unsigned long api_version)65 static inline bool mali_kbase_supports_mem_protected(unsigned long api_version)
66 {
67 return mali_kbase_supports_cap(api_version, MALI_KBASE_CAP_MEM_PROTECTED);
68 }
69
70 #endif /* __KBASE_CAPS_H_ */
71