• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef _PRIORITY_CONTROL_MANAGER_H_
23 #define _PRIORITY_CONTROL_MANAGER_H_
24 
25 #include <linux/mm.h>
26 #include <linux/of.h>
27 #include <linux/version.h>
28 
29 struct priority_control_manager_device;
30 
31 /**
32  * struct priority_control_manager_ops - Callbacks for priority control manager operations
33  *
34  * @pcm_scheduler_priority_check: Callback to check if scheduling priority level can be requested
35  */
36 struct priority_control_manager_ops {
37 	/*
38 	 * pcm_scheduler_priority_check: This function can be used to check what priority its work
39 	 *                               would be treated as based on the requested_priority value.
40 	 *
41 	 * @pcm_dev:                     The priority control manager through which the request is
42 	 *                               being made.
43 	 * @task:                        The task struct of the process requesting the priority check.
44 	 * @requested_priority:          The priority level being requested.
45 	 *
46 	 * The returned value will be:
47 	 *   The same as requested_priority if the process has permission to use requested_priority
48 	 *   A lower priority value if the process does not have permission to use requested_priority
49 	 *
50 	 * requested_priority has the following value range:
51 	 *   0-3 : Priority level, 0 being highest and 3 being lowest
52 	 *
53 	 * Return: The priority that would actually be given, could be lower than requested_priority
54 	 */
55 	int (*pcm_scheduler_priority_check)(
56 		struct priority_control_manager_device *pcm_dev,
57 		struct task_struct *task, int requested_priority);
58 };
59 
60 /**
61  * struct priority_control_manager_device - Device structure for priority
62  *                                          control manager
63  *
64  * @ops:   Callbacks associated with this device
65  * @data:  Pointer to device private data
66  * @owner: Pointer to the module owner
67  *
68  * This structure should be registered with the platform device using
69  * platform_set_drvdata().
70  */
71 struct priority_control_manager_device {
72 	struct priority_control_manager_ops ops;
73 	void *data;
74 	struct module *owner;
75 };
76 
77 #endif /* _PRIORITY_CONTROL_MANAGER_H_ */
78