hfi1_ioctl.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. //
  2. // Copyright 2026 Aarav Ravindra Kharade
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. //
  8. // http://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. //
  16. /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
  17. /*
  18. *
  19. * This file is provided under a dual BSD/GPLv2 license. When using or
  20. * redistributing this file, you may do so under either license.
  21. *
  22. * GPL LICENSE SUMMARY
  23. *
  24. * Copyright(c) 2015 Intel Corporation.
  25. *
  26. * This program is free software; you can redistribute it and/or modify
  27. * it under the terms of version 2 of the GNU General Public License as
  28. * published by the Free Software Foundation.
  29. *
  30. * This program is distributed in the hope that it will be useful, but
  31. * WITHOUT ANY WARRANTY; without even the implied warranty of
  32. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  33. * General Public License for more details.
  34. *
  35. * BSD LICENSE
  36. *
  37. * Copyright(c) 2015 Intel Corporation.
  38. *
  39. * Redistribution and use in source and binary forms, with or without
  40. * modification, are permitted provided that the following conditions
  41. * are met:
  42. *
  43. * - Redistributions of source code must retain the above copyright
  44. * notice, this list of conditions and the following disclaimer.
  45. * - Redistributions in binary form must reproduce the above copyright
  46. * notice, this list of conditions and the following disclaimer in
  47. * the documentation and/or other materials provided with the
  48. * distribution.
  49. * - Neither the name of Intel Corporation nor the names of its
  50. * contributors may be used to endorse or promote products derived
  51. * from this software without specific prior written permission.
  52. *
  53. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  54. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  55. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  56. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  57. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  58. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  59. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  60. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  61. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  62. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  63. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  64. *
  65. */
  66. #ifndef _LINUX__HFI1_IOCTL_H
  67. #define _LINUX__HFI1_IOCTL_H
  68. #include <linux/types.h>
  69. /*
  70. * This structure is passed to the driver to tell it where
  71. * user code buffers are, sizes, etc. The offsets and sizes of the
  72. * fields must remain unchanged, for binary compatibility. It can
  73. * be extended, if userversion is changed so user code can tell, if needed
  74. */
  75. struct hfi1_user_info {
  76. /*
  77. * version of user software, to detect compatibility issues.
  78. * Should be set to HFI1_USER_SWVERSION.
  79. */
  80. __u32 userversion;
  81. __u32 pad;
  82. /*
  83. * If two or more processes wish to share a context, each process
  84. * must set the subcontext_cnt and subcontext_id to the same
  85. * values. The only restriction on the subcontext_id is that
  86. * it be unique for a given node.
  87. */
  88. __u16 subctxt_cnt;
  89. __u16 subctxt_id;
  90. /* 128bit UUID passed in by PSM. */
  91. __u8 uuid[16];
  92. };
  93. struct hfi1_ctxt_info {
  94. __aligned_u64 runtime_flags; /* chip/drv runtime flags (HFI1_CAP_*) */
  95. __u32 rcvegr_size; /* size of each eager buffer */
  96. __u16 num_active; /* number of active units */
  97. __u16 unit; /* unit (chip) assigned to caller */
  98. __u16 ctxt; /* ctxt on unit assigned to caller */
  99. __u16 subctxt; /* subctxt on unit assigned to caller */
  100. __u16 rcvtids; /* number of Rcv TIDs for this context */
  101. __u16 credits; /* number of PIO credits for this context */
  102. __u16 numa_node; /* NUMA node of the assigned device */
  103. __u16 rec_cpu; /* cpu # for affinity (0xffff if none) */
  104. __u16 send_ctxt; /* send context in use by this user context */
  105. __u16 egrtids; /* number of RcvArray entries for Eager Rcvs */
  106. __u16 rcvhdrq_cnt; /* number of RcvHdrQ entries */
  107. __u16 rcvhdrq_entsize; /* size (in bytes) for each RcvHdrQ entry */
  108. __u16 sdma_ring_size; /* number of entries in SDMA request ring */
  109. };
  110. struct hfi1_tid_info {
  111. /* virtual address of first page in transfer */
  112. __aligned_u64 vaddr;
  113. /* pointer to tid array. this array is big enough */
  114. __aligned_u64 tidlist;
  115. /* number of tids programmed by this request */
  116. __u32 tidcnt;
  117. /* length of transfer buffer programmed by this request */
  118. __u32 length;
  119. };
  120. /*
  121. * This structure is returned by the driver immediately after
  122. * open to get implementation-specific info, and info specific to this
  123. * instance.
  124. *
  125. * This struct must have explicit pad fields where type sizes
  126. * may result in different alignments between 32 and 64 bit
  127. * programs, since the 64 bit * bit kernel requires the user code
  128. * to have matching offsets
  129. */
  130. struct hfi1_base_info {
  131. /* version of hardware, for feature checking. */
  132. __u32 hw_version;
  133. /* version of software, for feature checking. */
  134. __u32 sw_version;
  135. /* Job key */
  136. __u16 jkey;
  137. __u16 padding1;
  138. /*
  139. * The special QP (queue pair) value that identifies PSM
  140. * protocol packet from standard IB packets.
  141. */
  142. __u32 bthqp;
  143. /* PIO credit return address, */
  144. __aligned_u64 sc_credits_addr;
  145. /*
  146. * Base address of write-only pio buffers for this process.
  147. * Each buffer has sendpio_credits*64 bytes.
  148. */
  149. __aligned_u64 pio_bufbase_sop;
  150. /*
  151. * Base address of write-only pio buffers for this process.
  152. * Each buffer has sendpio_credits*64 bytes.
  153. */
  154. __aligned_u64 pio_bufbase;
  155. /* address where receive buffer queue is mapped into */
  156. __aligned_u64 rcvhdr_bufbase;
  157. /* base address of Eager receive buffers. */
  158. __aligned_u64 rcvegr_bufbase;
  159. /* base address of SDMA completion ring */
  160. __aligned_u64 sdma_comp_bufbase;
  161. /*
  162. * User register base for init code, not to be used directly by
  163. * protocol or applications. Always maps real chip register space.
  164. * the register addresses are:
  165. * ur_rcvhdrhead, ur_rcvhdrtail, ur_rcvegrhead, ur_rcvegrtail,
  166. * ur_rcvtidflow
  167. */
  168. __aligned_u64 user_regbase;
  169. /* notification events */
  170. __aligned_u64 events_bufbase;
  171. /* status page */
  172. __aligned_u64 status_bufbase;
  173. /* rcvhdrtail update */
  174. __aligned_u64 rcvhdrtail_base;
  175. /*
  176. * shared memory pages for subctxts if ctxt is shared; these cover
  177. * all the processes in the group sharing a single context.
  178. * all have enough space for the num_subcontexts value on this job.
  179. */
  180. __aligned_u64 subctxt_uregbase;
  181. __aligned_u64 subctxt_rcvegrbuf;
  182. __aligned_u64 subctxt_rcvhdrbuf;
  183. };
  184. #endif /* _LINIUX__HFI1_IOCTL_H */