From nobody Sat Sep 26 08:05:23 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2E8F946AEDD; Thu, 3 Sep 2026 11:39:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788435576; cv=none; b=ZvFbX35A/otgDf3iA03IOGpzeGXWn4CM9QAknG5PwCqepWdf1LHvM0nuwvcRapUk2104R2jxoRy7XR7QdRSEOGfHUcdl1FF4Lj4BBnetZE2dSoFqOPw1OrBR6YbPqR42kxg2ksI/QkKBk5pmbY6AUwLnWVXYm+xCxrrLdENY/NQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788435576; c=relaxed/simple; bh=+eGKrjAdf/usdpm9svEeuhgvbqxokZfK9NXaPYOJcjA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=m05L+KvyzPH+GfarH68JFSuUFr8wERb6XfkWaIZWTt5SZHUuHSMVChfr1JbkmHllCZP0QqzTghs5SR76wJIsfcyJ08ZWSPS3xlOF+a49qUuLnTwQ8BplqinB2Nww8Deea8SM+mRXC7K1WsoAAS/E6z6IhIljf8qCZjlKzvQstrc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EinuM/ho; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EinuM/ho" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E74E01F00A3F; Thu, 3 Sep 2026 11:39:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1788435563; bh=SUTZGyWimozvW0WvqmA/xAl8RNSzNd4gpZU4oHnaoho=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=EinuM/hoTq54ofM+oxWfeJOd7SPL5rmpBCvCqCuzKf0j/j1gomGbLieyCnuwm+coQ FVopD5j7+t3SDzZhcv1htA6x7qpqqi90NLEcIypr8G66E0Lkny5fAko44kIddPYTlP MQGjjv41Xmpzo9VFz1aBcEu5zfEQNylemUTFCJwDMtY1dwJGPJtmvfSx+jH/EIp6Go vySZD0MAgSdQdL4Un3fZ1NkSqFMExdSJuQBk1n0YMs3Mu3Joa6UGV4Qobx+nQy7W32 y+VTBgIxOI+LUA+Sd7P7JWicJWGiN6F9MlQEmdYwtWuHWvIvqI4jeCBGSwD1cV4G/E 5sq+gMTfLw+Hg== From: Leon Romanovsky To: Tatyana Nikolova , Jason Gunthorpe , Leon Romanovsky , Mustafa Ismail , Shiraz Saleem Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH rdma-next 1/2] RDMA/irdma: Preserve fast-registration IOVA on 32-bit Date: Thu, 3 Sep 2026 14:38:59 +0300 Message-ID: <20260903-64-bit-iova-is-silently-truncated-to-v1-1-96e878ea6873@nvidia.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260903-64-bit-iova-is-silently-truncated-to-v1-0-96e878ea6873@nvidia.com> References: <20260903-64-bit-iova-is-silently-truncated-to-v1-0-96e878ea6873@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.15-dev-18f8f Content-Transfer-Encoding: quoted-printable From: Leon Romanovsky ib_mr::iova is u64, but the fast-registration path passes it through void * and uintptr_t. These conversions truncate the upper 32 bits on 32-bit kernels before the WQE is built. Store the IOVA as u64 and write it directly to the WQE. The sole caller always uses VA-based addressing, so remove the unused FBO selection and set the VA-based bit unconditionally. Fixes: b48c24c2d710 ("RDMA/irdma: Implement device supported verb APIs") Signed-off-by: Leon Romanovsky Reviewed-by: Jacob Moroni --- drivers/infiniband/hw/irdma/ctrl.c | 6 ++---- drivers/infiniband/hw/irdma/type.h | 4 +--- drivers/infiniband/hw/irdma/verbs.c | 3 +-- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/infiniband/hw/irdma/ctrl.c b/drivers/infiniband/hw/ird= ma/ctrl.c index 335ae3c82e17..7af1c68b2fb2 100644 --- a/drivers/infiniband/hw/irdma/ctrl.c +++ b/drivers/infiniband/hw/irdma/ctrl.c @@ -1723,9 +1723,7 @@ int irdma_sc_mr_fast_register(struct irdma_sc_qp *qp, info->wr_id, wqe_idx, &qp->qp_uk.sq_wrtrk_array[wqe_idx].wrid); =20 - temp =3D (info->addr_type =3D=3D IRDMA_ADDR_TYPE_VA_BASED) ? - (uintptr_t)info->va : info->fbo; - set_64bit_val(wqe, 0, temp); + set_64bit_val(wqe, 0, info->va); =20 temp =3D FIELD_GET(IRDMAQPSQ_FIRSTPMPBLIDXHI, info->first_pm_pbl_index >> 16); @@ -1742,7 +1740,7 @@ int irdma_sc_mr_fast_register(struct irdma_sc_qp *qp, FIELD_PREP(IRDMAQPSQ_LPBLSIZE, info->chunk_size) | FIELD_PREP(IRDMAQPSQ_HPAGESIZE, page_size) | FIELD_PREP(IRDMAQPSQ_STAGRIGHTS, info->access_rights) | - FIELD_PREP(IRDMAQPSQ_VABASEDTO, info->addr_type) | + IRDMAQPSQ_VABASEDTO | FIELD_PREP(IRDMAQPSQ_READFENCE, info->read_fence) | FIELD_PREP(IRDMAQPSQ_LOCALFENCE, info->local_fence) | FIELD_PREP(IRDMAQPSQ_SIGCOMPL, info->signaled) | diff --git a/drivers/infiniband/hw/irdma/type.h b/drivers/infiniband/hw/ird= ma/type.h index 5557d9338796..81c5c5da1988 100644 --- a/drivers/infiniband/hw/irdma/type.h +++ b/drivers/infiniband/hw/irdma/type.h @@ -1173,13 +1173,11 @@ struct irdma_reg_ns_stag_info { struct irdma_fast_reg_stag_info { u64 wr_id; u64 reg_addr_pa; - u64 fbo; - void *va; + u64 va; u64 total_len; u32 page_size; u32 chunk_size; u32 first_pm_pbl_index; - enum irdma_addressing_type addr_type; irdma_stag_index stag_idx; u16 access_rights; u32 pd_id; diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/ir= dma/verbs.c index 9cfd84dd6869..c0a9fc862d43 100644 --- a/drivers/infiniband/hw/irdma/verbs.c +++ b/drivers/infiniband/hw/irdma/verbs.c @@ -4276,8 +4276,7 @@ static int irdma_post_send(struct ib_qp *ibqp, stag_info.stag_idx =3D reg_wr(ib_wr)->key >> 8; stag_info.page_size =3D reg_wr(ib_wr)->mr->page_size; stag_info.wr_id =3D ib_wr->wr_id; - stag_info.addr_type =3D IRDMA_ADDR_TYPE_VA_BASED; - stag_info.va =3D (void *)(uintptr_t)iwmr->ibmr.iova; + stag_info.va =3D iwmr->ibmr.iova; stag_info.total_len =3D iwmr->ibmr.length; stag_info.reg_addr_pa =3D *palloc->level1.addr; stag_info.first_pm_pbl_index =3D palloc->level1.idx; --=20 2.55.0 From nobody Sat Sep 26 08:05:23 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BDF4E49365E; Thu, 3 Sep 2026 11:39:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788435580; cv=none; b=cBuS9x7XfLeb7UcUCcg68+P93fi+14RbqrIFnru/YPJ+gfe9j4JrAzju1DmVIPtBcJcY64Zz+Lqtt2oqd/DehxYxjUpmEvKNsHO8vRsEWs1EO6dqwjJWC+He6vO9VaIANX0M+xJD0Sh5Fzh2lgtxIgOZOs4svZnQmDEApv0aY0E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788435580; c=relaxed/simple; bh=AJIc5N0F/9oRP1GVO7re1aTaqN+tiE6xeHhjPBDj5AE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=SSU9B8J124D5C+geSh5ZXA1cMHnixerIdcsB71K50FsoAMK+X/k2VUKPXIW6s/oSvX68OesexVs/nu7bVrLUaEozrFP6Qz+CkqCndCtwDmTnfOHnnf5jyZUtvmjxzSf9Ygvkk0ZlTHD23uoQwYrehXgGx//5kSGDyl1VthMaZfY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=g7X51+zv; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="g7X51+zv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 186241F00A3A; Thu, 3 Sep 2026 11:39:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1788435559; bh=E2t47qhW08QRVg919yYZxedVwTq3QyOUhueS1OAKMgw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=g7X51+zv1ayBdqd0eM2Omc1MSSokNdyN1FjUm5IWRAaQE/e1wplqZKKrTX/lXdoQ8 RaRZX/e7SmJc/ez06ezdLK4R3TawR/5kKfnip/T6t3miqUVkqtVITiSR8HxCumFPLD BoZnp3a99J87Om3AENw7bwbIol2++66B+Ro0cvspRD+Mqua6Xw1YTGWcMmbiUTpUEk 0XkspHfy459YEiWe7g+dxFXy1K4VfL1C2i38EnG90wwQwDn7bCuMkLgpJA7DHKpU+8 d1/uIfQiF6kzLix3bGDwqpHQNWDlOHM5NZZMhOaeJjsGlp2RAOib+r39wp5/Exp41B j7rXgxut5id5g== From: Leon Romanovsky To: Tatyana Nikolova , Jason Gunthorpe , Leon Romanovsky , Mustafa Ismail , Shiraz Saleem Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH rdma-next 2/2] RDMA/irdma: Remove unused post_sq arguments Date: Thu, 3 Sep 2026 14:39:00 +0300 Message-ID: <20260903-64-bit-iova-is-silently-truncated-to-v1-2-96e878ea6873@nvidia.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260903-64-bit-iova-is-silently-truncated-to-v1-0-96e878ea6873@nvidia.com> References: <20260903-64-bit-iova-is-silently-truncated-to-v1-0-96e878ea6873@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.15-dev-18f8f Content-Transfer-Encoding: quoted-printable From: Leon Romanovsky The only callers of irdma_sc_qp_flush_wqes() and irdma_sc_mr_fast_register() always request their respective send queues to be posted, so their post_sq false branches are unreachable. Remove both arguments and post the queues unconditionally. Drop the redundant QP flush request assignments as well. Signed-off-by: Leon Romanovsky Reviewed-by: Jacob Moroni Reviewed-by: Kalesh AP --- drivers/infiniband/hw/irdma/ctrl.c | 17 +++++------------ drivers/infiniband/hw/irdma/hw.c | 2 -- drivers/infiniband/hw/irdma/protos.h | 3 +-- drivers/infiniband/hw/irdma/type.h | 3 +-- drivers/infiniband/hw/irdma/verbs.c | 4 ++-- 5 files changed, 9 insertions(+), 20 deletions(-) diff --git a/drivers/infiniband/hw/irdma/ctrl.c b/drivers/infiniband/hw/ird= ma/ctrl.c index 7af1c68b2fb2..0db73fd7d01b 100644 --- a/drivers/infiniband/hw/irdma/ctrl.c +++ b/drivers/infiniband/hw/irdma/ctrl.c @@ -1689,11 +1689,9 @@ static int irdma_sc_mw_alloc(struct irdma_sc_dev *de= v, * irdma_sc_mr_fast_register - Posts RDMA fast register mr WR to iwarp qp * @qp: sc qp struct * @info: fast mr info - * @post_sq: flag for cqp db to ring */ int irdma_sc_mr_fast_register(struct irdma_sc_qp *qp, - struct irdma_fast_reg_stag_info *info, - bool post_sq) + struct irdma_fast_reg_stag_info *info) { u64 temp, hdr; __le64 *wqe; @@ -1753,8 +1751,7 @@ int irdma_sc_mr_fast_register(struct irdma_sc_qp *qp, print_hex_dump_debug("WQE: FAST_REG WQE", DUMP_PREFIX_OFFSET, 16, 8, wqe, IRDMA_QP_WQE_MIN_SIZE, false); =20 - if (post_sq) - irdma_uk_qp_post_wr(&qp->qp_uk); + irdma_uk_qp_post_wr(&qp->qp_uk); =20 return 0; } @@ -2623,11 +2620,9 @@ static int irdma_sc_manage_ws_node(struct irdma_sc_c= qp *cqp, * @qp: sc qp * @info: dlush information * @scratch: u64 saved to be used during cqp completion - * @post_sq: flag for cqp db to ring */ int irdma_sc_qp_flush_wqes(struct irdma_sc_qp *qp, - struct irdma_qp_flush_info *info, u64 scratch, - bool post_sq) + struct irdma_qp_flush_info *info, u64 scratch) { u64 temp =3D 0; __le64 *wqe; @@ -2695,8 +2690,7 @@ int irdma_sc_qp_flush_wqes(struct irdma_sc_qp *qp, =20 print_hex_dump_debug("WQE: QP_FLUSH WQE", DUMP_PREFIX_OFFSET, 16, 8, wqe, IRDMA_CQP_WQE_SIZE * 8, false); - if (post_sq) - irdma_sc_cqp_post_sq(cqp); + irdma_sc_cqp_post_sq(cqp); =20 return 0; } @@ -6112,8 +6106,7 @@ static int irdma_exec_cqp_cmd(struct irdma_sc_dev *de= v, case IRDMA_OP_QP_FLUSH_WQES: status =3D irdma_sc_qp_flush_wqes(pcmdinfo->in.u.qp_flush_wqes.qp, &pcmdinfo->in.u.qp_flush_wqes.info, - pcmdinfo->in.u.qp_flush_wqes.scratch, - pcmdinfo->post_sq); + pcmdinfo->in.u.qp_flush_wqes.scratch); break; case IRDMA_OP_GEN_AE: status =3D irdma_sc_gen_ae(pcmdinfo->in.u.gen_ae.qp, diff --git a/drivers/infiniband/hw/irdma/hw.c b/drivers/infiniband/hw/irdma= /hw.c index c345cc654256..cae4f316def4 100644 --- a/drivers/infiniband/hw/irdma/hw.c +++ b/drivers/infiniband/hw/irdma/hw.c @@ -2742,7 +2742,6 @@ int irdma_hw_flush_wqes(struct irdma_pci_f *rf, struc= t irdma_sc_qp *qp, hw_info =3D &cqp_request->info.in.u.qp_flush_wqes.info; memcpy(hw_info, info, sizeof(*hw_info)); cqp_info->cqp_cmd =3D IRDMA_OP_QP_FLUSH_WQES; - cqp_info->post_sq =3D 1; cqp_info->in.u.qp_flush_wqes.qp =3D qp; cqp_info->in.u.qp_flush_wqes.scratch =3D (uintptr_t)cqp_request; status =3D irdma_handle_cqp_op(rf, cqp_request); @@ -2789,7 +2788,6 @@ int irdma_hw_flush_wqes(struct irdma_pci_f *rf, struc= t irdma_sc_qp *qp, hw_info =3D &new_req->info.in.u.qp_flush_wqes.info; memcpy(hw_info, info, sizeof(*hw_info)); cqp_info->cqp_cmd =3D IRDMA_OP_QP_FLUSH_WQES; - cqp_info->post_sq =3D 1; cqp_info->in.u.qp_flush_wqes.qp =3D qp; cqp_info->in.u.qp_flush_wqes.scratch =3D (uintptr_t)new_req; =20 diff --git a/drivers/infiniband/hw/irdma/protos.h b/drivers/infiniband/hw/i= rdma/protos.h index 324cfbf21764..561a0287b945 100644 --- a/drivers/infiniband/hw/irdma/protos.h +++ b/drivers/infiniband/hw/irdma/protos.h @@ -19,8 +19,7 @@ void irdma_sc_rt_init(struct irdma_sc_dev *dev); void irdma_sc_cqp_post_sq(struct irdma_sc_cqp *cqp); __le64 *irdma_sc_cqp_get_next_send_wqe(struct irdma_sc_cqp *cqp, u64 scrat= ch); int irdma_sc_mr_fast_register(struct irdma_sc_qp *qp, - struct irdma_fast_reg_stag_info *info, - bool post_sq); + struct irdma_fast_reg_stag_info *info); /* HMC/FPM functions */ int irdma_sc_init_iw_hmc(struct irdma_sc_dev *dev, u8 hmc_fn_id); /* stats misc */ diff --git a/drivers/infiniband/hw/irdma/type.h b/drivers/infiniband/hw/ird= ma/type.h index 81c5c5da1988..8b4d2c0b283f 100644 --- a/drivers/infiniband/hw/irdma/type.h +++ b/drivers/infiniband/hw/irdma/type.h @@ -1381,8 +1381,7 @@ int irdma_sc_qp_create(struct irdma_sc_qp *qp, int irdma_sc_qp_destroy(struct irdma_sc_qp *qp, u64 scratch, bool remove_hash_idx, bool ignore_mw_bnd, bool post_sq); int irdma_sc_qp_flush_wqes(struct irdma_sc_qp *qp, - struct irdma_qp_flush_info *info, u64 scratch, - bool post_sq); + struct irdma_qp_flush_info *info, u64 scratch); int irdma_sc_qp_init(struct irdma_sc_qp *qp, struct irdma_qp_init_info *in= fo); int irdma_sc_qp_modify(struct irdma_sc_qp *qp, struct irdma_modify_qp_info *info, u64 scratch, diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/ir= dma/verbs.c index c0a9fc862d43..7d3540824e3a 100644 --- a/drivers/infiniband/hw/irdma/verbs.c +++ b/drivers/infiniband/hw/irdma/verbs.c @@ -4283,8 +4283,8 @@ static int irdma_post_send(struct ib_qp *ibqp, stag_info.local_fence =3D ib_wr->send_flags & IB_SEND_FENCE; if (iwmr->npages > IRDMA_MIN_PAGES_PER_FMR) stag_info.chunk_size =3D 1; - err =3D irdma_sc_mr_fast_register(&iwqp->sc_qp, &stag_info, - true); + err =3D irdma_sc_mr_fast_register(&iwqp->sc_qp, + &stag_info); break; } default: --=20 2.55.0