scif_ioctl.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  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. #include <linux/types.h>
  62. /**
  63. * struct scif_port_id - SCIF port information
  64. * @node: node on which port resides
  65. * @port: local port number
  66. */
  67. struct scif_port_id {
  68. __u16 node;
  69. __u16 port;
  70. };
  71. /**
  72. * struct scifioctl_connect - used for SCIF_CONNECT IOCTL
  73. * @self: used to read back the assigned port_id
  74. * @peer: destination node and port to connect to
  75. */
  76. struct scifioctl_connect {
  77. struct scif_port_id self;
  78. struct scif_port_id peer;
  79. };
  80. /**
  81. * struct scifioctl_accept - used for SCIF_ACCEPTREQ IOCTL
  82. * @flags: flags
  83. * @peer: global id of peer endpoint
  84. * @endpt: new connected endpoint descriptor
  85. */
  86. struct scifioctl_accept {
  87. __s32 flags;
  88. struct scif_port_id peer;
  89. __u64 endpt;
  90. };
  91. /**
  92. * struct scifioctl_msg - used for SCIF_SEND/SCIF_RECV IOCTL
  93. * @msg: message buffer address
  94. * @len: message length
  95. * @flags: flags
  96. * @out_len: number of bytes sent/received
  97. */
  98. struct scifioctl_msg {
  99. __u64 msg;
  100. __s32 len;
  101. __s32 flags;
  102. __s32 out_len;
  103. };
  104. /**
  105. * struct scifioctl_reg - used for SCIF_REG IOCTL
  106. * @addr: starting virtual address
  107. * @len: length of range
  108. * @offset: offset of window
  109. * @prot: read/write protection
  110. * @flags: flags
  111. * @out_offset: offset returned
  112. */
  113. struct scifioctl_reg {
  114. __u64 addr;
  115. __u64 len;
  116. __s64 offset;
  117. __s32 prot;
  118. __s32 flags;
  119. __s64 out_offset;
  120. };
  121. /**
  122. * struct scifioctl_unreg - used for SCIF_UNREG IOCTL
  123. * @offset: start of range to unregister
  124. * @len: length of range to unregister
  125. */
  126. struct scifioctl_unreg {
  127. __s64 offset;
  128. __u64 len;
  129. };
  130. /**
  131. * struct scifioctl_copy - used for SCIF DMA copy IOCTLs
  132. *
  133. * @loffset: offset in local registered address space to/from
  134. * which to copy
  135. * @len: length of range to copy
  136. * @roffset: offset in remote registered address space to/from
  137. * which to copy
  138. * @addr: user virtual address to/from which to copy
  139. * @flags: flags
  140. *
  141. * This structure is used for SCIF_READFROM, SCIF_WRITETO, SCIF_VREADFROM
  142. * and SCIF_VREADFROM IOCTL's.
  143. */
  144. struct scifioctl_copy {
  145. __s64 loffset;
  146. __u64 len;
  147. __s64 roffset;
  148. __u64 addr;
  149. __s32 flags;
  150. };
  151. /**
  152. * struct scifioctl_fence_mark - used for SCIF_FENCE_MARK IOCTL
  153. * @flags: flags
  154. * @mark: fence handle which is a pointer to a __s32
  155. */
  156. struct scifioctl_fence_mark {
  157. __s32 flags;
  158. __u64 mark;
  159. };
  160. /**
  161. * struct scifioctl_fence_signal - used for SCIF_FENCE_SIGNAL IOCTL
  162. * @loff: local offset
  163. * @lval: value to write to loffset
  164. * @roff: remote offset
  165. * @rval: value to write to roffset
  166. * @flags: flags
  167. */
  168. struct scifioctl_fence_signal {
  169. __s64 loff;
  170. __u64 lval;
  171. __s64 roff;
  172. __u64 rval;
  173. __s32 flags;
  174. };
  175. /**
  176. * struct scifioctl_node_ids - used for SCIF_GET_NODEIDS IOCTL
  177. * @nodes: pointer to an array of node_ids
  178. * @self: ID of the current node
  179. * @len: length of array
  180. */
  181. struct scifioctl_node_ids {
  182. __u64 nodes;
  183. __u64 self;
  184. __s32 len;
  185. };
  186. #define SCIF_BIND _IOWR('s', 1, __u64)
  187. #define SCIF_LISTEN _IOW('s', 2, __s32)
  188. #define SCIF_CONNECT _IOWR('s', 3, struct scifioctl_connect)
  189. #define SCIF_ACCEPTREQ _IOWR('s', 4, struct scifioctl_accept)
  190. #define SCIF_ACCEPTREG _IOWR('s', 5, __u64)
  191. #define SCIF_SEND _IOWR('s', 6, struct scifioctl_msg)
  192. #define SCIF_RECV _IOWR('s', 7, struct scifioctl_msg)
  193. #define SCIF_REG _IOWR('s', 8, struct scifioctl_reg)
  194. #define SCIF_UNREG _IOWR('s', 9, struct scifioctl_unreg)
  195. #define SCIF_READFROM _IOWR('s', 10, struct scifioctl_copy)
  196. #define SCIF_WRITETO _IOWR('s', 11, struct scifioctl_copy)
  197. #define SCIF_VREADFROM _IOWR('s', 12, struct scifioctl_copy)
  198. #define SCIF_VWRITETO _IOWR('s', 13, struct scifioctl_copy)
  199. #define SCIF_GET_NODEIDS _IOWR('s', 14, struct scifioctl_node_ids)
  200. #define SCIF_FENCE_MARK _IOWR('s', 15, struct scifioctl_fence_mark)
  201. #define SCIF_FENCE_WAIT _IOWR('s', 16, __s32)
  202. #define SCIF_FENCE_SIGNAL _IOWR('s', 17, struct scifioctl_fence_signal)
  203. #endif /* SCIF_IOCTL_H */