From patchwork Mon Nov 25 07:06:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 845700 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 E2F7318893C for ; Mon, 25 Nov 2024 08:08:59 +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=1732522141; cv=none; b=obFLg4gUZrV1Z8h4hqgAHG9gTsx9a31gce++AewuJ8cYz3LKs1j0wq544ZYpmfhAbc6PaiQAybYNr2PNuVcUXKkeztwxRbghMDEo14/Cq11LABk1MNTezESFgLv+2/AXjGesdDLVJSwMGOz2hbaWshjfrUl1zfTBKg/P1jWQcK4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732522141; c=relaxed/simple; bh=R0ISA8yY2JMwXPEw3NvAC6mLoQ+w67YWfMlsx0QA4Ss=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=scVndiFcG4BRgJaSAS3Qy7+XHUWlfbrc6EPdCyyMI4vF7HrDDrnoD/GhbEdeSCeIx0UW03cZx6iKtyigOWXhfsSHurluQEpHeuhrA02+qnTKm2DDKDPvinKlbGUmgafzbguSgVIQjH6C9DD6IGEnN/VkPIqF7LxtWpW3zxUMFF4= 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=Wt8PsEQJ; 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="Wt8PsEQJ" Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20241125080858epoutp03bed287c49b4908ab3cff1393080f5b0d~LJ7SbAtoa0866608666epoutp03t for ; Mon, 25 Nov 2024 08:08:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20241125080858epoutp03bed287c49b4908ab3cff1393080f5b0d~LJ7SbAtoa0866608666epoutp03t DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1732522138; bh=fOhAPjepG8IxDxWR0+S1vjp4KvMbiHG0tXmeE420F+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wt8PsEQJqgbearHYu3fxl9O/us75Sad3mB+eMUgTK9AlfNtXSu92nygcWca7gJCO/ xx++6j/ky446EuecC/GtaxeIFFlCLRkRZjiYjVl5uwR0A4+/yjsjqcATF1G71ER+wJ 7ruOq/4mVaRD+me1cyOXPVHunD+Et/U1cijyyddw= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20241125080857epcas5p4d06759959548551aef4833f8d9ddad7a~LJ7R9g1tx2124121241epcas5p4g; Mon, 25 Nov 2024 08:08:57 +0000 (GMT) Received: from epsmges5p2new.samsung.com (unknown [182.195.38.179]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4XxddN0wM2z4x9Q7; Mon, 25 Nov 2024 08:08:56 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmges5p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 2E.02.19933.79034476; Mon, 25 Nov 2024 17:08:55 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPA id 20241125071507epcas5p3b898d0960fb411cd176aea29029d820a~LJMR62Uuv1555015550epcas5p3e; Mon, 25 Nov 2024 07:15:07 +0000 (GMT) Received: from epsmgms1p2new.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20241125071507epsmtrp29b66bfee5a18f9c38f5643a13d4bc316~LJMR52bbv0316003160epsmtrp25; Mon, 25 Nov 2024 07:15:07 +0000 (GMT) X-AuditID: b6c32a4a-c1fda70000004ddd-72-674430975f8d Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 75.55.19220.BF324476; Mon, 25 Nov 2024 16:15:07 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20241125071505epsmtip1c600a3a362de2346338329f5f8a11561~LJMPdOokE0361903619epsmtip1t; Mon, 25 Nov 2024 07:15:05 +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 v10 08/10] nvme: add support for passing on the application tag Date: Mon, 25 Nov 2024 12:36:31 +0530 Message-Id: <20241125070633.8042-9-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241125070633.8042-1-anuj20.g@samsung.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA02Te1BUVRzH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YNW+Kmqos13zpY5sWEND+brl5 rGB4qNgcj+9VM981rE8wfVKU38kbor786n0me7P7Xxvf3Dv7Mvvt/I/n1Zyfua/zNzgmse1j 48/2aau99v4x+uTlWidRuvv4c4vj/brR4R0a0YuZ5249LXDBauPzurkl4qEzddzteeMDK07o d1aHznKbFf3Aa5km6+cDp4r3vtaZ1xQuZqyqFbLSVnOBojEHM0PW9tA9mSmazYd27VgnXLwj LOCjXTNruOePd0osxRmJhlrMRcWJAIiWypgoAwAA X-CMS-MailID: 20241125071507epcas5p3b898d0960fb411cd176aea29029d820a X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241125071507epcas5p3b898d0960fb411cd176aea29029d820a References: <20241125070633.8042-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 e4e3653c27fb..571d4106d256 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -885,6 +885,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) { @@ -1025,6 +1031,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);