From patchwork Mon Oct 24 11:30:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9632 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp532255wru; Mon, 24 Oct 2022 09:07:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Koc4qwgTjkQ9eeO1aNpU0Lh5x5ohvlCdRk+M4KGPXnULK+HRQeG8wC4VDBZ73Mra7OHwa X-Received: by 2002:a17:907:d04:b0:76e:e208:27ba with SMTP id gn4-20020a1709070d0400b0076ee20827bamr29378204ejc.652.1666627664265; Mon, 24 Oct 2022 09:07:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627664; cv=none; d=google.com; s=arc-20160816; b=IF1QWGMzHIhRyx3GQfyZ6ptSk/KfdaApJWZxse5oubadfI1066br+JYi2mGecXkLWG ZMMLr/96W11+reQyXOldw+YO6kNVQhHOEaHy5thCOu5yUEhIdDb+K2Fiz1aiFRu2nyER fbewdYRcq2Pegm+bpk47xBc1JNQwHgWxfnFC3mItXK3qf9apRo1LwPwEGbtIMJwV9mbr XnxG4TttMs394XeD04mEW//ChVQkpHiG6fA4HsUn45+RwFqKSAEExsWga1vvMgeLWcsP aqAfxzg8az+j0/tzdb4nlZUcwf1L6FGt86NY5399G10KU+S3/FStQpiZ7z+iBav2InxW vQkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=aF0HxkH4gAirmQci8kpeRT1O6dM9L7FCMCFWUdgH9UY=; b=LXaxdF+Vf6BTSrBVj8UL5po8t5kMQJhvFGZiy2DPjTDkdtAvurFz0pEAB6Ak+IHs67 jtsWWF9lYsSeIxMfrZBD1MnO2IlC9rq1Ahu5JxLaofMJjU66taSl7tmoK/uTzDhuVCWp yfXPxdAbH6s5YQjDmKrse1uBe1OlvPi11PDGe86qZI5GuzwrWKdE5mFW2zUd8f2uAz/M 5OZ+gtcyI9qTpqxnFMZIqO0rg4yILLTFFygBmtbx7sXohT/mGqshh9jc1vVFXfMCcsCj f2rNsnezE3NaiozwdahfYosUhGU5Rz+IsxjofTrrdJtdaasUYkNPyXVffT/p/pCfa6TO Ek/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EN2DvwFG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dt5-20020a170907728500b007878f030816si188046ejc.109.2022.10.24.09.07.19; Mon, 24 Oct 2022 09:07:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EN2DvwFG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230494AbiJXQGR (ORCPT + 99 others); Mon, 24 Oct 2022 12:06:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232870AbiJXQDy (ORCPT ); Mon, 24 Oct 2022 12:03:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BA03A1A5; Mon, 24 Oct 2022 07:56:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1D80DB81674; Mon, 24 Oct 2022 12:26:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7017AC433C1; Mon, 24 Oct 2022 12:26:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614360; bh=foAPenZ8SsA1CjuNhOHXs496SxCV1R2U2jrLY5lLoVU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EN2DvwFGkRrSyBWtpLDDTyfkd7uOKHiQ0rBEMajM3GbTqPcPWzvMKdWUHGWSPQOUl YOyouBPi3ZNvSakrEObBUW8MpWEmtdc0RhEUBNdSN3J14OeCGLKARv02vP9fMKndtv CfHlctXRdoOdk0IccS6x39OATAey6bqaVgBOVlMM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daisuke Matsuda , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.10 232/390] IB: Set IOVA/LENGTH on IB_MR in core/uverbs layers Date: Mon, 24 Oct 2022 13:30:29 +0200 Message-Id: <20221024113032.663259593@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585769566118092?= X-GMAIL-MSGID: =?utf-8?q?1747585769566118092?= From: Daisuke Matsuda [ Upstream commit 241f9a27e0fc0eaf23e3d52c8450f10648cd11f1 ] Set 'iova' and 'length' on ib_mr in ib_uverbs and ib_core layers to let all drivers have the members filled. Also, this commit removes redundancy in the respective drivers. Previously, commit 04c0a5fcfcf65 ("IB/uverbs: Set IOVA on IB MR in uverbs layer") changed to set 'iova', but seems to have missed 'length' and the ib_core layer at that time. Fixes: 04c0a5fcfcf65 ("IB/uverbs: Set IOVA on IB MR in uverbs layer") Signed-off-by: Daisuke Matsuda Link: https://lore.kernel.org/r/20220921080844.1616883-1-matsuda-daisuke@fujitsu.com Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/core/uverbs_cmd.c | 5 ++++- drivers/infiniband/core/verbs.c | 2 ++ drivers/infiniband/hw/hns/hns_roce_mr.c | 1 - drivers/infiniband/hw/mlx4/mr.c | 1 - 4 files changed, 6 insertions(+), 3 deletions(-) --- a/drivers/infiniband/core/uverbs_cmd.c +++ b/drivers/infiniband/core/uverbs_cmd.c @@ -749,6 +749,7 @@ static int ib_uverbs_reg_mr(struct uverb mr->uobject = uobj; atomic_inc(&pd->usecnt); mr->iova = cmd.hca_va; + mr->length = cmd.length; rdma_restrack_new(&mr->res, RDMA_RESTRACK_MR); rdma_restrack_set_name(&mr->res, NULL); @@ -832,8 +833,10 @@ static int ib_uverbs_rereg_mr(struct uve atomic_dec(&old_pd->usecnt); } - if (cmd.flags & IB_MR_REREG_TRANS) + if (cmd.flags & IB_MR_REREG_TRANS) { mr->iova = cmd.hca_va; + mr->length = cmd.length; + } memset(&resp, 0, sizeof(resp)); resp.lkey = mr->lkey; --- a/drivers/infiniband/core/verbs.c +++ b/drivers/infiniband/core/verbs.c @@ -2082,6 +2082,8 @@ struct ib_mr *ib_reg_user_mr(struct ib_p mr->pd = pd; mr->dm = NULL; atomic_inc(&pd->usecnt); + mr->iova = virt_addr; + mr->length = length; rdma_restrack_new(&mr->res, RDMA_RESTRACK_MR); rdma_restrack_parent_name(&mr->res, &pd->res); --- a/drivers/infiniband/hw/hns/hns_roce_mr.c +++ b/drivers/infiniband/hw/hns/hns_roce_mr.c @@ -286,7 +286,6 @@ struct ib_mr *hns_roce_reg_user_mr(struc goto err_alloc_pbl; mr->ibmr.rkey = mr->ibmr.lkey = mr->key; - mr->ibmr.length = length; return &mr->ibmr; --- a/drivers/infiniband/hw/mlx4/mr.c +++ b/drivers/infiniband/hw/mlx4/mr.c @@ -439,7 +439,6 @@ struct ib_mr *mlx4_ib_reg_user_mr(struct goto err_mr; mr->ibmr.rkey = mr->ibmr.lkey = mr->mmr.key; - mr->ibmr.length = length; mr->ibmr.page_size = 1U << shift; return &mr->ibmr;