From patchwork Wed Nov 6 12:18:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 13864990 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) (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 A75552036E4 for ; Wed, 6 Nov 2024 14:29:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730903374; cv=none; b=hNEfXpA1Fg79xWuCRNRPEpglGorxkHaQYIZOwZsk2TZknGEz0yLtOOaI/5j7X0USJ49vdg2kP/l16t1CN4BsLzIpW5h1HeMvYZrOG7fPJn/ZPXm+KpLgD+IsPVyQndwNeCt+zUqvFkjZt8C8U2xhA2f2G8eOpK5v7Un26ocILJs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730903374; c=relaxed/simple; bh=v57Mkq3TaReFOJiYSfmTmfJ4LzKewFhLLD85vRtNtlQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=PoudcqbG8uJZeQgJWFjDy3/1vR+22dZWzoglMeHiSsyFViTIQP+CCatTi7H7EsML1ZST2dSqfqUtArBgs7txmst286LZgHQLY2nG1DaBbHvrEz5px44ZolABYjmseNsEHjIr89EVmD9Y4ipEAdQuqy7N1b+sYHhwWZeqIgL0ugo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=uwV+EPz9; arc=none smtp.client-ip=203.254.224.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="uwV+EPz9" Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20241106142931epoutp0326ec3040ad4ab37c2390b88671dd5eb3~FZ3H8sqQt2080220802epoutp037 for ; Wed, 6 Nov 2024 14:29:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20241106142931epoutp0326ec3040ad4ab37c2390b88671dd5eb3~FZ3H8sqQt2080220802epoutp037 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1730903371; bh=Z41P+Tw8TmI51MCW7/+1acKX4G7SIcvf+xBvm2RWHlk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uwV+EPz9lMUKrpbgertevat9Q++ydKf3GukrbWcimb1rBY8GEXSXqsZSnf5EA6DvK oKGexyo+fnsZcIMmfmfa/pcCgh+sWbYEedSWolWJThqBDKQmV4/ERhVaocWtcae6// oA3a9Yz1R1BHk/SDjXm2mAeialMAdYNQowlsRBoY= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20241106142930epcas5p2dd9b01b267bd6084c28270f3401b3601~FZ3Hfu1Zv0777107771epcas5p2c; Wed, 6 Nov 2024 14:29:30 +0000 (GMT) Received: from epsmges5p3new.samsung.com (unknown [182.195.38.175]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4Xk6zD5rN7z4x9Px; Wed, 6 Nov 2024 14:29:28 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id 2C.E2.09800.84D7B276; Wed, 6 Nov 2024 23:29:28 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20241106122715epcas5p1ccc25dc0bbfae6db881fecb6bd00d5e0~FYMYmh6mZ1859418594epcas5p1U; Wed, 6 Nov 2024 12:27:15 +0000 (GMT) Received: from epsmgms1p2new.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20241106122715epsmtrp2700194294705744c4474f89630fe94f7~FYMYltGYz2560925609epsmtrp2g; Wed, 6 Nov 2024 12:27:15 +0000 (GMT) X-AuditID: b6c32a4b-4a7fa70000002648-68-672b7d4826bb Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 89.23.08227.3A06B276; Wed, 6 Nov 2024 21:27:15 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20241106122713epsmtip1504a45f8be2e394b46a5894582a9adb7~FYMWCOyXs0829608296epsmtip1C; Wed, 6 Nov 2024 12:27:13 +0000 (GMT) From: Anuj Gupta To: axboe@kernel.dk, hch@lst.de, kbusch@kernel.org, martin.petersen@oracle.com, asml.silence@gmail.com, anuj1072538@gmail.com, brauner@kernel.org, jack@suse.cz, viro@zeniv.linux.org.uk 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, vishak.g@samsung.com, linux-fsdevel@vger.kernel.org, Kanchan Joshi , Anuj Gupta Subject: [PATCH v8 08/10] nvme: add support for passing on the application tag Date: Wed, 6 Nov 2024 17:48:40 +0530 Message-Id: <20241106121842.5004-9-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241106121842.5004-1-anuj20.g@samsung.com> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAA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tNd9kErbUv8aGcWbfVl2+OqUrGr+6vulf5ejnD4zQ LPD0i3CWMBCS5by266RsePXx501n5E5GL76ccFXdx8Z0geOy30LxhfyfL99clhi67ZqN3QeN xHNBQnO3bfnQfm4+o9nyx8dfzz//v/Xc4/qatPqezXEC2YqOT0uqSqX6FjsrvVZdbrLyM5// wnaPXj3HrIBnXaFyC/9sv5Zazv8vkqfr6KlzlnUHBK1/6nBpNTqa+yxT2mIzedvr9U/c5q10 mMi6ZOmJd0osxRmJhlrMRcWJANbZOvMoAwAA X-CMS-MailID: 20241106122715epcas5p1ccc25dc0bbfae6db881fecb6bd00d5e0 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241106122715epcas5p1ccc25dc0bbfae6db881fecb6bd00d5e0 References: <20241106121842.5004-1-anuj20.g@samsung.com> From: Kanchan Joshi With user integrity buffer, there is a way to specify the app_tag. Set the corresponding protocol specific flags and send the app_tag down. Reviewed-by: Christoph Hellwig Signed-off-by: Anuj Gupta Signed-off-by: Kanchan Joshi Reviewed-by: Keith Busch --- drivers/nvme/host/core.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index f1d1b243d8bc..dac2678cad96 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -883,6 +883,12 @@ static blk_status_t nvme_setup_discard(struct nvme_ns *ns, struct request *req, return BLK_STS_OK; } +static void nvme_set_app_tag(struct request *req, struct nvme_command *cmnd) +{ + cmnd->rw.lbat = cpu_to_le16(bio_integrity(req->bio)->app_tag); + cmnd->rw.lbatm = cpu_to_le16(0xffff); +} + static void nvme_set_ref_tag(struct nvme_ns *ns, struct nvme_command *cmnd, struct request *req) { @@ -1023,6 +1029,10 @@ static inline blk_status_t nvme_setup_rw(struct nvme_ns *ns, control |= NVME_RW_APPEND_PIREMAP; nvme_set_ref_tag(ns, cmnd, req); } + if (bio_integrity_flagged(req->bio, BIP_CHECK_APPTAG)) { + control |= NVME_RW_PRINFO_PRCHK_APP; + nvme_set_app_tag(req, cmnd); + } } cmnd->rw.control = cpu_to_le16(control);