| .. | .. |
|---|
| 1 | 1 | #ifndef _HFI1_USER_SDMA_H |
|---|
| 2 | 2 | #define _HFI1_USER_SDMA_H |
|---|
| 3 | 3 | /* |
|---|
| 4 | + * Copyright(c) 2020 - Cornelis Networks, Inc. |
|---|
| 4 | 5 | * Copyright(c) 2015 - 2018 Intel Corporation. |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * This file is provided under a dual BSD/GPLv2 license. When using or |
|---|
| .. | .. |
|---|
| 52 | 53 | #include "common.h" |
|---|
| 53 | 54 | #include "iowait.h" |
|---|
| 54 | 55 | #include "user_exp_rcv.h" |
|---|
| 56 | +#include "mmu_rb.h" |
|---|
| 55 | 57 | |
|---|
| 56 | 58 | /* The maximum number of Data io vectors per message/request */ |
|---|
| 57 | 59 | #define MAX_VECTORS_PER_REQ 8 |
|---|
| .. | .. |
|---|
| 110 | 112 | SDMA_PKT_Q_DEFERRED, |
|---|
| 111 | 113 | }; |
|---|
| 112 | 114 | |
|---|
| 113 | | -/* |
|---|
| 114 | | - * Maximum retry attempts to submit a TX request |
|---|
| 115 | | - * before putting the process to sleep. |
|---|
| 116 | | - */ |
|---|
| 117 | | -#define MAX_DEFER_RETRY_COUNT 1 |
|---|
| 118 | | - |
|---|
| 119 | 115 | #define SDMA_IOWAIT_TIMEOUT 1000 /* in milliseconds */ |
|---|
| 120 | 116 | |
|---|
| 121 | 117 | #define SDMA_DBG(req, fmt, ...) \ |
|---|
| .. | .. |
|---|
| 139 | 135 | unsigned long unpinned; |
|---|
| 140 | 136 | struct mmu_rb_handler *handler; |
|---|
| 141 | 137 | atomic_t n_locked; |
|---|
| 142 | | - struct mm_struct *mm; |
|---|
| 143 | 138 | }; |
|---|
| 144 | 139 | |
|---|
| 145 | 140 | struct hfi1_user_sdma_comp_q { |
|---|
| .. | .. |
|---|
| 150 | 145 | struct sdma_mmu_node { |
|---|
| 151 | 146 | struct mmu_rb_node rb; |
|---|
| 152 | 147 | struct hfi1_user_sdma_pkt_q *pq; |
|---|
| 153 | | - atomic_t refcount; |
|---|
| 154 | 148 | struct page **pages; |
|---|
| 155 | 149 | unsigned int npages; |
|---|
| 156 | 150 | }; |
|---|
| .. | .. |
|---|
| 158 | 152 | struct user_sdma_iovec { |
|---|
| 159 | 153 | struct list_head list; |
|---|
| 160 | 154 | struct iovec iov; |
|---|
| 161 | | - /* number of pages in this vector */ |
|---|
| 162 | | - unsigned int npages; |
|---|
| 163 | | - /* array of pinned pages for this vector */ |
|---|
| 164 | | - struct page **pages; |
|---|
| 165 | 155 | /* |
|---|
| 166 | 156 | * offset into the virtual address space of the vector at |
|---|
| 167 | 157 | * which we last left off. |
|---|
| 168 | 158 | */ |
|---|
| 169 | 159 | u64 offset; |
|---|
| 170 | | - struct sdma_mmu_node *node; |
|---|
| 171 | 160 | }; |
|---|
| 172 | 161 | |
|---|
| 173 | 162 | /* evict operation argument */ |
|---|
| .. | .. |
|---|
| 204 | 193 | s8 ahg_idx; |
|---|
| 205 | 194 | |
|---|
| 206 | 195 | /* Writeable fields shared with interrupt */ |
|---|
| 207 | | - u64 seqcomp ____cacheline_aligned_in_smp; |
|---|
| 208 | | - u64 seqsubmitted; |
|---|
| 196 | + u16 seqcomp ____cacheline_aligned_in_smp; |
|---|
| 197 | + u16 seqsubmitted; |
|---|
| 209 | 198 | |
|---|
| 210 | 199 | /* Send side fields */ |
|---|
| 211 | 200 | struct list_head txps ____cacheline_aligned_in_smp; |
|---|
| 212 | | - u64 seqnum; |
|---|
| 201 | + u16 seqnum; |
|---|
| 213 | 202 | /* |
|---|
| 214 | 203 | * KDETH.OFFSET (TID) field |
|---|
| 215 | 204 | * The offset can cover multiple packets, depending on the |
|---|
| .. | .. |
|---|
| 245 | 234 | struct list_head list; |
|---|
| 246 | 235 | struct user_sdma_request *req; |
|---|
| 247 | 236 | u16 flags; |
|---|
| 248 | | - u64 seqnum; |
|---|
| 237 | + u16 seqnum; |
|---|
| 249 | 238 | }; |
|---|
| 250 | 239 | |
|---|
| 251 | 240 | int hfi1_user_sdma_alloc_queues(struct hfi1_ctxtdata *uctxt, |
|---|
| .. | .. |
|---|
| 256 | 245 | struct iovec *iovec, unsigned long dim, |
|---|
| 257 | 246 | unsigned long *count); |
|---|
| 258 | 247 | |
|---|
| 248 | +static inline struct mm_struct *mm_from_sdma_node(struct sdma_mmu_node *node) |
|---|
| 249 | +{ |
|---|
| 250 | + return node->rb.handler->mn.mm; |
|---|
| 251 | +} |
|---|
| 252 | + |
|---|
| 259 | 253 | #endif /* _HFI1_USER_SDMA_H */ |
|---|