From patchwork Thu Jan 27 08:25:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 12726446 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 CF795C433F5 for ; Thu, 27 Jan 2022 09:09:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232133AbiA0JJz (ORCPT ); Thu, 27 Jan 2022 04:09:55 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:60239 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234750AbiA0JJy (ORCPT ); Thu, 27 Jan 2022 04:09:54 -0500 Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20220127090952epoutp03c0608441c05b5ec4ccb43e8cd9feec69~OFYkAy-JN1726017260epoutp03U for ; Thu, 27 Jan 2022 09:09:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20220127090952epoutp03c0608441c05b5ec4ccb43e8cd9feec69~OFYkAy-JN1726017260epoutp03U DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1643274592; bh=MOfeOPd7/DFATfoZjnU6xbRzKs1j45E6h/F7a0S2hfo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LgOkL1mSJMLC9bphloG/Q8fVjuAQvxRvzhi4iX5t7khzQ/SBtEb930Et6f7kpFQNz qxlHcNKOPrrpoG1a69qLvPXHg+SwzENwOHAREsuwgJ0G9b1ZrFqPg3h3l0FGico02V IAcAN2jH/8xzhm5cYSO5qbD0vQYW8ZQSr7Sp3cyI= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20220127090951epcas5p4d4d45a10412a1a36b65127618ead83a3~OFYjai02D3200332003epcas5p4P; Thu, 27 Jan 2022 09:09:51 +0000 (GMT) Received: from epsmges5p2new.samsung.com (unknown [182.195.38.174]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4JkvtG1xQBz4x9QP; Thu, 27 Jan 2022 09:09:42 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmges5p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 08.71.46822.E7F52F16; Thu, 27 Jan 2022 18:01:50 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20220127083034epcas5p4aaafaf1f40c21a383e985d6f6568cbef~OE2QXjYOB3236932369epcas5p48; Thu, 27 Jan 2022 08:30:34 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20220127083034epsmtrp2ef12992cff65ef55c8c95dbae36be6d7~OE2QWm8-W2535825358epsmtrp27; Thu, 27 Jan 2022 08:30:34 +0000 (GMT) X-AuditID: b6c32a4a-dfbff7000000b6e6-d8-61f25f7e17b2 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id CE.85.08738.A2852F16; Thu, 27 Jan 2022 17:30:34 +0900 (KST) Received: from localhost.localdomain (unknown [107.110.206.5]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20220127083033epsmtip2e9189d63b40ede8fa23d741df046fd91~OE2PYSIZC1931219312epsmtip2T; Thu, 27 Jan 2022 08:30:33 +0000 (GMT) From: Kanchan Joshi To: hch@lst.de, kbusch@kernel.org, axboe@kernel.dk Cc: linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, joshiiitr@gmail.com Subject: [PATCH 1/2] block: introduce and export blk_rq_map_user_vec Date: Thu, 27 Jan 2022 13:55:35 +0530 Message-Id: <20220127082536.7243-2-joshi.k@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220127082536.7243-1-joshi.k@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupik+LIzCtJLcpLzFFi42LZdlhTU7cu/lOiwYV/Uhar7/azWaxcfZTJ 4vzbw0wWkw5dY7TYe0vbYv6yp+wObB47Z91l97h8ttRj06pONo/NS+o9dt9sYPP4vEkugC0q 2yYjNTEltUghNS85PyUzL91WyTs43jne1MzAUNfQ0sJcSSEvMTfVVsnFJ0DXLTMH6AYlhbLE nFKgUEBicbGSvp1NUX5pSapCRn5xia1SakFKToFJgV5xYm5xaV66Xl5qiZWhgYGRKVBhQnZG 5/vFrAXX+Cp2rP/O2MDYzdPFyMEhIWAicX15bhcjF4eQwG5GiWkPJrNDOJ8YJZ5+mMYK4Xxm lJjwYwobTMeLSxIQ8V2MEu9+zWSEK7p2oJEJpIhNQFPiwuRSEFNEwEji9tuYLkZODmaBMIlD PVNYQGxhAReJ/bs+go1kEVCV+HZHAiTMK2AusWnyXDYQW0JAXmLmpe/sIDangIXEqysPWSFq BCVOznzCAjFSXqJ562xmkAskBB6xS3w+84EdotlFYt+iblYIW1ji1fEtUHEpic/v9kItKJb4 decoVHMHo8T1hpksEAl7iYt7/oK9wgz0yvpd+hBhWYmpp9YxQSzmk+j9/YQJIs4rsWMejK0o cW/SU6i94hIPZyyBsj0kWhu/QMOzm1HibtMutgmMCrOQPDQLyUOzEFYvYGRexSiZWlCcm55a bFpglJdaDo/i5PzcTYzgRKnltYPx4YMPeocYmTgYDzFKcDArifAKaX1MFOJNSaysSi3Kjy8q zUktPsRoCgzwicxSosn5wFSdVxJvaGJpYGJmZmZiaWxmqCTOezp9Q6KQQHpiSWp2ampBahFM HxMHp1QDk0XN+wmVhbefNOs0i2WXvHRYxtXQZiIhUa71hjf2lwXz8lkKHg9//D4fUe34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+3QZDb38xWx30UaFvPzM/pHPqoVO6mdvD62RE+3Jo25ODZI8LPCHTYL pfJs37n3gg6/+5199c2braqTV356YmAplOfpytq3lm9ibYoSq9rHvu8P1V+vN3144SNP6zHJ n2Ef8n9buAsdOhYvFNS8/uJS/93cq/m0dji13Ev4KqzEUpyRaKjFXFScCAA+NhTZ1AIAAA== X-CMS-MailID: 20220127083034epcas5p4aaafaf1f40c21a383e985d6f6568cbef X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220127083034epcas5p4aaafaf1f40c21a383e985d6f6568cbef References: <20220127082536.7243-1-joshi.k@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Similiar to blk_rq_map_user except that it operates on iovec. This is a prep patch. Signed-off-by: Kanchan Joshi Signed-off-by: Anuj Gupta --- block/blk-map.c | 19 +++++++++++++++++++ include/linux/blk-mq.h | 2 ++ 2 files changed, 21 insertions(+) diff --git a/block/blk-map.c b/block/blk-map.c index 4526adde0156..7fe45df3e580 100644 --- a/block/blk-map.c +++ b/block/blk-map.c @@ -577,6 +577,25 @@ int blk_rq_map_user(struct request_queue *q, struct request *rq, } EXPORT_SYMBOL(blk_rq_map_user); +int blk_rq_map_user_vec(struct request_queue *q, struct request *rq, + struct rq_map_data *map_data, void __user *uvec, + unsigned long nr_vecs, gfp_t gfp_mask) +{ + struct iovec fast_iov[UIO_FASTIOV]; + struct iovec *iov = fast_iov; + struct iov_iter iter; + int ret; + + ret = import_iovec(rq_data_dir(rq), uvec, nr_vecs, UIO_FASTIOV, &iov, &iter); + if (unlikely(ret < 0)) + return ret; + ret = blk_rq_map_user_iov(q, rq, NULL, &iter, gfp_mask); + kfree(iov); + + return ret; +} +EXPORT_SYMBOL(blk_rq_map_user_vec); + /** * blk_rq_unmap_user - unmap a request with user data * @bio: start of bio list diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index d319ffa59354..0fda666d2230 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -966,6 +966,8 @@ struct rq_map_data { int blk_rq_map_user(struct request_queue *, struct request *, struct rq_map_data *, void __user *, unsigned long, gfp_t); +int blk_rq_map_user_vec(struct request_queue *, struct request *, + struct rq_map_data *, void __user *, unsigned long, gfp_t); int blk_rq_map_user_iov(struct request_queue *, struct request *, struct rq_map_data *, const struct iov_iter *, gfp_t); int blk_rq_unmap_user(struct bio *); From patchwork Thu Jan 27 08:25:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchan Joshi X-Patchwork-Id: 12726447 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 439BDC433EF for ; Thu, 27 Jan 2022 09:10:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234704AbiA0JKD (ORCPT ); Thu, 27 Jan 2022 04:10:03 -0500 Received: from mailout1.samsung.com ([203.254.224.24]:44855 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234809AbiA0JKD (ORCPT ); Thu, 27 Jan 2022 04:10:03 -0500 Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20220127090958epoutp01709f3e52e32957bd0bd9f3570d81e2d6~OFYqO6ajJ2386623866epoutp01x for ; Thu, 27 Jan 2022 09:09:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20220127090958epoutp01709f3e52e32957bd0bd9f3570d81e2d6~OFYqO6ajJ2386623866epoutp01x DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1643274598; bh=Y+mWWUq5KrIW95w80LpiEX3FY+7449CWTNZyCE1ubCk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jpZuhEP5rXZgAYVno84DaBPK4gwDjy1U6iT81KCg3PoW1EZ8oJD3NDNgZFf6DfLLF Edy6J8pPy+J0zoquunykWoqYsXWnLRixBizzrHB6ag/qhC6w3/K69t/7VneTgzNmrG nATX1ggz7WX9/5lxq2uFTpeacIF4YolXF+71NBrk= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20220127090958epcas5p22a29fe390f28a73902c7dd8e5ed0d0ee~OFYp1au9g1368313683epcas5p2K; Thu, 27 Jan 2022 09:09:58 +0000 (GMT) Received: from epsmges5p2new.samsung.com (unknown [182.195.38.177]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4JkvtR374Kz4x9QV; Thu, 27 Jan 2022 09:09:51 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmges5p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 40.81.46822.48F52F16; Thu, 27 Jan 2022 18:01:56 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPA id 20220127083035epcas5p3e3760849513fb7939757f4e6678405a0~OE2RZ22Lz0624606246epcas5p3V; Thu, 27 Jan 2022 08:30:35 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20220127083035epsmtrp29b6f9a511985f6d578fafc10a2f97212~OE2RY0-GU2535825358epsmtrp29; Thu, 27 Jan 2022 08:30:35 +0000 (GMT) X-AuditID: b6c32a4a-de5ff7000000b6e6-f8-61f25f84ff05 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 76.85.29871.B2852F16; Thu, 27 Jan 2022 17:30:35 +0900 (KST) Received: from localhost.localdomain (unknown [107.110.206.5]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20220127083034epsmtip2a5684ee8ff480064e7093359d8634df9~OE2QcrSXg2260922609epsmtip2o; Thu, 27 Jan 2022 08:30:34 +0000 (GMT) From: Kanchan Joshi To: hch@lst.de, kbusch@kernel.org, axboe@kernel.dk Cc: linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, joshiiitr@gmail.com Subject: [PATCH 2/2] nvme: add vectored-io support for user passthru Date: Thu, 27 Jan 2022 13:55:36 +0530 Message-Id: <20220127082536.7243-3-joshi.k@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220127082536.7243-1-joshi.k@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupmk+LIzCtJLcpLzFFi42LZdlhTQ7cl/lOiwfwluhar7/azWaxcfZTJ 4vzbw0wWkw5dY7TYe0vbYv6yp+wObB47Z91l97h8ttRj06pONo/NS+o9dt9sYPP4vEkugC0q 2yYjNTEltUghNS85PyUzL91WyTs43jne1MzAUNfQ0sJcSSEvMTfVVsnFJ0DXLTMH6AYlhbLE nFKgUEBicbGSvp1NUX5pSapCRn5xia1SakFKToFJgV5xYm5xaV66Xl5qiZWhgYGRKVBhQnZG w8yXjAUtAhVfV+1ibWBs4u1i5OSQEDCROHryIHsXIxeHkMBuRomZF66wQDifGCVO/18M5Xxj lDjYv4YFpqVn7neolr2MEptXT4ByPjNK/D44G8jh4GAT0JS4MLkUxBQRMJK4/TYGpJdZIEzi UM8UsDnCAi4Sna/ngVWzCKhKXLyqDRLmFTCXOPb8GCvEKnmJmZdAVnFycApYSLy68pAVokZQ 4uTMJywQI+UlmrfOZoaof8QusfKlNoTtIrFt5nQ2CFtY4tXxLewQtpTE53d7oeLFEr/uHGUG uV5CoINR4nrDTKgf7SUu7vnLBHIbM9An63fpQ4RlJaaeWscEsZdPovf3EyaIOK/EjnkwtqLE vUlPoe4Xl3g4YwmU7SHxe0k/N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wSHMxKIrxCWh8ThXhTEiurUovy44tKc1KL DzFKc7AoifNe6DoZLySQnliSmp2aWpBaBJNl4uCUamBinrxH6UzykrqH33Z85YyJ3XNngeyJ J7xcUuWilqIGDD25euritn7tapwV6/O1dBYd237n+P5nsrp3VXisv0WHP7kU2yx92MKkxbnV P/rLArkPEo+b3r8I1vJTufLm8KVSpRjTyK/621bJ15l9PJLU98K1YzpvbkDOP6XXFkVmd9Y8 ee22fG3dh1VPNgQXvgi6cX7miiDu5CCNq+khv1w76lPXvfQNW1CndHChldUPqVc1vcw2Op/7 zsT4hOi213ttZWfP97zyhbnioZ/p2u83epY6HFoScuFW8+fCbudrrz6EfDL3nTy9UHH96olW 7DdePjj86LO9f1LA+ZWLd6Szngpvn/Tj8Uc7wyK3FjslluKMREMt5qLiRAAcp0Ge1QIAAA== X-CMS-MailID: 20220127083035epcas5p3e3760849513fb7939757f4e6678405a0 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220127083035epcas5p3e3760849513fb7939757f4e6678405a0 References: <20220127082536.7243-1-joshi.k@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org wire up support for passthru that takes an array of buffers (using iovec). Enable it for NVME_IOCTL_IO64_CMD; same ioctl code to be used with following differences - 1. NVME_IOVEC to be set as cmd.flags 2. cmd.addr, base addr of user iovec array 3. cmd.data_len, count of iovec array elements Signed-off-by: Kanchan Joshi --- drivers/nvme/host/ioctl.c | 9 ++++++--- include/uapi/linux/nvme_ioctl.h | 4 ++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c index 22314962842d..3a896443e110 100644 --- a/drivers/nvme/host/ioctl.c +++ b/drivers/nvme/host/ioctl.c @@ -65,6 +65,7 @@ static int nvme_submit_user_cmd(struct request_queue *q, struct bio *bio = NULL; void *meta = NULL; int ret; + u8 cmd_flags = cmd->common.flags; req = nvme_alloc_request(q, cmd, 0); if (IS_ERR(req)) @@ -75,7 +76,11 @@ static int nvme_submit_user_cmd(struct request_queue *q, nvme_req(req)->flags |= NVME_REQ_USERCMD; if (ubuffer && bufflen) { - ret = blk_rq_map_user(q, req, NULL, ubuffer, bufflen, + if (!(cmd_flags & NVME_IOVEC)) + ret = blk_rq_map_user(q, req, NULL, ubuffer, bufflen, + GFP_KERNEL); + else + ret = blk_rq_map_user_vec(q, req, NULL, ubuffer, bufflen, GFP_KERNEL); if (ret) goto out; @@ -246,8 +251,6 @@ static int nvme_user_cmd64(struct nvme_ctrl *ctrl, struct nvme_ns *ns, return -EACCES; if (copy_from_user(&cmd, ucmd, sizeof(cmd))) return -EFAULT; - if (cmd.flags) - return -EINVAL; if (!nvme_validate_passthru_nsid(ctrl, ns, cmd.nsid)) return -EINVAL; diff --git a/include/uapi/linux/nvme_ioctl.h b/include/uapi/linux/nvme_ioctl.h index d99b5a772698..d4999e3930f8 100644 --- a/include/uapi/linux/nvme_ioctl.h +++ b/include/uapi/linux/nvme_ioctl.h @@ -9,6 +9,10 @@ #include +enum nvme_ioc_flags { + NVME_IOVEC = 1 << 0 /* vectored io */ +}; + struct nvme_user_io { __u8 opcode; __u8 flags;