18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ci#define CPUPRI_NR_PRIORITIES	(MAX_RT_PRIO + 2)
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#define CPUPRI_INVALID		-1
68c2ecf20Sopenharmony_ci#define CPUPRI_IDLE		 0
78c2ecf20Sopenharmony_ci#define CPUPRI_NORMAL		 1
88c2ecf20Sopenharmony_ci/* values 2-101 are RT priorities 0-99 */
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_cistruct cpupri_vec {
118c2ecf20Sopenharmony_ci	atomic_t		count;
128c2ecf20Sopenharmony_ci	cpumask_var_t		mask;
138c2ecf20Sopenharmony_ci};
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_cistruct cpupri {
168c2ecf20Sopenharmony_ci	struct cpupri_vec	pri_to_cpu[CPUPRI_NR_PRIORITIES];
178c2ecf20Sopenharmony_ci	int			*cpu_to_pri;
188c2ecf20Sopenharmony_ci};
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#ifdef CONFIG_SMP
218c2ecf20Sopenharmony_ciint  cpupri_find(struct cpupri *cp, struct task_struct *p,
228c2ecf20Sopenharmony_ci		 struct cpumask *lowest_mask);
238c2ecf20Sopenharmony_ciint  cpupri_find_fitness(struct cpupri *cp, struct task_struct *p,
248c2ecf20Sopenharmony_ci			 struct cpumask *lowest_mask,
258c2ecf20Sopenharmony_ci			 bool (*fitness_fn)(struct task_struct *p, int cpu));
268c2ecf20Sopenharmony_civoid cpupri_set(struct cpupri *cp, int cpu, int pri);
278c2ecf20Sopenharmony_ciint  cpupri_init(struct cpupri *cp);
288c2ecf20Sopenharmony_civoid cpupri_cleanup(struct cpupri *cp);
298c2ecf20Sopenharmony_ci#endif
30