217 lines · c
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 or6 * redistributing this file, you may do so under either license.7 *8 * GPL LICENSE SUMMARY9 *10 * Copyright(c) 2014 Intel Corporation.11 *12 * This program is free software; you can redistribute it and/or modify13 * it under the terms of version 2 of the GNU General Public License as14 * published by the Free Software Foundation.15 *16 * This program is distributed in the hope that it will be useful, but17 * WITHOUT ANY WARRANTY; without even the implied warranty of18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU19 * General Public License for more details.20 *21 * BSD LICENSE22 *23 * Copyright(c) 2014 Intel Corporation.24 *25 * Redistribution and use in source and binary forms, with or without26 * modification, are permitted provided that the following conditions27 * are met:28 *29 * * Redistributions of source code must retain the above copyright30 * notice, this list of conditions and the following disclaimer.31 * * Redistributions in binary form must reproduce the above copyright32 * notice, this list of conditions and the following disclaimer in33 * the documentation and/or other materials provided with the34 * distribution.35 * * Neither the name of Intel Corporation nor the names of its36 * contributors may be used to endorse or promote products derived37 * from this software without specific prior written permission.38 *39 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS40 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT41 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR42 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT43 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT45 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,46 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY47 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT48 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE49 * 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 information57 * -----------------------------------------58 */59#ifndef SCIF_IOCTL_H60#define SCIF_IOCTL_H61 62#include <linux/types.h>63 64/**65 * struct scif_port_id - SCIF port information66 * @node: node on which port resides67 * @port: local port number68 */69struct scif_port_id {70 __u16 node;71 __u16 port;72};73 74/**75 * struct scifioctl_connect - used for SCIF_CONNECT IOCTL76 * @self: used to read back the assigned port_id77 * @peer: destination node and port to connect to78 */79struct 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 IOCTL86 * @flags: flags87 * @peer: global id of peer endpoint88 * @endpt: new connected endpoint descriptor89 */90struct 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 IOCTL98 * @msg: message buffer address99 * @len: message length100 * @flags: flags101 * @out_len: number of bytes sent/received102 */103struct 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 IOCTL112 * @addr: starting virtual address113 * @len: length of range114 * @offset: offset of window115 * @prot: read/write protection116 * @flags: flags117 * @out_offset: offset returned118 */119struct 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 IOCTL130 * @offset: start of range to unregister131 * @len: length of range to unregister132 */133struct scifioctl_unreg {134 __s64 offset;135 __u64 len;136};137 138/**139 * struct scifioctl_copy - used for SCIF DMA copy IOCTLs140 *141 * @loffset: offset in local registered address space to/from142 * which to copy143 * @len: length of range to copy144 * @roffset: offset in remote registered address space to/from145 * which to copy146 * @addr: user virtual address to/from which to copy147 * @flags: flags148 *149 * This structure is used for SCIF_READFROM, SCIF_WRITETO, SCIF_VREADFROM150 * and SCIF_VREADFROM IOCTL's.151 */152struct 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 IOCTL162 * @flags: flags163 * @mark: fence handle which is a pointer to a __s32164 */165struct scifioctl_fence_mark {166 __s32 flags;167 __u64 mark;168};169 170/**171 * struct scifioctl_fence_signal - used for SCIF_FENCE_SIGNAL IOCTL172 * @loff: local offset173 * @lval: value to write to loffset174 * @roff: remote offset175 * @rval: value to write to roffset176 * @flags: flags177 */178struct 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 IOCTL188 * @nodes: pointer to an array of node_ids189 * @self: ID of the current node190 * @len: length of array191 */192struct 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 */217