MALI: rockchip: upgrade to DDK r7p0-02rel0.
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / arm / midgard / mali_kbase_security.h
1 /*
2  *
3  * (C) COPYRIGHT 2011-2015 ARM Limited. All rights reserved.
4  *
5  * This program is free software and is provided to you under the terms of the
6  * GNU General Public License version 2 as published by the Free Software
7  * Foundation, and any use by you of this program is subject to the terms
8  * of such GNU licence.
9  *
10  * A copy of the licence is included with the program, and can also be obtained
11  * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
12  * Boston, MA  02110-1301, USA.
13  *
14  */
15
16
17
18
19
20 /**
21  * @file mali_kbase_security.h
22  * Base kernel security capability APIs
23  */
24
25 #ifndef _KBASE_SECURITY_H_
26 #define _KBASE_SECURITY_H_
27
28 /* Security flags */
29 #define KBASE_SEC_FLAG_NOAUDIT (0u << 0)        /* Silently handle privilege failure */
30 #define KBASE_SEC_FLAG_AUDIT   (1u << 0)        /* Write audit message on privilege failure */
31 #define KBASE_SEC_FLAG_MASK    (KBASE_SEC_FLAG_AUDIT)   /* Mask of all valid flag bits */
32
33 /* List of unique capabilities that have security access privileges */
34 enum kbase_security_capability {
35         /* Instrumentation Counters access privilege */
36         KBASE_SEC_INSTR_HW_COUNTERS_COLLECT = 1,
37         KBASE_SEC_MODIFY_PRIORITY
38             /* Add additional access privileges here */
39 };
40
41 /**
42  * kbase_security_has_capability - determine whether a task has a particular effective capability
43  * @param[in]   kctx    The task context.
44  * @param[in]   cap     The capability to check for.
45  * @param[in]   flags   Additional configuration information
46  *                      Such as whether to write an audit message or not.
47  * @return true if success (capability is allowed), false otherwise.
48  */
49
50 bool kbase_security_has_capability(struct kbase_context *kctx, enum kbase_security_capability cap, u32 flags);
51
52 #endif                          /* _KBASE_SECURITY_H_ */