diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-18 23:10:44 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-18 23:10:44 -0500 |
commit | 4c929feed7e9ce69efbe85e3932393db67fbce76 (patch) | |
tree | e71435174ea1c22e98c93d3c0f93598d5841ce02 /include/linux | |
parent | 018cb13eb33383cbc3fb6d3a286ef32ecb816779 (diff) | |
parent | a7cfef21e3d066343bec14d3113a9f9c92d1c2a8 (diff) |
Merge tag 'rdma-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband
Pull infiniband updates from Roland Dreier:
"Main batch of InfiniBand/RDMA changes for 3.19:
- On-demand paging support in core midlayer and mlx5 driver. This
lets userspace create non-pinned memory regions and have the
adapter HW trigger page faults.
- iSER and IPoIB updates and fixes.
- Low-level HW driver updates for cxgb4, mlx4 and ocrdma.
- Other miscellaneous fixes"
* tag 'rdma-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband: (56 commits)
IB/mlx5: Implement on demand paging by adding support for MMU notifiers
IB/mlx5: Add support for RDMA read/write responder page faults
IB/mlx5: Handle page faults
IB/mlx5: Page faults handling infrastructure
IB/mlx5: Add mlx5_ib_update_mtt to update page tables after creation
IB/mlx5: Changes in memory region creation to support on-demand paging
IB/mlx5: Implement the ODP capability query verb
mlx5_core: Add support for page faults events and low level handling
mlx5_core: Re-add MLX5_DEV_CAP_FLAG_ON_DMND_PG flag
IB/srp: Allow newline separator for connection string
IB/core: Implement support for MMU notifiers regarding on demand paging regions
IB/core: Add support for on demand paging regions
IB/core: Add flags for on demand paging support
IB/core: Add support for extended query device caps
IB/mlx5: Add function to read WQE from user-space
IB/core: Add umem function to read data from user-space
IB/core: Replace ib_umem's offset field with a full address
IB/mlx5: Enhance UMR support to allow partial page table update
IB/mlx5: Remove per-MR pas and dma pointers
RDMA/ocrdma: Always resolve destination mac from GRH for UD QPs
...
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/mlx5/device.h | 72 | ||||
-rw-r--r-- | include/linux/mlx5/driver.h | 14 | ||||
-rw-r--r-- | include/linux/mlx5/qp.h | 65 |
3 files changed, 149 insertions, 2 deletions
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h index ea4f1c46f761..4e5bd813bb9a 100644 --- a/include/linux/mlx5/device.h +++ b/include/linux/mlx5/device.h | |||
@@ -120,6 +120,15 @@ enum { | |||
120 | }; | 120 | }; |
121 | 121 | ||
122 | enum { | 122 | enum { |
123 | MLX5_MKEY_INBOX_PG_ACCESS = 1 << 31 | ||
124 | }; | ||
125 | |||
126 | enum { | ||
127 | MLX5_PFAULT_SUBTYPE_WQE = 0, | ||
128 | MLX5_PFAULT_SUBTYPE_RDMA = 1, | ||
129 | }; | ||
130 | |||
131 | enum { | ||
123 | MLX5_PERM_LOCAL_READ = 1 << 2, | 132 | MLX5_PERM_LOCAL_READ = 1 << 2, |
124 | MLX5_PERM_LOCAL_WRITE = 1 << 3, | 133 | MLX5_PERM_LOCAL_WRITE = 1 << 3, |
125 | MLX5_PERM_REMOTE_READ = 1 << 4, | 134 | MLX5_PERM_REMOTE_READ = 1 << 4, |
@@ -180,6 +189,19 @@ enum { | |||
180 | MLX5_MKEY_MASK_FREE = 1ull << 29, | 189 | MLX5_MKEY_MASK_FREE = 1ull << 29, |
181 | }; | 190 | }; |
182 | 191 | ||
192 | enum { | ||
193 | MLX5_UMR_TRANSLATION_OFFSET_EN = (1 << 4), | ||
194 | |||
195 | MLX5_UMR_CHECK_NOT_FREE = (1 << 5), | ||
196 | MLX5_UMR_CHECK_FREE = (2 << 5), | ||
197 | |||
198 | MLX5_UMR_INLINE = (1 << 7), | ||
199 | }; | ||
200 | |||
201 | #define MLX5_UMR_MTT_ALIGNMENT 0x40 | ||
202 | #define MLX5_UMR_MTT_MASK (MLX5_UMR_MTT_ALIGNMENT - 1) | ||
203 | #define MLX5_UMR_MTT_MIN_CHUNK_SIZE MLX5_UMR_MTT_ALIGNMENT | ||
204 | |||
183 | enum mlx5_event { | 205 | enum mlx5_event { |
184 | MLX5_EVENT_TYPE_COMP = 0x0, | 206 | MLX5_EVENT_TYPE_COMP = 0x0, |
185 | 207 | ||
@@ -206,6 +228,8 @@ enum mlx5_event { | |||
206 | 228 | ||
207 | MLX5_EVENT_TYPE_CMD = 0x0a, | 229 | MLX5_EVENT_TYPE_CMD = 0x0a, |
208 | MLX5_EVENT_TYPE_PAGE_REQUEST = 0xb, | 230 | MLX5_EVENT_TYPE_PAGE_REQUEST = 0xb, |
231 | |||
232 | MLX5_EVENT_TYPE_PAGE_FAULT = 0xc, | ||
209 | }; | 233 | }; |
210 | 234 | ||
211 | enum { | 235 | enum { |
@@ -225,6 +249,7 @@ enum { | |||
225 | MLX5_DEV_CAP_FLAG_APM = 1LL << 17, | 249 | MLX5_DEV_CAP_FLAG_APM = 1LL << 17, |
226 | MLX5_DEV_CAP_FLAG_ATOMIC = 1LL << 18, | 250 | MLX5_DEV_CAP_FLAG_ATOMIC = 1LL << 18, |
227 | MLX5_DEV_CAP_FLAG_BLOCK_MCAST = 1LL << 23, | 251 | MLX5_DEV_CAP_FLAG_BLOCK_MCAST = 1LL << 23, |
252 | MLX5_DEV_CAP_FLAG_ON_DMND_PG = 1LL << 24, | ||
228 | MLX5_DEV_CAP_FLAG_CQ_MODER = 1LL << 29, | 253 | MLX5_DEV_CAP_FLAG_CQ_MODER = 1LL << 29, |
229 | MLX5_DEV_CAP_FLAG_RESIZE_CQ = 1LL << 30, | 254 | MLX5_DEV_CAP_FLAG_RESIZE_CQ = 1LL << 30, |
230 | MLX5_DEV_CAP_FLAG_DCT = 1LL << 37, | 255 | MLX5_DEV_CAP_FLAG_DCT = 1LL << 37, |
@@ -290,6 +315,8 @@ enum { | |||
290 | enum { | 315 | enum { |
291 | HCA_CAP_OPMOD_GET_MAX = 0, | 316 | HCA_CAP_OPMOD_GET_MAX = 0, |
292 | HCA_CAP_OPMOD_GET_CUR = 1, | 317 | HCA_CAP_OPMOD_GET_CUR = 1, |
318 | HCA_CAP_OPMOD_GET_ODP_MAX = 4, | ||
319 | HCA_CAP_OPMOD_GET_ODP_CUR = 5 | ||
293 | }; | 320 | }; |
294 | 321 | ||
295 | struct mlx5_inbox_hdr { | 322 | struct mlx5_inbox_hdr { |
@@ -319,6 +346,23 @@ struct mlx5_cmd_query_adapter_mbox_out { | |||
319 | u8 vsd_psid[16]; | 346 | u8 vsd_psid[16]; |
320 | }; | 347 | }; |
321 | 348 | ||
349 | enum mlx5_odp_transport_cap_bits { | ||
350 | MLX5_ODP_SUPPORT_SEND = 1 << 31, | ||
351 | MLX5_ODP_SUPPORT_RECV = 1 << 30, | ||
352 | MLX5_ODP_SUPPORT_WRITE = 1 << 29, | ||
353 | MLX5_ODP_SUPPORT_READ = 1 << 28, | ||
354 | }; | ||
355 | |||
356 | struct mlx5_odp_caps { | ||
357 | char reserved[0x10]; | ||
358 | struct { | ||
359 | __be32 rc_odp_caps; | ||
360 | __be32 uc_odp_caps; | ||
361 | __be32 ud_odp_caps; | ||
362 | } per_transport_caps; | ||
363 | char reserved2[0xe4]; | ||
364 | }; | ||
365 | |||
322 | struct mlx5_cmd_init_hca_mbox_in { | 366 | struct mlx5_cmd_init_hca_mbox_in { |
323 | struct mlx5_inbox_hdr hdr; | 367 | struct mlx5_inbox_hdr hdr; |
324 | u8 rsvd0[2]; | 368 | u8 rsvd0[2]; |
@@ -439,6 +483,27 @@ struct mlx5_eqe_page_req { | |||
439 | __be32 rsvd1[5]; | 483 | __be32 rsvd1[5]; |
440 | }; | 484 | }; |
441 | 485 | ||
486 | struct mlx5_eqe_page_fault { | ||
487 | __be32 bytes_committed; | ||
488 | union { | ||
489 | struct { | ||
490 | u16 reserved1; | ||
491 | __be16 wqe_index; | ||
492 | u16 reserved2; | ||
493 | __be16 packet_length; | ||
494 | u8 reserved3[12]; | ||
495 | } __packed wqe; | ||
496 | struct { | ||
497 | __be32 r_key; | ||
498 | u16 reserved1; | ||
499 | __be16 packet_length; | ||
500 | __be32 rdma_op_len; | ||
501 | __be64 rdma_va; | ||
502 | } __packed rdma; | ||
503 | } __packed; | ||
504 | __be32 flags_qpn; | ||
505 | } __packed; | ||
506 | |||
442 | union ev_data { | 507 | union ev_data { |
443 | __be32 raw[7]; | 508 | __be32 raw[7]; |
444 | struct mlx5_eqe_cmd cmd; | 509 | struct mlx5_eqe_cmd cmd; |
@@ -450,6 +515,7 @@ union ev_data { | |||
450 | struct mlx5_eqe_congestion cong; | 515 | struct mlx5_eqe_congestion cong; |
451 | struct mlx5_eqe_stall_vl stall_vl; | 516 | struct mlx5_eqe_stall_vl stall_vl; |
452 | struct mlx5_eqe_page_req req_pages; | 517 | struct mlx5_eqe_page_req req_pages; |
518 | struct mlx5_eqe_page_fault page_fault; | ||
453 | } __packed; | 519 | } __packed; |
454 | 520 | ||
455 | struct mlx5_eqe { | 521 | struct mlx5_eqe { |
@@ -776,6 +842,10 @@ struct mlx5_query_eq_mbox_out { | |||
776 | struct mlx5_eq_context ctx; | 842 | struct mlx5_eq_context ctx; |
777 | }; | 843 | }; |
778 | 844 | ||
845 | enum { | ||
846 | MLX5_MKEY_STATUS_FREE = 1 << 6, | ||
847 | }; | ||
848 | |||
779 | struct mlx5_mkey_seg { | 849 | struct mlx5_mkey_seg { |
780 | /* This is a two bit field occupying bits 31-30. | 850 | /* This is a two bit field occupying bits 31-30. |
781 | * bit 31 is always 0, | 851 | * bit 31 is always 0, |
@@ -812,7 +882,7 @@ struct mlx5_query_special_ctxs_mbox_out { | |||
812 | struct mlx5_create_mkey_mbox_in { | 882 | struct mlx5_create_mkey_mbox_in { |
813 | struct mlx5_inbox_hdr hdr; | 883 | struct mlx5_inbox_hdr hdr; |
814 | __be32 input_mkey_index; | 884 | __be32 input_mkey_index; |
815 | u8 rsvd0[4]; | 885 | __be32 flags; |
816 | struct mlx5_mkey_seg seg; | 886 | struct mlx5_mkey_seg seg; |
817 | u8 rsvd1[16]; | 887 | u8 rsvd1[16]; |
818 | __be32 xlat_oct_act_size; | 888 | __be32 xlat_oct_act_size; |
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h index b1bf41556b32..166d9315fe4b 100644 --- a/include/linux/mlx5/driver.h +++ b/include/linux/mlx5/driver.h | |||
@@ -113,6 +113,13 @@ enum { | |||
113 | MLX5_REG_HOST_ENDIANNESS = 0x7004, | 113 | MLX5_REG_HOST_ENDIANNESS = 0x7004, |
114 | }; | 114 | }; |
115 | 115 | ||
116 | enum mlx5_page_fault_resume_flags { | ||
117 | MLX5_PAGE_FAULT_RESUME_REQUESTOR = 1 << 0, | ||
118 | MLX5_PAGE_FAULT_RESUME_WRITE = 1 << 1, | ||
119 | MLX5_PAGE_FAULT_RESUME_RDMA = 1 << 2, | ||
120 | MLX5_PAGE_FAULT_RESUME_ERROR = 1 << 7, | ||
121 | }; | ||
122 | |||
116 | enum dbg_rsc_type { | 123 | enum dbg_rsc_type { |
117 | MLX5_DBG_RSC_QP, | 124 | MLX5_DBG_RSC_QP, |
118 | MLX5_DBG_RSC_EQ, | 125 | MLX5_DBG_RSC_EQ, |
@@ -467,7 +474,7 @@ struct mlx5_priv { | |||
467 | struct workqueue_struct *pg_wq; | 474 | struct workqueue_struct *pg_wq; |
468 | struct rb_root page_root; | 475 | struct rb_root page_root; |
469 | int fw_pages; | 476 | int fw_pages; |
470 | int reg_pages; | 477 | atomic_t reg_pages; |
471 | struct list_head free_list; | 478 | struct list_head free_list; |
472 | 479 | ||
473 | struct mlx5_core_health health; | 480 | struct mlx5_core_health health; |
@@ -703,6 +710,9 @@ void mlx5_eq_cleanup(struct mlx5_core_dev *dev); | |||
703 | void mlx5_fill_page_array(struct mlx5_buf *buf, __be64 *pas); | 710 | void mlx5_fill_page_array(struct mlx5_buf *buf, __be64 *pas); |
704 | void mlx5_cq_completion(struct mlx5_core_dev *dev, u32 cqn); | 711 | void mlx5_cq_completion(struct mlx5_core_dev *dev, u32 cqn); |
705 | void mlx5_rsc_event(struct mlx5_core_dev *dev, u32 rsn, int event_type); | 712 | void mlx5_rsc_event(struct mlx5_core_dev *dev, u32 rsn, int event_type); |
713 | #ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING | ||
714 | void mlx5_eq_pagefault(struct mlx5_core_dev *dev, struct mlx5_eqe *eqe); | ||
715 | #endif | ||
706 | void mlx5_srq_event(struct mlx5_core_dev *dev, u32 srqn, int event_type); | 716 | void mlx5_srq_event(struct mlx5_core_dev *dev, u32 srqn, int event_type); |
707 | struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_core_dev *dev, u32 srqn); | 717 | struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_core_dev *dev, u32 srqn); |
708 | void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, unsigned long vector); | 718 | void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, unsigned long vector); |
@@ -740,6 +750,8 @@ int mlx5_core_create_psv(struct mlx5_core_dev *dev, u32 pdn, | |||
740 | int npsvs, u32 *sig_index); | 750 | int npsvs, u32 *sig_index); |
741 | int mlx5_core_destroy_psv(struct mlx5_core_dev *dev, int psv_num); | 751 | int mlx5_core_destroy_psv(struct mlx5_core_dev *dev, int psv_num); |
742 | void mlx5_core_put_rsc(struct mlx5_core_rsc_common *common); | 752 | void mlx5_core_put_rsc(struct mlx5_core_rsc_common *common); |
753 | int mlx5_query_odp_caps(struct mlx5_core_dev *dev, | ||
754 | struct mlx5_odp_caps *odp_caps); | ||
743 | 755 | ||
744 | static inline u32 mlx5_mkey_to_idx(u32 mkey) | 756 | static inline u32 mlx5_mkey_to_idx(u32 mkey) |
745 | { | 757 | { |
diff --git a/include/linux/mlx5/qp.h b/include/linux/mlx5/qp.h index 3fa075daeb1d..61f7a342d1bf 100644 --- a/include/linux/mlx5/qp.h +++ b/include/linux/mlx5/qp.h | |||
@@ -50,6 +50,9 @@ | |||
50 | #define MLX5_BSF_APPTAG_ESCAPE 0x1 | 50 | #define MLX5_BSF_APPTAG_ESCAPE 0x1 |
51 | #define MLX5_BSF_APPREF_ESCAPE 0x2 | 51 | #define MLX5_BSF_APPREF_ESCAPE 0x2 |
52 | 52 | ||
53 | #define MLX5_QPN_BITS 24 | ||
54 | #define MLX5_QPN_MASK ((1 << MLX5_QPN_BITS) - 1) | ||
55 | |||
53 | enum mlx5_qp_optpar { | 56 | enum mlx5_qp_optpar { |
54 | MLX5_QP_OPTPAR_ALT_ADDR_PATH = 1 << 0, | 57 | MLX5_QP_OPTPAR_ALT_ADDR_PATH = 1 << 0, |
55 | MLX5_QP_OPTPAR_RRE = 1 << 1, | 58 | MLX5_QP_OPTPAR_RRE = 1 << 1, |
@@ -189,6 +192,14 @@ struct mlx5_wqe_ctrl_seg { | |||
189 | __be32 imm; | 192 | __be32 imm; |
190 | }; | 193 | }; |
191 | 194 | ||
195 | #define MLX5_WQE_CTRL_DS_MASK 0x3f | ||
196 | #define MLX5_WQE_CTRL_QPN_MASK 0xffffff00 | ||
197 | #define MLX5_WQE_CTRL_QPN_SHIFT 8 | ||
198 | #define MLX5_WQE_DS_UNITS 16 | ||
199 | #define MLX5_WQE_CTRL_OPCODE_MASK 0xff | ||
200 | #define MLX5_WQE_CTRL_WQE_INDEX_MASK 0x00ffff00 | ||
201 | #define MLX5_WQE_CTRL_WQE_INDEX_SHIFT 8 | ||
202 | |||
192 | struct mlx5_wqe_xrc_seg { | 203 | struct mlx5_wqe_xrc_seg { |
193 | __be32 xrc_srqn; | 204 | __be32 xrc_srqn; |
194 | u8 rsvd[12]; | 205 | u8 rsvd[12]; |
@@ -292,6 +303,8 @@ struct mlx5_wqe_signature_seg { | |||
292 | u8 rsvd1[11]; | 303 | u8 rsvd1[11]; |
293 | }; | 304 | }; |
294 | 305 | ||
306 | #define MLX5_WQE_INLINE_SEG_BYTE_COUNT_MASK 0x3ff | ||
307 | |||
295 | struct mlx5_wqe_inline_seg { | 308 | struct mlx5_wqe_inline_seg { |
296 | __be32 byte_count; | 309 | __be32 byte_count; |
297 | }; | 310 | }; |
@@ -360,9 +373,46 @@ struct mlx5_stride_block_ctrl_seg { | |||
360 | __be16 num_entries; | 373 | __be16 num_entries; |
361 | }; | 374 | }; |
362 | 375 | ||
376 | enum mlx5_pagefault_flags { | ||
377 | MLX5_PFAULT_REQUESTOR = 1 << 0, | ||
378 | MLX5_PFAULT_WRITE = 1 << 1, | ||
379 | MLX5_PFAULT_RDMA = 1 << 2, | ||
380 | }; | ||
381 | |||
382 | /* Contains the details of a pagefault. */ | ||
383 | struct mlx5_pagefault { | ||
384 | u32 bytes_committed; | ||
385 | u8 event_subtype; | ||
386 | enum mlx5_pagefault_flags flags; | ||
387 | union { | ||
388 | /* Initiator or send message responder pagefault details. */ | ||
389 | struct { | ||
390 | /* Received packet size, only valid for responders. */ | ||
391 | u32 packet_size; | ||
392 | /* | ||
393 | * WQE index. Refers to either the send queue or | ||
394 | * receive queue, according to event_subtype. | ||
395 | */ | ||
396 | u16 wqe_index; | ||
397 | } wqe; | ||
398 | /* RDMA responder pagefault details */ | ||
399 | struct { | ||
400 | u32 r_key; | ||
401 | /* | ||
402 | * Received packet size, minimal size page fault | ||
403 | * resolution required for forward progress. | ||
404 | */ | ||
405 | u32 packet_size; | ||
406 | u32 rdma_op_len; | ||
407 | u64 rdma_va; | ||
408 | } rdma; | ||
409 | }; | ||
410 | }; | ||
411 | |||
363 | struct mlx5_core_qp { | 412 | struct mlx5_core_qp { |
364 | struct mlx5_core_rsc_common common; /* must be first */ | 413 | struct mlx5_core_rsc_common common; /* must be first */ |
365 | void (*event) (struct mlx5_core_qp *, int); | 414 | void (*event) (struct mlx5_core_qp *, int); |
415 | void (*pfault_handler)(struct mlx5_core_qp *, struct mlx5_pagefault *); | ||
366 | int qpn; | 416 | int qpn; |
367 | struct mlx5_rsc_debug *dbg; | 417 | struct mlx5_rsc_debug *dbg; |
368 | int pid; | 418 | int pid; |
@@ -530,6 +580,17 @@ static inline struct mlx5_core_mr *__mlx5_mr_lookup(struct mlx5_core_dev *dev, u | |||
530 | return radix_tree_lookup(&dev->priv.mr_table.tree, key); | 580 | return radix_tree_lookup(&dev->priv.mr_table.tree, key); |
531 | } | 581 | } |
532 | 582 | ||
583 | struct mlx5_page_fault_resume_mbox_in { | ||
584 | struct mlx5_inbox_hdr hdr; | ||
585 | __be32 flags_qpn; | ||
586 | u8 reserved[4]; | ||
587 | }; | ||
588 | |||
589 | struct mlx5_page_fault_resume_mbox_out { | ||
590 | struct mlx5_outbox_hdr hdr; | ||
591 | u8 rsvd[8]; | ||
592 | }; | ||
593 | |||
533 | int mlx5_core_create_qp(struct mlx5_core_dev *dev, | 594 | int mlx5_core_create_qp(struct mlx5_core_dev *dev, |
534 | struct mlx5_core_qp *qp, | 595 | struct mlx5_core_qp *qp, |
535 | struct mlx5_create_qp_mbox_in *in, | 596 | struct mlx5_create_qp_mbox_in *in, |
@@ -549,6 +610,10 @@ void mlx5_init_qp_table(struct mlx5_core_dev *dev); | |||
549 | void mlx5_cleanup_qp_table(struct mlx5_core_dev *dev); | 610 | void mlx5_cleanup_qp_table(struct mlx5_core_dev *dev); |
550 | int mlx5_debug_qp_add(struct mlx5_core_dev *dev, struct mlx5_core_qp *qp); | 611 | int mlx5_debug_qp_add(struct mlx5_core_dev *dev, struct mlx5_core_qp *qp); |
551 | void mlx5_debug_qp_remove(struct mlx5_core_dev *dev, struct mlx5_core_qp *qp); | 612 | void mlx5_debug_qp_remove(struct mlx5_core_dev *dev, struct mlx5_core_qp *qp); |
613 | #ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING | ||
614 | int mlx5_core_page_fault_resume(struct mlx5_core_dev *dev, u32 qpn, | ||
615 | u8 context, int error); | ||
616 | #endif | ||
552 | 617 | ||
553 | static inline const char *mlx5_qp_type_str(int type) | 618 | static inline const char *mlx5_qp_type_str(int type) |
554 | { | 619 | { |