From patchwork Thu Sep 29 12:06:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 12994028 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C472C433F5 for ; Thu, 29 Sep 2022 12:24:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235411AbiI2MYF (ORCPT ); Thu, 29 Sep 2022 08:24:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235489AbiI2MX4 (ORCPT ); Thu, 29 Sep 2022 08:23:56 -0400 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A492153107 for ; Thu, 29 Sep 2022 05:23:50 -0700 (PDT) Received: from epcas5p4.samsung.com (unknown [182.195.41.42]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20220929122349epoutp02c1c54abbc595718dcfa66a635d2562b8~ZVE162ZIV0536905369epoutp02d for ; Thu, 29 Sep 2022 12:23:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20220929122349epoutp02c1c54abbc595718dcfa66a635d2562b8~ZVE162ZIV0536905369epoutp02d DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1664454229; bh=Z3PK6vAIkjNPzydQ/3AsMAslieosT5m/aEKA82hKphM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lHKbEL1KxLa8P//t0vJPASre+DzaD8H0tP+CdK0+52mDetufmcUMXJEyQu+5+diwP olICtNZ6rymYC6CPVCwbhyfrijMaHD+CgXfmE8yS0gPQeksiFXcg+vYEIORxIOWjJZ osvDc6l5YAr3LdraBe9orVgHEjV9efXFKV+bLfXM= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20220929122348epcas5p34e0fb4decac1005f3080c4ab016d5946~ZVE1XEd_10262002620epcas5p3X; Thu, 29 Sep 2022 12:23:48 +0000 (GMT) Received: from epsmges5p3new.samsung.com (unknown [182.195.38.178]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4MdXb51Dhtz4x9Q1; Thu, 29 Sep 2022 12:23:45 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id FD.9F.56352.15E85336; Thu, 29 Sep 2022 21:23:45 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20220929121701epcas5p287a6d3f851626a5c7580d9a534432e9b~ZU_6oC5ll2579425794epcas5p2S; Thu, 29 Sep 2022 12:17:01 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20220929121701epsmtrp2a681b5bef377744050439db211fd039b~ZU_6mGWvn1794617946epsmtrp2f; Thu, 29 Sep 2022 12:17:01 +0000 (GMT) X-AuditID: b6c32a4b-5f7fe7000001dc20-42-63358e511047 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id E7.43.14392.DBC85336; Thu, 29 Sep 2022 21:17:01 +0900 (KST) Received: from localhost.localdomain (unknown [107.110.206.5]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220929121700epsmtip1034d1120294b80632ca910941a802a1f~ZU_5LcNVb3029530295epsmtip1A; Thu, 29 Sep 2022 12:17:00 +0000 (GMT) From: Anuj Gupta To: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org Cc: io-uring@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, gost.dev@samsung.com, linux-scsi@vger.kernel.org, Kanchan Joshi , Anuj Gupta Subject: [PATCH for-next v11 09/13] nvme: pass ubuffer as an integer Date: Thu, 29 Sep 2022 17:36:28 +0530 Message-Id: <20220929120632.64749-10-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220929120632.64749-1-anuj20.g@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrIJsWRmVeSWpSXmKPExsWy7bCmlm5gn2mywdbXbBZNE/4yW6y+289m cfPATiaLlauPMlm8az3HYnH0/1s2i0mHrjFa7L2lbTF/2VN2i+7rO9gcuDwuny312LSqk81j 85J6j903G9g8+rasYvT4vEkugC0q2yYjNTEltUghNS85PyUzL91WyTs43jne1MzAUNfQ0sJc SSEvMTfVVsnFJ0DXLTMH6C4lhbLEnFKgUEBicbGSvp1NUX5pSapCRn5xia1SakFKToFJgV5x Ym5xaV66Xl5qiZWhgYGRKVBhQnbG0VtzWQoeSlVcO3uZuYGxW6yLkZNDQsBEYtOzQ4xdjFwc QgK7GSWm3N7LCuF8YpQ4uX4mO0iVkMA3Ronmn9IwHa8fvWKCKNrLKLF+9zRmCOczo8TXWbvA OtgE1CWOPG9lBLFFBIwk9n86CTaWWeAm0KRj+5hAEsICLhIH9q9jA7FZBFQlvr26DdbMK2Al sfXkCWaIdfISMy99B4tzAsUXX5vDClEjKHFy5hMWEJsZqKZ562ywKyQEGjkknjSdAyriAHJc JF4fhDpbWOLV8S3sELaUxOd3e9kg7HSJH5efMkHYBSC3MULY9hKtp/qZQcYwC2hKrN+lDxGW lZh6ah0TxFo+id7fT6BaeSV2zIOxlSTaV86BsiUk9p5rgLI9JO7NugYNuV5GiTMzHjNOYFSY heSdWUjemYWwegEj8ypGydSC4tz01GLTAuO81HJ4LCfn525iBKdVLe8djI8efNA7xMjEw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6dU A9OJmyZWqXqJ9u9VPJ92ih+bVNTO7iNXuOnd6m+6dmdWv5Gx7FuztOAsf+M1lxen2K86GXgz 2LqWFutadhW3zXu1aAE7T/7xvZ1aZt/0e3p+2GzkdmHNXBHCm7egeTv3qV0erm5tWQJ94tPf vZt+f4XmpY/7/9TPux/1S3zDFucGqf0OVfc26f3ZJZW/24nx66qcckWrB4zie8W0lhxzk/kj U/q6LGKO3ZoXGw5Gma4VWODLsO6JgvsvCSPFY9W/5yzribv/hbd8yrSu8vfdHumMcU7bfrXv Vikx+7v54QfGDO3w4M+xt6fJK86f1Oa3SvSF5KrCKVMaecTZNTaz1laev9fIp1hnw7ZIraLq mxJLcUaioRZzUXEiAJBoCtzrAgAA X-CMS-MailID: 20220929121701epcas5p287a6d3f851626a5c7580d9a534432e9b X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220929121701epcas5p287a6d3f851626a5c7580d9a534432e9b References: <20220929120632.64749-1-anuj20.g@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Kanchan Joshi This is a prep patch. Modify nvme_submit_user_cmd and nvme_map_user_request to take ubuffer as plain integer argument, and do away with nvme_to_user_ptr conversion in callers. Signed-off-by: Anuj Gupta Signed-off-by: Kanchan Joshi Reviewed-by: Christoph Hellwig --- drivers/nvme/host/ioctl.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c index 0143f62b27c2..4a7e45a263b6 100644 --- a/drivers/nvme/host/ioctl.c +++ b/drivers/nvme/host/ioctl.c @@ -83,9 +83,10 @@ static struct request *nvme_alloc_user_request(struct request_queue *q, return req; } -static int nvme_map_user_request(struct request *req, void __user *ubuffer, +static int nvme_map_user_request(struct request *req, u64 ubuffer, unsigned bufflen, void __user *meta_buffer, unsigned meta_len, - u32 meta_seed, void **metap, bool vec) + u32 meta_seed, void **metap, struct io_uring_cmd *ioucmd, + bool vec) { struct request_queue *q = req->q; struct nvme_ns *ns = q->queuedata; @@ -136,7 +137,7 @@ static int nvme_map_user_request(struct request *req, void __user *ubuffer, } static int nvme_submit_user_cmd(struct request_queue *q, - struct nvme_command *cmd, void __user *ubuffer, + struct nvme_command *cmd, u64 ubuffer, unsigned bufflen, void __user *meta_buffer, unsigned meta_len, u32 meta_seed, u64 *result, unsigned timeout, bool vec) { @@ -154,7 +155,7 @@ static int nvme_submit_user_cmd(struct request_queue *q, req->timeout = timeout; if (ubuffer && bufflen) { ret = nvme_map_user_request(req, ubuffer, bufflen, meta_buffer, - meta_len, meta_seed, &meta, vec); + meta_len, meta_seed, &meta, NULL, vec); if (ret) goto out; } @@ -239,7 +240,7 @@ static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio) c.rw.appmask = cpu_to_le16(io.appmask); return nvme_submit_user_cmd(ns->queue, &c, - nvme_to_user_ptr(io.addr), length, + io.addr, length, metadata, meta_len, lower_32_bits(io.slba), NULL, 0, false); } @@ -293,7 +294,7 @@ static int nvme_user_cmd(struct nvme_ctrl *ctrl, struct nvme_ns *ns, timeout = msecs_to_jiffies(cmd.timeout_ms); status = nvme_submit_user_cmd(ns ? ns->queue : ctrl->admin_q, &c, - nvme_to_user_ptr(cmd.addr), cmd.data_len, + cmd.addr, cmd.data_len, nvme_to_user_ptr(cmd.metadata), cmd.metadata_len, 0, &result, timeout, false); @@ -339,7 +340,7 @@ static int nvme_user_cmd64(struct nvme_ctrl *ctrl, struct nvme_ns *ns, timeout = msecs_to_jiffies(cmd.timeout_ms); status = nvme_submit_user_cmd(ns ? ns->queue : ctrl->admin_q, &c, - nvme_to_user_ptr(cmd.addr), cmd.data_len, + cmd.addr, cmd.data_len, nvme_to_user_ptr(cmd.metadata), cmd.metadata_len, 0, &cmd.result, timeout, vec); @@ -525,9 +526,9 @@ static int nvme_uring_cmd_io(struct nvme_ctrl *ctrl, struct nvme_ns *ns, req->timeout = d.timeout_ms ? msecs_to_jiffies(d.timeout_ms) : 0; if (d.addr && d.data_len) { - ret = nvme_map_user_request(req, nvme_to_user_ptr(d.addr), + ret = nvme_map_user_request(req, d.addr, d.data_len, nvme_to_user_ptr(d.metadata), - d.metadata_len, 0, &meta, vec); + d.metadata_len, 0, &meta, ioucmd, vec); if (ret) goto out_err; }