Thread (2 messages) 2 messages, 2 authors, 2021-10-29

Re: [PATCH v4 for-next] RDMA/hns: Add a new mmap implementation

From: Jason Gunthorpe <jgg@nvidia.com>
Date: 2021-10-29 17:08:43

On Thu, Oct 28, 2021 at 06:56:40PM +0800, Wenpeng Liang wrote:
From: Chengchang Tang <tangchengchang@huawei.com>

Add a new implementation for mmap by using the new mmap entry API.

Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Yixing Liu <redacted>
Signed-off-by: Wenpeng Liang <redacted>
---
 drivers/infiniband/hw/hns/hns_roce_device.h |  23 ++++
 drivers/infiniband/hw/hns/hns_roce_main.c   | 142 ++++++++++++++++----
 include/rdma/ib_verbs.h                     |   8 ++
 3 files changed, 146 insertions(+), 27 deletions(-)
Applied to for-next, thanks
+static int hns_roce_mmap(struct ib_ucontext *uctx, struct vm_area_struct *vma)
 {
-	struct hns_roce_dev *hr_dev = to_hr_dev(context->device);
-
-	switch (vma->vm_pgoff) {
-	case 0:
-		return rdma_user_mmap_io(context, vma,
-					 to_hr_ucontext(context)->uar.pfn,
-					 PAGE_SIZE,
-					 pgprot_noncached(vma->vm_page_prot),
-					 NULL);
-
-	/* vm_pgoff: 1 -- TPTR */
-	case 1:
-		if (!hr_dev->tptr_dma_addr || !hr_dev->tptr_size)
-			return -EINVAL;
-		/*
-		 * FIXME: using io_remap_pfn_range on the dma address returned
-		 * by dma_alloc_coherent is totally wrong.
-		 */
-		return rdma_user_mmap_io(context, vma,
-					 hr_dev->tptr_dma_addr >> PAGE_SHIFT,
-					 hr_dev->tptr_size,
-					 vma->vm_page_prot,
-					 NULL);
+	struct hns_roce_dev *hr_dev = to_hr_dev(uctx->device);
+	struct ib_device *ibdev = &hr_dev->ib_dev;
These two variables are unused, I deleted them

Jason
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help