From 730f31698eaff9626da4c1820e959f47d690c9a7 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 26 Jan 2024 17:22:11 -0800 Subject: [PATCH] 5.15-stable patches added patches: rdma-irdma-ensure-iwarp-qp-queue-memory-is-os-paged-aligned.patch rdma-irdma-fix-support-for-64k-pages.patch --- ...-qp-queue-memory-is-os-paged-aligned.patch | 40 +++++++++++++++++++ ...rdma-irdma-fix-support-for-64k-pages.patch | 36 +++++++++++++++++ queue-5.15/series | 2 + 3 files changed, 78 insertions(+) create mode 100644 queue-5.15/rdma-irdma-ensure-iwarp-qp-queue-memory-is-os-paged-aligned.patch create mode 100644 queue-5.15/rdma-irdma-fix-support-for-64k-pages.patch diff --git a/queue-5.15/rdma-irdma-ensure-iwarp-qp-queue-memory-is-os-paged-aligned.patch b/queue-5.15/rdma-irdma-ensure-iwarp-qp-queue-memory-is-os-paged-aligned.patch new file mode 100644 index 00000000000..b0f738ffa01 --- /dev/null +++ b/queue-5.15/rdma-irdma-ensure-iwarp-qp-queue-memory-is-os-paged-aligned.patch @@ -0,0 +1,40 @@ +From 0a5ec366de7e94192669ba08de6ed336607fd282 Mon Sep 17 00:00:00 2001 +From: Mike Marciniszyn +Date: Wed, 29 Nov 2023 14:21:42 -0600 +Subject: RDMA/irdma: Ensure iWarp QP queue memory is OS paged aligned + +From: Mike Marciniszyn + +commit 0a5ec366de7e94192669ba08de6ed336607fd282 upstream. + +The SQ is shared for between kernel and used by storing the kernel page +pointer and passing that to a kmap_atomic(). + +This then requires that the alignment is PAGE_SIZE aligned. + +Fix by adding an iWarp specific alignment check. + +Fixes: e965ef0e7b2c ("RDMA/irdma: Split QP handler into irdma_reg_user_mr_type_qp") +Link: https://lore.kernel.org/r/20231129202143.1434-3-shiraz.saleem@intel.com +Signed-off-by: Mike Marciniszyn +Signed-off-by: Shiraz Saleem +Signed-off-by: Jason Gunthorpe +Signed-off-by: Greg Kroah-Hartman +--- + drivers/infiniband/hw/irdma/verbs.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/infiniband/hw/irdma/verbs.c ++++ b/drivers/infiniband/hw/irdma/verbs.c +@@ -2797,6 +2797,11 @@ static struct ib_mr *irdma_reg_user_mr(s + + switch (req.reg_type) { + case IRDMA_MEMREG_TYPE_QP: ++ /* iWarp: Catch page not starting on OS page boundary */ ++ if (!rdma_protocol_roce(&iwdev->ibdev, 1) && ++ ib_umem_offset(iwmr->region)) ++ return -EINVAL; ++ + total = req.sq_pages + req.rq_pages + shadow_pgcnt; + if (total > iwmr->page_cnt) { + err = -EINVAL; diff --git a/queue-5.15/rdma-irdma-fix-support-for-64k-pages.patch b/queue-5.15/rdma-irdma-fix-support-for-64k-pages.patch new file mode 100644 index 00000000000..054b464003a --- /dev/null +++ b/queue-5.15/rdma-irdma-fix-support-for-64k-pages.patch @@ -0,0 +1,36 @@ +From 03769f72d66edab82484449ed594cb6b00ae0223 Mon Sep 17 00:00:00 2001 +From: Mike Marciniszyn +Date: Wed, 29 Nov 2023 14:21:43 -0600 +Subject: RDMA/irdma: Fix support for 64k pages + +From: Mike Marciniszyn + +commit 03769f72d66edab82484449ed594cb6b00ae0223 upstream. + +Virtual QP and CQ require a 4K HW page size but the driver passes +PAGE_SIZE to ib_umem_find_best_pgsz() instead. + +Fix this by using the appropriate 4k value in the bitmap passed to +ib_umem_find_best_pgsz(). + +Fixes: 693a5386eff0 ("RDMA/irdma: Split mr alloc and free into new functions") +Link: https://lore.kernel.org/r/20231129202143.1434-4-shiraz.saleem@intel.com +Signed-off-by: Mike Marciniszyn +Signed-off-by: Shiraz Saleem +Signed-off-by: Jason Gunthorpe +Signed-off-by: Greg Kroah-Hartman +--- + drivers/infiniband/hw/irdma/verbs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/infiniband/hw/irdma/verbs.c ++++ b/drivers/infiniband/hw/irdma/verbs.c +@@ -2777,7 +2777,7 @@ static struct ib_mr *irdma_reg_user_mr(s + iwmr->ibmr.pd = pd; + iwmr->ibmr.device = pd->device; + iwmr->ibmr.iova = virt; +- iwmr->page_size = PAGE_SIZE; ++ iwmr->page_size = SZ_4K;; + + if (req.reg_type == IRDMA_MEMREG_TYPE_MEM) { + iwmr->page_size = ib_umem_find_best_pgsz(region, diff --git a/queue-5.15/series b/queue-5.15/series index 467b1dc71cf..f254c645d93 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -45,3 +45,5 @@ ksmbd-fix-potential-circular-locking-issue-in-smb2_set_ea.patch ksmbd-don-t-increment-epoch-if-current-state-and-request-state-are-same.patch ksmbd-send-lease-break-notification-on-file_rename_information.patch ksmbd-add-missing-set_freezable-for-freezable-kthread.patch +rdma-irdma-ensure-iwarp-qp-queue-memory-is-os-paged-aligned.patch +rdma-irdma-fix-support-for-64k-pages.patch -- 2.47.3