1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  *
4  * (C) COPYRIGHT 2020-2021 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 typedef enum mali_kbase_cap {
32 	MALI_KBASE_CAP_SYSTEM_MONITOR = 0,
33 	MALI_KBASE_CAP_JIT_PRESSURE_LIMIT,
34 	MALI_KBASE_CAP_MEM_GROW_ON_GPF,
35 	MALI_KBASE_CAP_MEM_PROTECTED,
36 	MALI_KBASE_NUM_CAPS
37 } mali_kbase_cap;
38 
39 extern bool mali_kbase_supports_cap(unsigned long api_version, mali_kbase_cap cap);
40 
mali_kbase_supports_system_monitor(unsigned long api_version)41 static inline bool mali_kbase_supports_system_monitor(unsigned long api_version)
42 {
43 	return mali_kbase_supports_cap(api_version, MALI_KBASE_CAP_SYSTEM_MONITOR);
44 }
45 
mali_kbase_supports_jit_pressure_limit(unsigned long api_version)46 static inline bool mali_kbase_supports_jit_pressure_limit(unsigned long api_version)
47 {
48 	return mali_kbase_supports_cap(api_version, MALI_KBASE_CAP_JIT_PRESSURE_LIMIT);
49 }
50 
mali_kbase_supports_mem_grow_on_gpf(unsigned long api_version)51 static inline bool mali_kbase_supports_mem_grow_on_gpf(unsigned long api_version)
52 {
53 	return mali_kbase_supports_cap(api_version, MALI_KBASE_CAP_MEM_GROW_ON_GPF);
54 }
55 
mali_kbase_supports_mem_protected(unsigned long api_version)56 static inline bool mali_kbase_supports_mem_protected(unsigned long api_version)
57 {
58 	return mali_kbase_supports_cap(api_version, MALI_KBASE_CAP_MEM_PROTECTED);
59 }
60 
61 #endif	/* __KBASE_CAPS_H_ */
62