blob: 6ab872665e7f958af4c22fda544acfadfb839319 [file] [log] [blame]
Jack Steiner13d19492008-07-29 22:33:55 -07001/*
2 * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
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 * Maximum number of GRU segments that a user can have open
28 * ZZZ temp - set high for testing. Revisit.
29 */
30#define GRU_MAX_OPEN_CONTEXTS 32
31
32/* Set Number of Request Blocks */
33#define GRU_CREATE_CONTEXT _IOWR(GRU_IOCTL_NUM, 1, void *)
34
35/* Register task as using the slice */
36#define GRU_SET_TASK_SLICE _IOWR(GRU_IOCTL_NUM, 5, void *)
37
38/* Fetch exception detail */
39#define GRU_USER_GET_EXCEPTION_DETAIL _IOWR(GRU_IOCTL_NUM, 6, void *)
40
41/* For user call_os handling - normally a TLB fault */
42#define GRU_USER_CALL_OS _IOWR(GRU_IOCTL_NUM, 8, void *)
43
44/* For user unload context */
45#define GRU_USER_UNLOAD_CONTEXT _IOWR(GRU_IOCTL_NUM, 9, void *)
46
47/* For fetching GRU chiplet status */
48#define GRU_GET_CHIPLET_STATUS _IOWR(GRU_IOCTL_NUM, 10, void *)
49
Jack Steiner9cc9b052009-06-17 16:28:19 -070050/* For dumpping GRU chiplet state */
51#define GRU_DUMP_CHIPLET_STATE _IOWR(GRU_IOCTL_NUM, 11, void *)
52
Jack Steiner13d19492008-07-29 22:33:55 -070053/* For user TLB flushing (primarily for tests) */
54#define GRU_USER_FLUSH_TLB _IOWR(GRU_IOCTL_NUM, 50, void *)
55
56/* Get some config options (primarily for tests & emulator) */
57#define GRU_GET_CONFIG_INFO _IOWR(GRU_IOCTL_NUM, 51, void *)
58
59#define CONTEXT_WINDOW_BYTES(th) (GRU_GSEG_PAGESIZE * (th))
60#define THREAD_POINTER(p, th) (p + GRU_GSEG_PAGESIZE * (th))
61
62/*
63 * Structure used to pass TLB flush parameters to the driver
64 */
65struct gru_create_context_req {
66 unsigned long gseg;
67 unsigned int data_segment_bytes;
68 unsigned int control_blocks;
69 unsigned int maximum_thread_count;
70 unsigned int options;
71};
72
73/*
74 * Structure used to pass unload context parameters to the driver
75 */
76struct gru_unload_context_req {
77 unsigned long gseg;
78};
79
80/*
81 * Structure used to pass TLB flush parameters to the driver
82 */
83struct gru_flush_tlb_req {
84 unsigned long gseg;
85 unsigned long vaddr;
86 size_t len;
87};
88
89/*
Jack Steiner9cc9b052009-06-17 16:28:19 -070090 * Structure used to pass TLB flush parameters to the driver
91 */
92enum {dcs_pid, dcs_gid};
93struct gru_dump_chiplet_state_req {
94 unsigned int op;
95 int gid;
96 int ctxnum;
97 char data_opt;
98 char lock_cch;
99 pid_t pid;
100 void *buf;
101 size_t buflen;
102 /* ---- output --- */
103 unsigned int num_contexts;
104};
105
106#define GRU_DUMP_MAGIC 0x3474ab6c
107struct gru_dump_context_header {
108 unsigned int magic;
109 unsigned char gid;
110 unsigned char ctxnum;
111 unsigned char cbrcnt;
112 unsigned char dsrcnt;
113 pid_t pid;
114 unsigned long vaddr;
115 int cch_locked;
116 unsigned long data[0];
117};
118
119/*
Jack Steiner13d19492008-07-29 22:33:55 -0700120 * GRU configuration info (temp - for testing)
121 */
122struct gru_config_info {
123 int cpus;
124 int blades;
125 int nodes;
126 int chiplets;
127 int fill[16];
128};
129
130#endif /* __GRULIB_H__ */