• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * rtg control interface
4  *
5  * Copyright (c) 2022-2023 Huawei Technologies Co., Ltd.
6  */
7 
8 #ifndef __RTG_CTL_H
9 #define __RTG_CTL_H
10 
11 #include <linux/compat.h>
12 #include <linux/uaccess.h>
13 #include <linux/sched/rtg_ctrl.h>
14 
15 #include "frame_rtg.h"
16 
17 /* set rtg */
18 #define INVALID_VALUE 0xffff
19 #define DEFAULT_RT_PRIO 97
20 
21 #define MAX_DATA_LEN 256
22 #define DECIMAL 10
23 #define DEFAULT_MAX_UTIL 1024
24 #define MAX_SUBPROCESS_NUM 8
25 
26 #define RTG_ID_INVALID (-1)
27 /* fit for FFRT, original DEFAULT_MAX_RT_FRAME is 3 */
28 #define DEFAULT_MAX_RT_FRAME 10
29 #define MAX_RT_THREAD (MAX_TID_NUM + 2)
30 #define INIT_VALUE		(-1)
31 #define UPDATE_RTG_FRAME (1 << 0)
32 #define ADD_RTG_FRAME (1 << 1)
33 #define CLEAR_RTG_FRAME (1 << 2)
34 
35 #define DEFAULT_FREQ_CYCLE 4
36 #define MIN_FREQ_CYCLE 1
37 #define MAX_FREQ_CYCLE 16
38 #define DEFAULT_INVALID_INTERVAL 50
39 
40 /* proc_state */
41 enum proc_state {
42 	STATE_MIN = 0,
43 	FRAME_DRAWING,
44 	FRAME_RME_MAX = 19,
45 	/* rme end */
46 	FRAME_END_STATE = FRAME_RME_MAX + 1,
47 
48 	FRAME_CLICK = 100,
49 	STATE_MAX,
50 };
51 
52 enum rtg_config {
53 	RTG_FREQ_CYCLE,
54 	RTG_FRAME_MAX_UTIL,
55 	RTG_INVALID_INTERVAL,
56 	RTG_CONFIG_NUM,
57 };
58 
59 enum rtg_err_no {
60 	SUCC = 0,
61 	RTG_DISABLED = 1,
62 	INVALID_ARG,
63 	INVALID_MAGIC,
64 	INVALID_CMD,
65 	FRAME_ERR_PID = 100,
66 	NO_FREE_MULTI_FRAME,
67 	NOT_MULTI_FRAME,
68 	INVALID_RTG_ID,
69 	NO_RT_FRAME,
70 	INVALID_PROC_STATE,
71 };
72 
73 struct rtg_grp_data {
74 	int rtg_cmd;
75 	int grp_id;
76 	int grp_type;
77 	int rt_cnt;
78 	int tid_num;
79 	int tids[MAX_TID_NUM];
80 };
81 
82 struct rtg_proc_data {
83 	int rtgid;
84 	int type;
85 	int thread[MAX_TID_NUM];
86 	int rtcnt;
87 };
88 
89 #endif
90