diff options
Diffstat (limited to 'include/rdma/ib_verbs.h')
-rw-r--r-- | include/rdma/ib_verbs.h | 54 |
1 files changed, 51 insertions, 3 deletions
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 470a011d6fa4..0d74f1de99aa 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h | |||
@@ -51,6 +51,7 @@ | |||
51 | #include <uapi/linux/if_ether.h> | 51 | #include <uapi/linux/if_ether.h> |
52 | 52 | ||
53 | #include <linux/atomic.h> | 53 | #include <linux/atomic.h> |
54 | #include <linux/mmu_notifier.h> | ||
54 | #include <asm/uaccess.h> | 55 | #include <asm/uaccess.h> |
55 | 56 | ||
56 | extern struct workqueue_struct *ib_wq; | 57 | extern struct workqueue_struct *ib_wq; |
@@ -123,7 +124,8 @@ enum ib_device_cap_flags { | |||
123 | IB_DEVICE_MEM_WINDOW_TYPE_2A = (1<<23), | 124 | IB_DEVICE_MEM_WINDOW_TYPE_2A = (1<<23), |
124 | IB_DEVICE_MEM_WINDOW_TYPE_2B = (1<<24), | 125 | IB_DEVICE_MEM_WINDOW_TYPE_2B = (1<<24), |
125 | IB_DEVICE_MANAGED_FLOW_STEERING = (1<<29), | 126 | IB_DEVICE_MANAGED_FLOW_STEERING = (1<<29), |
126 | IB_DEVICE_SIGNATURE_HANDOVER = (1<<30) | 127 | IB_DEVICE_SIGNATURE_HANDOVER = (1<<30), |
128 | IB_DEVICE_ON_DEMAND_PAGING = (1<<31), | ||
127 | }; | 129 | }; |
128 | 130 | ||
129 | enum ib_signature_prot_cap { | 131 | enum ib_signature_prot_cap { |
@@ -143,6 +145,27 @@ enum ib_atomic_cap { | |||
143 | IB_ATOMIC_GLOB | 145 | IB_ATOMIC_GLOB |
144 | }; | 146 | }; |
145 | 147 | ||
148 | enum ib_odp_general_cap_bits { | ||
149 | IB_ODP_SUPPORT = 1 << 0, | ||
150 | }; | ||
151 | |||
152 | enum ib_odp_transport_cap_bits { | ||
153 | IB_ODP_SUPPORT_SEND = 1 << 0, | ||
154 | IB_ODP_SUPPORT_RECV = 1 << 1, | ||
155 | IB_ODP_SUPPORT_WRITE = 1 << 2, | ||
156 | IB_ODP_SUPPORT_READ = 1 << 3, | ||
157 | IB_ODP_SUPPORT_ATOMIC = 1 << 4, | ||
158 | }; | ||
159 | |||
160 | struct ib_odp_caps { | ||
161 | uint64_t general_caps; | ||
162 | struct { | ||
163 | uint32_t rc_odp_caps; | ||
164 | uint32_t uc_odp_caps; | ||
165 | uint32_t ud_odp_caps; | ||
166 | } per_transport_caps; | ||
167 | }; | ||
168 | |||
146 | struct ib_device_attr { | 169 | struct ib_device_attr { |
147 | u64 fw_ver; | 170 | u64 fw_ver; |
148 | __be64 sys_image_guid; | 171 | __be64 sys_image_guid; |
@@ -186,6 +209,7 @@ struct ib_device_attr { | |||
186 | u8 local_ca_ack_delay; | 209 | u8 local_ca_ack_delay; |
187 | int sig_prot_cap; | 210 | int sig_prot_cap; |
188 | int sig_guard_cap; | 211 | int sig_guard_cap; |
212 | struct ib_odp_caps odp_caps; | ||
189 | }; | 213 | }; |
190 | 214 | ||
191 | enum ib_mtu { | 215 | enum ib_mtu { |
@@ -1073,7 +1097,8 @@ enum ib_access_flags { | |||
1073 | IB_ACCESS_REMOTE_READ = (1<<2), | 1097 | IB_ACCESS_REMOTE_READ = (1<<2), |
1074 | IB_ACCESS_REMOTE_ATOMIC = (1<<3), | 1098 | IB_ACCESS_REMOTE_ATOMIC = (1<<3), |
1075 | IB_ACCESS_MW_BIND = (1<<4), | 1099 | IB_ACCESS_MW_BIND = (1<<4), |
1076 | IB_ZERO_BASED = (1<<5) | 1100 | IB_ZERO_BASED = (1<<5), |
1101 | IB_ACCESS_ON_DEMAND = (1<<6), | ||
1077 | }; | 1102 | }; |
1078 | 1103 | ||
1079 | struct ib_phys_buf { | 1104 | struct ib_phys_buf { |
@@ -1115,6 +1140,8 @@ struct ib_fmr_attr { | |||
1115 | u8 page_shift; | 1140 | u8 page_shift; |
1116 | }; | 1141 | }; |
1117 | 1142 | ||
1143 | struct ib_umem; | ||
1144 | |||
1118 | struct ib_ucontext { | 1145 | struct ib_ucontext { |
1119 | struct ib_device *device; | 1146 | struct ib_device *device; |
1120 | struct list_head pd_list; | 1147 | struct list_head pd_list; |
@@ -1127,6 +1154,24 @@ struct ib_ucontext { | |||
1127 | struct list_head xrcd_list; | 1154 | struct list_head xrcd_list; |
1128 | struct list_head rule_list; | 1155 | struct list_head rule_list; |
1129 | int closing; | 1156 | int closing; |
1157 | |||
1158 | struct pid *tgid; | ||
1159 | #ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING | ||
1160 | struct rb_root umem_tree; | ||
1161 | /* | ||
1162 | * Protects .umem_rbroot and tree, as well as odp_mrs_count and | ||
1163 | * mmu notifiers registration. | ||
1164 | */ | ||
1165 | struct rw_semaphore umem_rwsem; | ||
1166 | void (*invalidate_range)(struct ib_umem *umem, | ||
1167 | unsigned long start, unsigned long end); | ||
1168 | |||
1169 | struct mmu_notifier mn; | ||
1170 | atomic_t notifier_count; | ||
1171 | /* A list of umems that don't have private mmu notifier counters yet. */ | ||
1172 | struct list_head no_private_counters; | ||
1173 | int odp_mrs_count; | ||
1174 | #endif | ||
1130 | }; | 1175 | }; |
1131 | 1176 | ||
1132 | struct ib_uobject { | 1177 | struct ib_uobject { |
@@ -1662,7 +1707,10 @@ static inline int ib_copy_from_udata(void *dest, struct ib_udata *udata, size_t | |||
1662 | 1707 | ||
1663 | static inline int ib_copy_to_udata(struct ib_udata *udata, void *src, size_t len) | 1708 | static inline int ib_copy_to_udata(struct ib_udata *udata, void *src, size_t len) |
1664 | { | 1709 | { |
1665 | return copy_to_user(udata->outbuf, src, len) ? -EFAULT : 0; | 1710 | size_t copy_sz; |
1711 | |||
1712 | copy_sz = min_t(size_t, len, udata->outlen); | ||
1713 | return copy_to_user(udata->outbuf, src, copy_sz) ? -EFAULT : 0; | ||
1666 | } | 1714 | } |
1667 | 1715 | ||
1668 | /** | 1716 | /** |