1e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ 27df20f2dSSudeep Dutt /* 37df20f2dSSudeep Dutt * Intel MIC Platform Software Stack (MPSS) 47df20f2dSSudeep Dutt * 57df20f2dSSudeep Dutt * This file is provided under a dual BSD/GPLv2 license. When using or 67df20f2dSSudeep Dutt * redistributing this file, you may do so under either license. 77df20f2dSSudeep Dutt * 87df20f2dSSudeep Dutt * GPL LICENSE SUMMARY 97df20f2dSSudeep Dutt * 107df20f2dSSudeep Dutt * Copyright(c) 2014 Intel Corporation. 117df20f2dSSudeep Dutt * 127df20f2dSSudeep Dutt * This program is free software; you can redistribute it and/or modify 137df20f2dSSudeep Dutt * it under the terms of version 2 of the GNU General Public License as 147df20f2dSSudeep Dutt * published by the Free Software Foundation. 157df20f2dSSudeep Dutt * 167df20f2dSSudeep Dutt * This program is distributed in the hope that it will be useful, but 177df20f2dSSudeep Dutt * WITHOUT ANY WARRANTY; without even the implied warranty of 187df20f2dSSudeep Dutt * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 197df20f2dSSudeep Dutt * General Public License for more details. 207df20f2dSSudeep Dutt * 217df20f2dSSudeep Dutt * BSD LICENSE 227df20f2dSSudeep Dutt * 237df20f2dSSudeep Dutt * Copyright(c) 2014 Intel Corporation. 247df20f2dSSudeep Dutt * 257df20f2dSSudeep Dutt * Redistribution and use in source and binary forms, with or without 267df20f2dSSudeep Dutt * modification, are permitted provided that the following conditions 277df20f2dSSudeep Dutt * are met: 287df20f2dSSudeep Dutt * 297df20f2dSSudeep Dutt * * Redistributions of source code must retain the above copyright 307df20f2dSSudeep Dutt * notice, this list of conditions and the following disclaimer. 317df20f2dSSudeep Dutt * * Redistributions in binary form must reproduce the above copyright 327df20f2dSSudeep Dutt * notice, this list of conditions and the following disclaimer in 337df20f2dSSudeep Dutt * the documentation and/or other materials provided with the 347df20f2dSSudeep Dutt * distribution. 357df20f2dSSudeep Dutt * * Neither the name of Intel Corporation nor the names of its 367df20f2dSSudeep Dutt * contributors may be used to endorse or promote products derived 377df20f2dSSudeep Dutt * from this software without specific prior written permission. 387df20f2dSSudeep Dutt * 397df20f2dSSudeep Dutt * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 407df20f2dSSudeep Dutt * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 417df20f2dSSudeep Dutt * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 427df20f2dSSudeep Dutt * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 437df20f2dSSudeep Dutt * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 447df20f2dSSudeep Dutt * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 457df20f2dSSudeep Dutt * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 467df20f2dSSudeep Dutt * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 477df20f2dSSudeep Dutt * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 487df20f2dSSudeep Dutt * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 497df20f2dSSudeep Dutt * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 507df20f2dSSudeep Dutt * 517df20f2dSSudeep Dutt * Intel SCIF driver. 527df20f2dSSudeep Dutt * 537df20f2dSSudeep Dutt */ 547df20f2dSSudeep Dutt /* 557df20f2dSSudeep Dutt * ----------------------------------------- 567df20f2dSSudeep Dutt * SCIF IOCTL interface information 577df20f2dSSudeep Dutt * ----------------------------------------- 587df20f2dSSudeep Dutt */ 597df20f2dSSudeep Dutt #ifndef SCIF_IOCTL_H 607df20f2dSSudeep Dutt #define SCIF_IOCTL_H 617df20f2dSSudeep Dutt 627df20f2dSSudeep Dutt #include <linux/types.h> 637df20f2dSSudeep Dutt 647df20f2dSSudeep Dutt /** 657df20f2dSSudeep Dutt * struct scif_port_id - SCIF port information 667df20f2dSSudeep Dutt * @node: node on which port resides 677df20f2dSSudeep Dutt * @port: local port number 687df20f2dSSudeep Dutt */ 697df20f2dSSudeep Dutt struct scif_port_id { 707df20f2dSSudeep Dutt __u16 node; 717df20f2dSSudeep Dutt __u16 port; 727df20f2dSSudeep Dutt }; 737df20f2dSSudeep Dutt 747df20f2dSSudeep Dutt /** 757df20f2dSSudeep Dutt * struct scifioctl_connect - used for SCIF_CONNECT IOCTL 767df20f2dSSudeep Dutt * @self: used to read back the assigned port_id 777df20f2dSSudeep Dutt * @peer: destination node and port to connect to 787df20f2dSSudeep Dutt */ 797df20f2dSSudeep Dutt struct scifioctl_connect { 807df20f2dSSudeep Dutt struct scif_port_id self; 817df20f2dSSudeep Dutt struct scif_port_id peer; 827df20f2dSSudeep Dutt }; 837df20f2dSSudeep Dutt 847df20f2dSSudeep Dutt /** 857df20f2dSSudeep Dutt * struct scifioctl_accept - used for SCIF_ACCEPTREQ IOCTL 867df20f2dSSudeep Dutt * @flags: flags 877df20f2dSSudeep Dutt * @peer: global id of peer endpoint 887df20f2dSSudeep Dutt * @endpt: new connected endpoint descriptor 897df20f2dSSudeep Dutt */ 907df20f2dSSudeep Dutt struct scifioctl_accept { 917df20f2dSSudeep Dutt __s32 flags; 927df20f2dSSudeep Dutt struct scif_port_id peer; 937df20f2dSSudeep Dutt __u64 endpt; 947df20f2dSSudeep Dutt }; 957df20f2dSSudeep Dutt 967df20f2dSSudeep Dutt /** 977df20f2dSSudeep Dutt * struct scifioctl_msg - used for SCIF_SEND/SCIF_RECV IOCTL 987df20f2dSSudeep Dutt * @msg: message buffer address 997df20f2dSSudeep Dutt * @len: message length 1007df20f2dSSudeep Dutt * @flags: flags 1017df20f2dSSudeep Dutt * @out_len: number of bytes sent/received 1027df20f2dSSudeep Dutt */ 1037df20f2dSSudeep Dutt struct scifioctl_msg { 1047df20f2dSSudeep Dutt __u64 msg; 1057df20f2dSSudeep Dutt __s32 len; 1067df20f2dSSudeep Dutt __s32 flags; 1077df20f2dSSudeep Dutt __s32 out_len; 1087df20f2dSSudeep Dutt }; 1097df20f2dSSudeep Dutt 1107df20f2dSSudeep Dutt /** 111a44f2630SSudeep Dutt * struct scifioctl_reg - used for SCIF_REG IOCTL 112a44f2630SSudeep Dutt * @addr: starting virtual address 113a44f2630SSudeep Dutt * @len: length of range 114a44f2630SSudeep Dutt * @offset: offset of window 115a44f2630SSudeep Dutt * @prot: read/write protection 116a44f2630SSudeep Dutt * @flags: flags 117a44f2630SSudeep Dutt * @out_offset: offset returned 118a44f2630SSudeep Dutt */ 119a44f2630SSudeep Dutt struct scifioctl_reg { 120a44f2630SSudeep Dutt __u64 addr; 121a44f2630SSudeep Dutt __u64 len; 122a44f2630SSudeep Dutt __s64 offset; 123a44f2630SSudeep Dutt __s32 prot; 124a44f2630SSudeep Dutt __s32 flags; 125a44f2630SSudeep Dutt __s64 out_offset; 126a44f2630SSudeep Dutt }; 127a44f2630SSudeep Dutt 128a44f2630SSudeep Dutt /** 129a44f2630SSudeep Dutt * struct scifioctl_unreg - used for SCIF_UNREG IOCTL 130a44f2630SSudeep Dutt * @offset: start of range to unregister 131a44f2630SSudeep Dutt * @len: length of range to unregister 132a44f2630SSudeep Dutt */ 133a44f2630SSudeep Dutt struct scifioctl_unreg { 134a44f2630SSudeep Dutt __s64 offset; 135a44f2630SSudeep Dutt __u64 len; 136a44f2630SSudeep Dutt }; 137a44f2630SSudeep Dutt 138a44f2630SSudeep Dutt /** 139a44f2630SSudeep Dutt * struct scifioctl_copy - used for SCIF DMA copy IOCTLs 140a44f2630SSudeep Dutt * 141a44f2630SSudeep Dutt * @loffset: offset in local registered address space to/from 142a44f2630SSudeep Dutt * which to copy 143a44f2630SSudeep Dutt * @len: length of range to copy 144a44f2630SSudeep Dutt * @roffset: offset in remote registered address space to/from 145a44f2630SSudeep Dutt * which to copy 146a44f2630SSudeep Dutt * @addr: user virtual address to/from which to copy 147a44f2630SSudeep Dutt * @flags: flags 148a44f2630SSudeep Dutt * 149a44f2630SSudeep Dutt * This structure is used for SCIF_READFROM, SCIF_WRITETO, SCIF_VREADFROM 150a44f2630SSudeep Dutt * and SCIF_VREADFROM IOCTL's. 151a44f2630SSudeep Dutt */ 152a44f2630SSudeep Dutt struct scifioctl_copy { 153a44f2630SSudeep Dutt __s64 loffset; 154a44f2630SSudeep Dutt __u64 len; 155a44f2630SSudeep Dutt __s64 roffset; 156a44f2630SSudeep Dutt __u64 addr; 157a44f2630SSudeep Dutt __s32 flags; 158a44f2630SSudeep Dutt }; 159a44f2630SSudeep Dutt 160a44f2630SSudeep Dutt /** 161a44f2630SSudeep Dutt * struct scifioctl_fence_mark - used for SCIF_FENCE_MARK IOCTL 162a44f2630SSudeep Dutt * @flags: flags 163a44f2630SSudeep Dutt * @mark: fence handle which is a pointer to a __s32 164a44f2630SSudeep Dutt */ 165a44f2630SSudeep Dutt struct scifioctl_fence_mark { 166a44f2630SSudeep Dutt __s32 flags; 167a44f2630SSudeep Dutt __u64 mark; 168a44f2630SSudeep Dutt }; 169a44f2630SSudeep Dutt 170a44f2630SSudeep Dutt /** 171a44f2630SSudeep Dutt * struct scifioctl_fence_signal - used for SCIF_FENCE_SIGNAL IOCTL 172a44f2630SSudeep Dutt * @loff: local offset 173a44f2630SSudeep Dutt * @lval: value to write to loffset 174a44f2630SSudeep Dutt * @roff: remote offset 175a44f2630SSudeep Dutt * @rval: value to write to roffset 176a44f2630SSudeep Dutt * @flags: flags 177a44f2630SSudeep Dutt */ 178a44f2630SSudeep Dutt struct scifioctl_fence_signal { 179a44f2630SSudeep Dutt __s64 loff; 180a44f2630SSudeep Dutt __u64 lval; 181a44f2630SSudeep Dutt __s64 roff; 182a44f2630SSudeep Dutt __u64 rval; 183a44f2630SSudeep Dutt __s32 flags; 184a44f2630SSudeep Dutt }; 185a44f2630SSudeep Dutt 186a44f2630SSudeep Dutt /** 1877df20f2dSSudeep Dutt * struct scifioctl_node_ids - used for SCIF_GET_NODEIDS IOCTL 1887df20f2dSSudeep Dutt * @nodes: pointer to an array of node_ids 1897df20f2dSSudeep Dutt * @self: ID of the current node 1907df20f2dSSudeep Dutt * @len: length of array 1917df20f2dSSudeep Dutt */ 1927df20f2dSSudeep Dutt struct scifioctl_node_ids { 1937df20f2dSSudeep Dutt __u64 nodes; 1947df20f2dSSudeep Dutt __u64 self; 1957df20f2dSSudeep Dutt __s32 len; 1967df20f2dSSudeep Dutt }; 1977df20f2dSSudeep Dutt 1987df20f2dSSudeep Dutt #define SCIF_BIND _IOWR('s', 1, __u64) 1997df20f2dSSudeep Dutt #define SCIF_LISTEN _IOW('s', 2, __s32) 2007df20f2dSSudeep Dutt #define SCIF_CONNECT _IOWR('s', 3, struct scifioctl_connect) 2017df20f2dSSudeep Dutt #define SCIF_ACCEPTREQ _IOWR('s', 4, struct scifioctl_accept) 2027df20f2dSSudeep Dutt #define SCIF_ACCEPTREG _IOWR('s', 5, __u64) 2037df20f2dSSudeep Dutt #define SCIF_SEND _IOWR('s', 6, struct scifioctl_msg) 2047df20f2dSSudeep Dutt #define SCIF_RECV _IOWR('s', 7, struct scifioctl_msg) 205a44f2630SSudeep Dutt #define SCIF_REG _IOWR('s', 8, struct scifioctl_reg) 206a44f2630SSudeep Dutt #define SCIF_UNREG _IOWR('s', 9, struct scifioctl_unreg) 207a44f2630SSudeep Dutt #define SCIF_READFROM _IOWR('s', 10, struct scifioctl_copy) 208a44f2630SSudeep Dutt #define SCIF_WRITETO _IOWR('s', 11, struct scifioctl_copy) 209a44f2630SSudeep Dutt #define SCIF_VREADFROM _IOWR('s', 12, struct scifioctl_copy) 210a44f2630SSudeep Dutt #define SCIF_VWRITETO _IOWR('s', 13, struct scifioctl_copy) 2117df20f2dSSudeep Dutt #define SCIF_GET_NODEIDS _IOWR('s', 14, struct scifioctl_node_ids) 212a44f2630SSudeep Dutt #define SCIF_FENCE_MARK _IOWR('s', 15, struct scifioctl_fence_mark) 213a44f2630SSudeep Dutt #define SCIF_FENCE_WAIT _IOWR('s', 16, __s32) 214a44f2630SSudeep Dutt #define SCIF_FENCE_SIGNAL _IOWR('s', 17, struct scifioctl_fence_signal) 2157df20f2dSSudeep Dutt 2167df20f2dSSudeep Dutt #endif /* SCIF_IOCTL_H */ 217