Lines Matching refs:umem
63 static struct mlx5_ib_mr *reg_create(struct ib_pd *pd, struct ib_umem *umem,
823 mr->umem = NULL; in mlx5_ib_get_dma_mr()
921 static unsigned int mlx5_umem_dmabuf_default_pgsz(struct ib_umem *umem, in mlx5_umem_dmabuf_default_pgsz() argument
928 umem->iova = iova; in mlx5_umem_dmabuf_default_pgsz()
933 struct ib_umem *umem, u64 iova, in alloc_cacheable_mr() argument
941 if (umem->is_dmabuf) in alloc_cacheable_mr()
942 page_size = mlx5_umem_dmabuf_default_pgsz(umem, iova); in alloc_cacheable_mr()
944 page_size = mlx5_umem_find_best_pgsz(umem, mkc, log_page_size, in alloc_cacheable_mr()
949 dev, order_base_2(ib_umem_num_dma_blocks(umem, page_size))); in alloc_cacheable_mr()
957 mr = reg_create(pd, umem, iova, access_flags, page_size, false); in alloc_cacheable_mr()
974 mr->umem = umem; in alloc_cacheable_mr()
976 set_mr_fields(dev, mr, umem->length, access_flags, iova); in alloc_cacheable_mr()
1141 if (WARN_ON(!mr->umem->is_odp)) in mlx5_ib_update_xlt()
1160 struct ib_umem_odp *odp = to_ib_umem_odp(mr->umem); in mlx5_ib_update_xlt()
1212 if (WARN_ON(mr->umem->is_odp)) in mlx5_ib_update_mr_pas()
1216 ib_umem_num_dma_blocks(mr->umem, in mlx5_ib_update_mr_pas()
1224 rdma_for_each_block (mr->umem->sgt_append.sgt.sgl, &biter, in mlx5_ib_update_mr_pas()
1225 mr->umem->sgt_append.sgt.nents, in mlx5_ib_update_mr_pas()
1243 if (mr->umem->is_dmabuf && (flags & MLX5_IB_UPD_XLT_ZAP)) in mlx5_ib_update_mr_pas()
1268 static struct mlx5_ib_mr *reg_create(struct ib_pd *pd, struct ib_umem *umem, in reg_create() argument
1294 roundup(ib_umem_num_dma_blocks(umem, page_size), 2); in reg_create()
1306 mlx5_ib_populate_pas(umem, 1UL << mr->page_shift, pas, in reg_create()
1321 MLX5_SET64(mkc, mkc, len, umem->length); in reg_create()
1324 get_octo_len(iova, umem->length, mr->page_shift)); in reg_create()
1328 get_octo_len(iova, umem->length, mr->page_shift)); in reg_create()
1337 mr->umem = umem; in reg_create()
1338 set_mr_fields(dev, mr, umem->length, access_flags, iova); in reg_create()
1446 static struct ib_mr *create_real_mr(struct ib_pd *pd, struct ib_umem *umem, in create_real_mr() argument
1454 xlt_with_umr = mlx5_ib_can_load_pas_with_umr(dev, umem->length); in create_real_mr()
1456 mr = alloc_cacheable_mr(pd, umem, iova, access_flags); in create_real_mr()
1459 umem, mkc, log_page_size, 0, iova); in create_real_mr()
1462 mr = reg_create(pd, umem, iova, access_flags, page_size, true); in create_real_mr()
1466 ib_umem_release(umem); in create_real_mr()
1472 atomic_add(ib_umem_num_pages(umem), &dev->mdev->priv.reg_pages); in create_real_mr()
1525 mr = alloc_cacheable_mr(pd, &odp->umem, iova, access_flags); in create_user_odp_mr()
1527 ib_umem_release(&odp->umem); in create_user_odp_mr()
1552 struct ib_umem *umem; in mlx5_ib_reg_user_mr() local
1563 umem = ib_umem_get(&dev->ib_dev, start, length, access_flags); in mlx5_ib_reg_user_mr()
1564 if (IS_ERR(umem)) in mlx5_ib_reg_user_mr()
1565 return ERR_CAST(umem); in mlx5_ib_reg_user_mr()
1566 return create_real_mr(pd, umem, iova, access_flags); in mlx5_ib_reg_user_mr()
1619 mr = alloc_cacheable_mr(pd, &umem_dmabuf->umem, virt_addr, in mlx5_ib_reg_user_mr_dmabuf()
1622 ib_umem_release(&umem_dmabuf->umem); in mlx5_ib_reg_user_mr_dmabuf()
1628 atomic_add(ib_umem_num_pages(mr->umem), &dev->mdev->priv.reg_pages); in mlx5_ib_reg_user_mr_dmabuf()
1737 struct ib_umem *old_umem = mr->umem; in umr_rereg_pas()
1762 mr->umem = new_umem; in umr_rereg_pas()
1769 mr->umem = old_umem; in umr_rereg_pas()
1805 struct ib_umem *umem; in mlx5_ib_rereg_user_mr() local
1816 if (!mr->umem || is_odp_mr(mr) || is_dmabuf_mr(mr)) in mlx5_ib_rereg_user_mr()
1826 umem = mr->umem; in mlx5_ib_rereg_user_mr()
1827 mr->umem = NULL; in mlx5_ib_rereg_user_mr()
1828 atomic_sub(ib_umem_num_pages(umem), &dev->mdev->priv.reg_pages); in mlx5_ib_rereg_user_mr()
1830 return create_real_mr(new_pd, umem, mr->ibmr.iova, in mlx5_ib_rereg_user_mr()
1838 if (!mr->umem || is_odp_mr(mr) || is_dmabuf_mr(mr)) in mlx5_ib_rereg_user_mr()
1910 if (!mr->umem && mr->descs) { in mlx5_free_priv_descs()
1981 if (mr->umem) { in mlx5_ib_dereg_mr()
1985 atomic_sub(ib_umem_num_pages(mr->umem), in mlx5_ib_dereg_mr()
1987 ib_umem_release(mr->umem); in mlx5_ib_dereg_mr()
2082 mr->umem = NULL; in mlx5_ib_alloc_pi_mr()
2209 mr->umem = NULL; in __mlx5_ib_alloc_mr()