From patchwork Fri Aug 30 15:16:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Long Li X-Patchwork-Id: 13785236 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 33CCBEACD; Fri, 30 Aug 2024 15:16:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725031004; cv=none; b=S3GJae06i+Zes7vweoXPDdFsa5IC8U1aBVYeW/BCEX2LRDl5/K4xuEw2bZNJpx0ww25TGz5Y3vtxbjP1UNMZ92VLIi31QwRD2Moqeoan2Z6NaUUCHnubpeEI71U22CGJYZvJxVKwrCY3ho6LokHm9fQWP5V1+Hr8Gp69ff0h7ko= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725031004; c=relaxed/simple; bh=g+wXH8diiArOpiFAZ4p7I2LZkyYLwQaQGlmBFwZYjuc=; h=From:To:Cc:Subject:Date:Message-Id; b=U2p2mSkaSSARm15xmsz2pGSXW38KTOc1pi4sYYGkRgv64NdW6iHYwgQjn9+UMA0q/9+tTy6gJI7lwrt90HmbwoVOjIDQf5Ai0LrMJPDTgPn9vDJ4rPnda9rLKP2V5mYc1BMl88qUgf2nd/zRSS0BJmkHf8BPQyVmzMhvVd6Gt4U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxonhyperv.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linuxonhyperv.com header.i=@linuxonhyperv.com header.b=ZqDrwNMT; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxonhyperv.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxonhyperv.com header.i=@linuxonhyperv.com header.b="ZqDrwNMT" Received: by linux.microsoft.com (Postfix, from userid 1202) id C1E3620B7165; Fri, 30 Aug 2024 08:16:37 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com C1E3620B7165 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxonhyperv.com; s=default; t=1725030997; bh=yWbH6WERHo/4P/dpJi9ViKZqC7UJeDZwqOXbc7gy6wk=; h=From:To:Cc:Subject:Date:Reply-To:From; b=ZqDrwNMT1yoU9oOzVJS3bkdFYKkOPkbUBu/ibtuvzsr4daMePaN/V4sPei71zDw7y JNjvAbws9yFzO4RTVQ7OEbkutm8qIy1uiv6/qpCIA5KYWRyKg337W8yKGTnbyed0Nd S/rlrZoLKps4RBIHjFVmbP3ncmphk8A8JJ/YzNgM= From: longli@linuxonhyperv.com To: Jason Gunthorpe , Leon Romanovsky , Ajay Sharma , Konstantin Taranov , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-rdma@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Long Li , stable@vger.kernel.org Subject: [PATCH rdma-next v2 1/2] RDMA/mana_ib: use the correct page table index based on hardware page size Date: Fri, 30 Aug 2024 08:16:32 -0700 Message-Id: <1725030993-16213-1-git-send-email-longli@linuxonhyperv.com> X-Mailer: git-send-email 1.8.3.1 Reply-To: longli@microsoft.com Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: Long Li MANA hardware uses 4k page size. When calculating the page table index, it should use the hardware page size, not the system page size. Cc: stable@vger.kernel.org Fixes: 0266a177631d ("RDMA/mana_ib: Add a driver for Microsoft Azure Network Adapter") Signed-off-by: Long Li --- change log v2: replaced net with rdma-next tag in patch title and simplified the title drivers/infiniband/hw/mana/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/mana/main.c b/drivers/infiniband/hw/mana/main.c index d13abc954d2a..f68f54aea820 100644 --- a/drivers/infiniband/hw/mana/main.c +++ b/drivers/infiniband/hw/mana/main.c @@ -383,7 +383,7 @@ static int mana_ib_gd_create_dma_region(struct mana_ib_dev *dev, struct ib_umem create_req->length = umem->length; create_req->offset_in_page = ib_umem_dma_offset(umem, page_sz); - create_req->gdma_page_type = order_base_2(page_sz) - PAGE_SHIFT; + create_req->gdma_page_type = order_base_2(page_sz) - MANA_PAGE_SHIFT; create_req->page_count = num_pages_total; ibdev_dbg(&dev->ib_dev, "size_dma_region %lu num_pages_total %lu\n", From patchwork Fri Aug 30 15:16:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Long Li X-Patchwork-Id: 13785237 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 431781B4C29; Fri, 30 Aug 2024 15:16:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725031006; cv=none; b=CPqbSMKmslEZHzXobJtomFyBt0m8cgT9F/Y509OtE08sL96awcFigRd/i8QOednUz6c7tjxcXXGWJHRox9FnvUkrecJQC1uTei1Cecf5yKI4+5ImWFT4WRJfo0aoHQhe5/yHP3e1FmHuNgcNwVj04LZW4msZ4q+en+if4YKPoZE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725031006; c=relaxed/simple; bh=L7Iu5qwM3GJ5quJn8zLnlihhTtlRQpg9g81Gl2sLvpc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=NYzOL3TgezZQorTVgtQKteup1CiQ2SVjrnVJJjY0tXH+f/ehjEGaeTws4XCk/4HD4x05ST7trZDHewKxn/rsLFtzAyARsgFClosSlF8sXSglDfo3OomRTF7EGPRIW33q5TEiYe69RS31nlYdYGnt8OaMsMLDZnQP6ww/NPEdfy4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxonhyperv.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linuxonhyperv.com header.i=@linuxonhyperv.com header.b=WwYUfFfy; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxonhyperv.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxonhyperv.com header.i=@linuxonhyperv.com header.b="WwYUfFfy" Received: by linux.microsoft.com (Postfix, from userid 1202) id F310620B7123; Fri, 30 Aug 2024 08:16:38 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com F310620B7123 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxonhyperv.com; s=default; t=1725030999; bh=H+SUfZWshjMk9JAvgxKvB0iP3y3vfzyhaaXS/SuOMWk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:From; b=WwYUfFfyBNVsIlYmk03V17hDAtLb1AjVVqOm69JbUg3QDbv64PXgfiiH/h1V94zI7 yQQrDixfiM5k2gL0JTxyXOwKWZZE0ku7qCmmcIZzPO1rPJu4eLBj4PrUkJxT8BxL1P fk0HhOqVxzUvtCCe3U8ynvYhZKkWJ+Qrf9PT+6yA= From: longli@linuxonhyperv.com To: Jason Gunthorpe , Leon Romanovsky , Ajay Sharma , Konstantin Taranov , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-rdma@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Long Li , stable@vger.kernel.org Subject: [PATCH rdma-next v2 2/2] RDMA/mana_ib: use the correct page size for mapping user-mode doorbell page Date: Fri, 30 Aug 2024 08:16:33 -0700 Message-Id: <1725030993-16213-2-git-send-email-longli@linuxonhyperv.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1725030993-16213-1-git-send-email-longli@linuxonhyperv.com> References: <1725030993-16213-1-git-send-email-longli@linuxonhyperv.com> Reply-To: longli@microsoft.com Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: Long Li When mapping doorbell page from user-mode, the driver should use the system page size as this memory is allocated via mmap() from user-mode. Cc: stable@vger.kernel.org Fixes: 0266a177631d ("RDMA/mana_ib: Add a driver for Microsoft Azure Network Adapter") Signed-off-by: Long Li --- change log v2: used rdma-next tag in patch title. fixed printk format identifier for unsigned long. drivers/infiniband/hw/mana/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/hw/mana/main.c b/drivers/infiniband/hw/mana/main.c index f68f54aea820..67c2d43135a8 100644 --- a/drivers/infiniband/hw/mana/main.c +++ b/drivers/infiniband/hw/mana/main.c @@ -511,13 +511,13 @@ int mana_ib_mmap(struct ib_ucontext *ibcontext, struct vm_area_struct *vma) PAGE_SHIFT; prot = pgprot_writecombine(vma->vm_page_prot); - ret = rdma_user_mmap_io(ibcontext, vma, pfn, gc->db_page_size, prot, + ret = rdma_user_mmap_io(ibcontext, vma, pfn, PAGE_SIZE, prot, NULL); if (ret) ibdev_dbg(ibdev, "can't rdma_user_mmap_io ret %d\n", ret); else - ibdev_dbg(ibdev, "mapped I/O pfn 0x%llx page_size %u, ret %d\n", - pfn, gc->db_page_size, ret); + ibdev_dbg(ibdev, "mapped I/O pfn 0x%llx page_size %lu, ret %d\n", + pfn, PAGE_SIZE, ret); return ret; }