]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/blob - include/uapi/linux/scif_ioctl.h
License cleanup: add SPDX license identifier to uapi header files with a license
[mirror_ubuntu-eoan-kernel.git] / include / uapi / linux / scif_ioctl.h
1 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
2 /*
3 * Intel MIC Platform Software Stack (MPSS)
4 *
5 * This file is provided under a dual BSD/GPLv2 license. When using or
6 * redistributing this file, you may do so under either license.
7 *
8 * GPL LICENSE SUMMARY
9 *
10 * Copyright(c) 2014 Intel Corporation.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of version 2 of the GNU General Public License as
14 * published by the Free Software Foundation.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * BSD LICENSE
22 *
23 * Copyright(c) 2014 Intel Corporation.
24 *
25 * Redistribution and use in source and binary forms, with or without
26 * modification, are permitted provided that the following conditions
27 * are met:
28 *
29 * * Redistributions of source code must retain the above copyright
30 * notice, this list of conditions and the following disclaimer.
31 * * Redistributions in binary form must reproduce the above copyright
32 * notice, this list of conditions and the following disclaimer in
33 * the documentation and/or other materials provided with the
34 * distribution.
35 * * Neither the name of Intel Corporation nor the names of its
36 * contributors may be used to endorse or promote products derived
37 * from this software without specific prior written permission.
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
40 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
41 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
42 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
43 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
45 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
46 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
47 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
48 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
49 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
50 *
51 * Intel SCIF driver.
52 *
53 */
54 /*
55 * -----------------------------------------
56 * SCIF IOCTL interface information
57 * -----------------------------------------
58 */
59 #ifndef SCIF_IOCTL_H
60 #define SCIF_IOCTL_H
61
62 #include <linux/types.h>
63
64 /**
65 * struct scif_port_id - SCIF port information
66 * @node: node on which port resides
67 * @port: local port number
68 */
69 struct scif_port_id {
70 __u16 node;
71 __u16 port;
72 };
73
74 /**
75 * struct scifioctl_connect - used for SCIF_CONNECT IOCTL
76 * @self: used to read back the assigned port_id
77 * @peer: destination node and port to connect to
78 */
79 struct scifioctl_connect {
80 struct scif_port_id self;
81 struct scif_port_id peer;
82 };
83
84 /**
85 * struct scifioctl_accept - used for SCIF_ACCEPTREQ IOCTL
86 * @flags: flags
87 * @peer: global id of peer endpoint
88 * @endpt: new connected endpoint descriptor
89 */
90 struct scifioctl_accept {
91 __s32 flags;
92 struct scif_port_id peer;
93 __u64 endpt;
94 };
95
96 /**
97 * struct scifioctl_msg - used for SCIF_SEND/SCIF_RECV IOCTL
98 * @msg: message buffer address
99 * @len: message length
100 * @flags: flags
101 * @out_len: number of bytes sent/received
102 */
103 struct scifioctl_msg {
104 __u64 msg;
105 __s32 len;
106 __s32 flags;
107 __s32 out_len;
108 };
109
110 /**
111 * struct scifioctl_reg - used for SCIF_REG IOCTL
112 * @addr: starting virtual address
113 * @len: length of range
114 * @offset: offset of window
115 * @prot: read/write protection
116 * @flags: flags
117 * @out_offset: offset returned
118 */
119 struct scifioctl_reg {
120 __u64 addr;
121 __u64 len;
122 __s64 offset;
123 __s32 prot;
124 __s32 flags;
125 __s64 out_offset;
126 };
127
128 /**
129 * struct scifioctl_unreg - used for SCIF_UNREG IOCTL
130 * @offset: start of range to unregister
131 * @len: length of range to unregister
132 */
133 struct scifioctl_unreg {
134 __s64 offset;
135 __u64 len;
136 };
137
138 /**
139 * struct scifioctl_copy - used for SCIF DMA copy IOCTLs
140 *
141 * @loffset: offset in local registered address space to/from
142 * which to copy
143 * @len: length of range to copy
144 * @roffset: offset in remote registered address space to/from
145 * which to copy
146 * @addr: user virtual address to/from which to copy
147 * @flags: flags
148 *
149 * This structure is used for SCIF_READFROM, SCIF_WRITETO, SCIF_VREADFROM
150 * and SCIF_VREADFROM IOCTL's.
151 */
152 struct scifioctl_copy {
153 __s64 loffset;
154 __u64 len;
155 __s64 roffset;
156 __u64 addr;
157 __s32 flags;
158 };
159
160 /**
161 * struct scifioctl_fence_mark - used for SCIF_FENCE_MARK IOCTL
162 * @flags: flags
163 * @mark: fence handle which is a pointer to a __s32
164 */
165 struct scifioctl_fence_mark {
166 __s32 flags;
167 __u64 mark;
168 };
169
170 /**
171 * struct scifioctl_fence_signal - used for SCIF_FENCE_SIGNAL IOCTL
172 * @loff: local offset
173 * @lval: value to write to loffset
174 * @roff: remote offset
175 * @rval: value to write to roffset
176 * @flags: flags
177 */
178 struct scifioctl_fence_signal {
179 __s64 loff;
180 __u64 lval;
181 __s64 roff;
182 __u64 rval;
183 __s32 flags;
184 };
185
186 /**
187 * struct scifioctl_node_ids - used for SCIF_GET_NODEIDS IOCTL
188 * @nodes: pointer to an array of node_ids
189 * @self: ID of the current node
190 * @len: length of array
191 */
192 struct scifioctl_node_ids {
193 __u64 nodes;
194 __u64 self;
195 __s32 len;
196 };
197
198 #define SCIF_BIND _IOWR('s', 1, __u64)
199 #define SCIF_LISTEN _IOW('s', 2, __s32)
200 #define SCIF_CONNECT _IOWR('s', 3, struct scifioctl_connect)
201 #define SCIF_ACCEPTREQ _IOWR('s', 4, struct scifioctl_accept)
202 #define SCIF_ACCEPTREG _IOWR('s', 5, __u64)
203 #define SCIF_SEND _IOWR('s', 6, struct scifioctl_msg)
204 #define SCIF_RECV _IOWR('s', 7, struct scifioctl_msg)
205 #define SCIF_REG _IOWR('s', 8, struct scifioctl_reg)
206 #define SCIF_UNREG _IOWR('s', 9, struct scifioctl_unreg)
207 #define SCIF_READFROM _IOWR('s', 10, struct scifioctl_copy)
208 #define SCIF_WRITETO _IOWR('s', 11, struct scifioctl_copy)
209 #define SCIF_VREADFROM _IOWR('s', 12, struct scifioctl_copy)
210 #define SCIF_VWRITETO _IOWR('s', 13, struct scifioctl_copy)
211 #define SCIF_GET_NODEIDS _IOWR('s', 14, struct scifioctl_node_ids)
212 #define SCIF_FENCE_MARK _IOWR('s', 15, struct scifioctl_fence_mark)
213 #define SCIF_FENCE_WAIT _IOWR('s', 16, __s32)
214 #define SCIF_FENCE_SIGNAL _IOWR('s', 17, struct scifioctl_fence_signal)
215
216 #endif /* SCIF_IOCTL_H */