1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19#ifndef __GRULIB_H__
20#define __GRULIB_H__
21
22#define GRU_BASENAME "gru"
23#define GRU_FULLNAME "/dev/gru"
24#define GRU_IOCTL_NUM 'G'
25
26
27
28
29
30#define GRU_MAX_OPEN_CONTEXTS 32
31
32
33#define GRU_CREATE_CONTEXT _IOWR(GRU_IOCTL_NUM, 1, void *)
34
35
36#define GRU_SET_CONTEXT_OPTION _IOWR(GRU_IOCTL_NUM, 4, void *)
37
38
39#define GRU_USER_GET_EXCEPTION_DETAIL _IOWR(GRU_IOCTL_NUM, 6, void *)
40
41
42#define GRU_USER_CALL_OS _IOWR(GRU_IOCTL_NUM, 8, void *)
43
44
45#define GRU_USER_UNLOAD_CONTEXT _IOWR(GRU_IOCTL_NUM, 9, void *)
46
47
48#define GRU_DUMP_CHIPLET_STATE _IOWR(GRU_IOCTL_NUM, 11, void *)
49
50
51#define GRU_GET_GSEG_STATISTICS _IOWR(GRU_IOCTL_NUM, 12, void *)
52
53
54#define GRU_USER_FLUSH_TLB _IOWR(GRU_IOCTL_NUM, 50, void *)
55
56
57#define GRU_GET_CONFIG_INFO _IOWR(GRU_IOCTL_NUM, 51, void *)
58
59
60#define GRU_KTEST _IOWR(GRU_IOCTL_NUM, 52, void *)
61
62#define CONTEXT_WINDOW_BYTES(th) (GRU_GSEG_PAGESIZE * (th))
63#define THREAD_POINTER(p, th) (p + GRU_GSEG_PAGESIZE * (th))
64#define GSEG_START(cb) ((void *)((unsigned long)(cb) & ~(GRU_GSEG_PAGESIZE - 1)))
65
66
67
68
69struct gts_statistics {
70 unsigned long fmm_tlbdropin;
71 unsigned long upm_tlbdropin;
72 unsigned long context_stolen;
73};
74
75struct gru_get_gseg_statistics_req {
76 unsigned long gseg;
77 struct gts_statistics stats;
78};
79
80
81
82
83struct gru_create_context_req {
84 unsigned long gseg;
85 unsigned int data_segment_bytes;
86 unsigned int control_blocks;
87 unsigned int maximum_thread_count;
88 unsigned int options;
89};
90
91
92
93
94struct gru_unload_context_req {
95 unsigned long gseg;
96};
97
98
99
100
101enum {sco_gseg_owner, sco_cch_req_slice};
102struct gru_set_context_option_req {
103 unsigned long gseg;
104 int op;
105 unsigned long val1;
106};
107
108
109
110
111struct gru_flush_tlb_req {
112 unsigned long gseg;
113 unsigned long vaddr;
114 size_t len;
115};
116
117
118
119
120enum {dcs_pid, dcs_gid};
121struct gru_dump_chiplet_state_req {
122 unsigned int op;
123 unsigned int gid;
124 int ctxnum;
125 char data_opt;
126 char lock_cch;
127 pid_t pid;
128 void *buf;
129 size_t buflen;
130
131 unsigned int num_contexts;
132};
133
134#define GRU_DUMP_MAGIC 0x3474ab6c
135struct gru_dump_context_header {
136 unsigned int magic;
137 unsigned int gid;
138 unsigned char ctxnum;
139 unsigned char cbrcnt;
140 unsigned char dsrcnt;
141 pid_t pid;
142 unsigned long vaddr;
143 int cch_locked;
144 unsigned long data[0];
145};
146
147
148
149
150struct gru_config_info {
151 int cpus;
152 int blades;
153 int nodes;
154 int chiplets;
155 int fill[16];
156};
157
158#endif
159