linux/drivers/infiniband/hw
Jason Gunthorpe 8ffc324851 RDMA/mlx5: Fix handling of IOVA != user_va in ODP paths
Till recently it was not possible for userspace to specify a different
IOVA, but with the new ibv_reg_mr_iova() library call this can be done.

To compute the user_va we must compute:
  user_va = (iova - iova_start) + user_va_start

while being cautious of overflow and other math problems.

The iova is not reliably stored in the mmkey when the MR is created. Only
the cached creation path (the common one) set it, so it must also be set
when creating uncached MRs.

Fix the weird use of iova when computing the starting page index in the
MR. In the normal case, when iova == umem.address:
  iova & (~(BIT(page_shift) - 1)) ==
  ALIGN_DOWN(umem.address, odp->page_size) ==
  ib_umem_start(odp)

And when iova is different using it in math with a user_va is wrong.

Finally, do not allow an implicit ODP to be created with a non-zero IOVA
as we have no support for that.

Fixes: 7bdf65d411 ("IB/mlx5: Handle page faults")
Signed-off-by: Moni Shoua <monis@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
2020-01-16 16:15:07 +02:00
..
bnxt_re IB: Allow calls to ib_umem_get from kernel ULPs 2020-01-16 16:14:28 +02:00
cxgb4 IB: Allow calls to ib_umem_get from kernel ULPs 2020-01-16 16:14:28 +02:00
efa IB/core: Introduce ib_reg_user_mr 2020-01-16 16:14:36 +02:00
hfi1 IB/hfi1: Adjust flow PSN with the correct resync_psn 2020-01-03 16:48:01 -04:00
hns IB: Allow calls to ib_umem_get from kernel ULPs 2020-01-16 16:14:28 +02:00
i40iw IB/core: Introduce ib_reg_user_mr 2020-01-16 16:14:36 +02:00
mlx4 IB: Allow calls to ib_umem_get from kernel ULPs 2020-01-16 16:14:28 +02:00
mlx5 RDMA/mlx5: Fix handling of IOVA != user_va in ODP paths 2020-01-16 16:15:07 +02:00
mthca IB: Allow calls to ib_umem_get from kernel ULPs 2020-01-16 16:14:28 +02:00
ocrdma IB: Allow calls to ib_umem_get from kernel ULPs 2020-01-16 16:14:28 +02:00
qedr IB: Allow calls to ib_umem_get from kernel ULPs 2020-01-16 16:14:28 +02:00
qib RDMA/qib: Validate ->show()/store() callbacks before calling them 2019-11-14 11:49:15 -04:00
usnic mm/gup: add make_dirty arg to put_user_pages_dirty_lock() 2019-09-24 15:54:08 -07:00
vmw_pvrdma IB: Allow calls to ib_umem_get from kernel ULPs 2020-01-16 16:14:28 +02:00
Makefile RDMA/iw_cxgb3: Remove the iw_cxgb3 module from kernel 2019-10-04 15:08:59 -03:00