xref: /linux/include/uapi/rdma/hfi/hfi1_ioctl.h (revision e2be04c7f9958dde770eeb8b30e829ca969b37bb)
1*e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
238e8b671SLeon Romanovsky /*
338e8b671SLeon Romanovsky  *
438e8b671SLeon Romanovsky  * This file is provided under a dual BSD/GPLv2 license.  When using or
538e8b671SLeon Romanovsky  * redistributing this file, you may do so under either license.
638e8b671SLeon Romanovsky  *
738e8b671SLeon Romanovsky  * GPL LICENSE SUMMARY
838e8b671SLeon Romanovsky  *
938e8b671SLeon Romanovsky  * Copyright(c) 2015 Intel Corporation.
1038e8b671SLeon Romanovsky  *
1138e8b671SLeon Romanovsky  * This program is free software; you can redistribute it and/or modify
1238e8b671SLeon Romanovsky  * it under the terms of version 2 of the GNU General Public License as
1338e8b671SLeon Romanovsky  * published by the Free Software Foundation.
1438e8b671SLeon Romanovsky  *
1538e8b671SLeon Romanovsky  * This program is distributed in the hope that it will be useful, but
1638e8b671SLeon Romanovsky  * WITHOUT ANY WARRANTY; without even the implied warranty of
1738e8b671SLeon Romanovsky  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1838e8b671SLeon Romanovsky  * General Public License for more details.
1938e8b671SLeon Romanovsky  *
2038e8b671SLeon Romanovsky  * BSD LICENSE
2138e8b671SLeon Romanovsky  *
2238e8b671SLeon Romanovsky  * Copyright(c) 2015 Intel Corporation.
2338e8b671SLeon Romanovsky  *
2438e8b671SLeon Romanovsky  * Redistribution and use in source and binary forms, with or without
2538e8b671SLeon Romanovsky  * modification, are permitted provided that the following conditions
2638e8b671SLeon Romanovsky  * are met:
2738e8b671SLeon Romanovsky  *
2838e8b671SLeon Romanovsky  *  - Redistributions of source code must retain the above copyright
2938e8b671SLeon Romanovsky  *    notice, this list of conditions and the following disclaimer.
3038e8b671SLeon Romanovsky  *  - Redistributions in binary form must reproduce the above copyright
3138e8b671SLeon Romanovsky  *    notice, this list of conditions and the following disclaimer in
3238e8b671SLeon Romanovsky  *    the documentation and/or other materials provided with the
3338e8b671SLeon Romanovsky  *    distribution.
3438e8b671SLeon Romanovsky  *  - Neither the name of Intel Corporation nor the names of its
3538e8b671SLeon Romanovsky  *    contributors may be used to endorse or promote products derived
3638e8b671SLeon Romanovsky  *    from this software without specific prior written permission.
3738e8b671SLeon Romanovsky  *
3838e8b671SLeon Romanovsky  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3938e8b671SLeon Romanovsky  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
4038e8b671SLeon Romanovsky  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
4138e8b671SLeon Romanovsky  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
4238e8b671SLeon Romanovsky  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
4338e8b671SLeon Romanovsky  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
4438e8b671SLeon Romanovsky  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
4538e8b671SLeon Romanovsky  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
4638e8b671SLeon Romanovsky  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
4738e8b671SLeon Romanovsky  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
4838e8b671SLeon Romanovsky  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4938e8b671SLeon Romanovsky  *
5038e8b671SLeon Romanovsky  */
5138e8b671SLeon Romanovsky 
5238e8b671SLeon Romanovsky #ifndef _LINUX__HFI1_IOCTL_H
5338e8b671SLeon Romanovsky #define _LINUX__HFI1_IOCTL_H
5438e8b671SLeon Romanovsky #include <linux/types.h>
5538e8b671SLeon Romanovsky 
5638e8b671SLeon Romanovsky /*
5738e8b671SLeon Romanovsky  * This structure is passed to the driver to tell it where
5838e8b671SLeon Romanovsky  * user code buffers are, sizes, etc.   The offsets and sizes of the
5938e8b671SLeon Romanovsky  * fields must remain unchanged, for binary compatibility.  It can
6038e8b671SLeon Romanovsky  * be extended, if userversion is changed so user code can tell, if needed
6138e8b671SLeon Romanovsky  */
6238e8b671SLeon Romanovsky struct hfi1_user_info {
6338e8b671SLeon Romanovsky 	/*
6438e8b671SLeon Romanovsky 	 * version of user software, to detect compatibility issues.
6538e8b671SLeon Romanovsky 	 * Should be set to HFI1_USER_SWVERSION.
6638e8b671SLeon Romanovsky 	 */
6738e8b671SLeon Romanovsky 	__u32 userversion;
6838e8b671SLeon Romanovsky 	__u32 pad;
6938e8b671SLeon Romanovsky 	/*
7038e8b671SLeon Romanovsky 	 * If two or more processes wish to share a context, each process
7138e8b671SLeon Romanovsky 	 * must set the subcontext_cnt and subcontext_id to the same
7238e8b671SLeon Romanovsky 	 * values.  The only restriction on the subcontext_id is that
7338e8b671SLeon Romanovsky 	 * it be unique for a given node.
7438e8b671SLeon Romanovsky 	 */
7538e8b671SLeon Romanovsky 	__u16 subctxt_cnt;
7638e8b671SLeon Romanovsky 	__u16 subctxt_id;
7738e8b671SLeon Romanovsky 	/* 128bit UUID passed in by PSM. */
7838e8b671SLeon Romanovsky 	__u8 uuid[16];
7938e8b671SLeon Romanovsky };
8038e8b671SLeon Romanovsky 
8138e8b671SLeon Romanovsky struct hfi1_ctxt_info {
8238e8b671SLeon Romanovsky 	__u64 runtime_flags;    /* chip/drv runtime flags (HFI1_CAP_*) */
8338e8b671SLeon Romanovsky 	__u32 rcvegr_size;      /* size of each eager buffer */
8438e8b671SLeon Romanovsky 	__u16 num_active;       /* number of active units */
8538e8b671SLeon Romanovsky 	__u16 unit;             /* unit (chip) assigned to caller */
8638e8b671SLeon Romanovsky 	__u16 ctxt;             /* ctxt on unit assigned to caller */
8738e8b671SLeon Romanovsky 	__u16 subctxt;          /* subctxt on unit assigned to caller */
8838e8b671SLeon Romanovsky 	__u16 rcvtids;          /* number of Rcv TIDs for this context */
8938e8b671SLeon Romanovsky 	__u16 credits;          /* number of PIO credits for this context */
9038e8b671SLeon Romanovsky 	__u16 numa_node;        /* NUMA node of the assigned device */
9138e8b671SLeon Romanovsky 	__u16 rec_cpu;          /* cpu # for affinity (0xffff if none) */
9238e8b671SLeon Romanovsky 	__u16 send_ctxt;        /* send context in use by this user context */
9338e8b671SLeon Romanovsky 	__u16 egrtids;          /* number of RcvArray entries for Eager Rcvs */
9438e8b671SLeon Romanovsky 	__u16 rcvhdrq_cnt;      /* number of RcvHdrQ entries */
9538e8b671SLeon Romanovsky 	__u16 rcvhdrq_entsize;  /* size (in bytes) for each RcvHdrQ entry */
9638e8b671SLeon Romanovsky 	__u16 sdma_ring_size;   /* number of entries in SDMA request ring */
9738e8b671SLeon Romanovsky };
9838e8b671SLeon Romanovsky 
9938e8b671SLeon Romanovsky struct hfi1_tid_info {
10038e8b671SLeon Romanovsky 	/* virtual address of first page in transfer */
10138e8b671SLeon Romanovsky 	__u64 vaddr;
10238e8b671SLeon Romanovsky 	/* pointer to tid array. this array is big enough */
10338e8b671SLeon Romanovsky 	__u64 tidlist;
10438e8b671SLeon Romanovsky 	/* number of tids programmed by this request */
10538e8b671SLeon Romanovsky 	__u32 tidcnt;
10638e8b671SLeon Romanovsky 	/* length of transfer buffer programmed by this request */
10738e8b671SLeon Romanovsky 	__u32 length;
10838e8b671SLeon Romanovsky };
10938e8b671SLeon Romanovsky 
11038e8b671SLeon Romanovsky /*
11138e8b671SLeon Romanovsky  * This structure is returned by the driver immediately after
11238e8b671SLeon Romanovsky  * open to get implementation-specific info, and info specific to this
11338e8b671SLeon Romanovsky  * instance.
11438e8b671SLeon Romanovsky  *
11538e8b671SLeon Romanovsky  * This struct must have explicit pad fields where type sizes
11638e8b671SLeon Romanovsky  * may result in different alignments between 32 and 64 bit
11738e8b671SLeon Romanovsky  * programs, since the 64 bit * bit kernel requires the user code
11838e8b671SLeon Romanovsky  * to have matching offsets
11938e8b671SLeon Romanovsky  */
12038e8b671SLeon Romanovsky struct hfi1_base_info {
12138e8b671SLeon Romanovsky 	/* version of hardware, for feature checking. */
12238e8b671SLeon Romanovsky 	__u32 hw_version;
12338e8b671SLeon Romanovsky 	/* version of software, for feature checking. */
12438e8b671SLeon Romanovsky 	__u32 sw_version;
12538e8b671SLeon Romanovsky 	/* Job key */
12638e8b671SLeon Romanovsky 	__u16 jkey;
12738e8b671SLeon Romanovsky 	__u16 padding1;
12838e8b671SLeon Romanovsky 	/*
12938e8b671SLeon Romanovsky 	 * The special QP (queue pair) value that identifies PSM
13038e8b671SLeon Romanovsky 	 * protocol packet from standard IB packets.
13138e8b671SLeon Romanovsky 	 */
13238e8b671SLeon Romanovsky 	__u32 bthqp;
13338e8b671SLeon Romanovsky 	/* PIO credit return address, */
13438e8b671SLeon Romanovsky 	__u64 sc_credits_addr;
13538e8b671SLeon Romanovsky 	/*
13638e8b671SLeon Romanovsky 	 * Base address of write-only pio buffers for this process.
13738e8b671SLeon Romanovsky 	 * Each buffer has sendpio_credits*64 bytes.
13838e8b671SLeon Romanovsky 	 */
13938e8b671SLeon Romanovsky 	__u64 pio_bufbase_sop;
14038e8b671SLeon Romanovsky 	/*
14138e8b671SLeon Romanovsky 	 * Base address of write-only pio buffers for this process.
14238e8b671SLeon Romanovsky 	 * Each buffer has sendpio_credits*64 bytes.
14338e8b671SLeon Romanovsky 	 */
14438e8b671SLeon Romanovsky 	__u64 pio_bufbase;
14538e8b671SLeon Romanovsky 	/* address where receive buffer queue is mapped into */
14638e8b671SLeon Romanovsky 	__u64 rcvhdr_bufbase;
14738e8b671SLeon Romanovsky 	/* base address of Eager receive buffers. */
14838e8b671SLeon Romanovsky 	__u64 rcvegr_bufbase;
14938e8b671SLeon Romanovsky 	/* base address of SDMA completion ring */
15038e8b671SLeon Romanovsky 	__u64 sdma_comp_bufbase;
15138e8b671SLeon Romanovsky 	/*
15238e8b671SLeon Romanovsky 	 * User register base for init code, not to be used directly by
15338e8b671SLeon Romanovsky 	 * protocol or applications.  Always maps real chip register space.
15438e8b671SLeon Romanovsky 	 * the register addresses are:
15538e8b671SLeon Romanovsky 	 * ur_rcvhdrhead, ur_rcvhdrtail, ur_rcvegrhead, ur_rcvegrtail,
15638e8b671SLeon Romanovsky 	 * ur_rcvtidflow
15738e8b671SLeon Romanovsky 	 */
15838e8b671SLeon Romanovsky 	__u64 user_regbase;
15938e8b671SLeon Romanovsky 	/* notification events */
16038e8b671SLeon Romanovsky 	__u64 events_bufbase;
16138e8b671SLeon Romanovsky 	/* status page */
16238e8b671SLeon Romanovsky 	__u64 status_bufbase;
16338e8b671SLeon Romanovsky 	/* rcvhdrtail update */
16438e8b671SLeon Romanovsky 	__u64 rcvhdrtail_base;
16538e8b671SLeon Romanovsky 	/*
16638e8b671SLeon Romanovsky 	 * shared memory pages for subctxts if ctxt is shared; these cover
16738e8b671SLeon Romanovsky 	 * all the processes in the group sharing a single context.
16838e8b671SLeon Romanovsky 	 * all have enough space for the num_subcontexts value on this job.
16938e8b671SLeon Romanovsky 	 */
17038e8b671SLeon Romanovsky 	__u64 subctxt_uregbase;
17138e8b671SLeon Romanovsky 	__u64 subctxt_rcvegrbuf;
17238e8b671SLeon Romanovsky 	__u64 subctxt_rcvhdrbuf;
17338e8b671SLeon Romanovsky };
17438e8b671SLeon Romanovsky #endif /* _LINIUX__HFI1_IOCTL_H */
175