From patchwork Thu Nov 28 11:22:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 13887946 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) (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 4267219E998 for ; Thu, 28 Nov 2024 11:46:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.25 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732794386; cv=none; b=JnW1zCP1xYnpvApsWUo/BwNhJJkTzbMUfm+pJqFGhra5+vSbRS/6WB4KxKLc4cCYpq/jko9s5XANIbyUVGS12Cqdy6kbsscC+o6noELjhV+b491icXLXwkrIG02LEjSy3rviN/q+rtWCEPM4/WD/IQf4NeO3nCndNgL6H0sU+FI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732794386; c=relaxed/simple; bh=R0ISA8yY2JMwXPEw3NvAC6mLoQ+w67YWfMlsx0QA4Ss=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=URNSh+LolzFYUAWegj9SGIdbVTR5DUNpWyMp75r68Nnz4zLHe/AjRs5emlI5jV16fHtSD2CLGKL2zhT24xvM4dtsUAiJ8rGT1Npx8ZhGXdTkwukWEVP+0oXIy7MVK6/kYUrQrBWuY9lhE0GaNaumdQswuPWqMQCRB8etUc4JeT4= 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=KuFCgKXz; arc=none smtp.client-ip=203.254.224.25 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="KuFCgKXz" Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20241128114622epoutp02ee50f97d7fde7232d4aea9c8ba74128e~MH09rdTvC1279912799epoutp02U for ; Thu, 28 Nov 2024 11:46:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20241128114622epoutp02ee50f97d7fde7232d4aea9c8ba74128e~MH09rdTvC1279912799epoutp02U DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1732794382; bh=fOhAPjepG8IxDxWR0+S1vjp4KvMbiHG0tXmeE420F+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KuFCgKXzp1SsDif2l+hjopVG6RLMKOUAVxFGf7S7lm8uOZtoK3GEV9cEqak5aJ2tR /GAb2hnLhD7czwYPtiU2T6bqP1dUVTXQtnC9pQObzCqxud+G637+SN1iO7IZcC0D/j Vh6yHqXbqwjLQZCreqfTmFUA2jRqIWCeLNKDPcVg= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20241128114622epcas5p27eed31a1a09e6201c42b3f54b0b14231~MH09VMcTr1842118421epcas5p28; Thu, 28 Nov 2024 11:46:22 +0000 (GMT) Received: from epsmgec5p1new.samsung.com (unknown [182.195.38.174]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4XzZJr50Mjz4x9Pv; Thu, 28 Nov 2024 11:46:20 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmgec5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id B1.C3.19710.C0858476; Thu, 28 Nov 2024 20:46:20 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20241128113114epcas5p29c7e2a71a136cb50c636a9fe5d87bb0b~MHnwUalBa1770017700epcas5p2Y; Thu, 28 Nov 2024 11:31:14 +0000 (GMT) Received: from epsmgms1p2new.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20241128113114epsmtrp22a238ddd34832bc52d6039fb95e1e7e7~MHnwTesv90090800908epsmtrp2q; Thu, 28 Nov 2024 11:31:14 +0000 (GMT) X-AuditID: b6c32a44-363dc70000004cfe-c0-6748580c7014 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2new.samsung.com (Symantec Messaging Gateway) with SMTP id C8.5E.18949.28458476; Thu, 28 Nov 2024 20:31:14 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20241128113112epsmtip2d2c774c38c40fa32e0b86c84bfc4bcd7~MHntznqrO2086720867epsmtip2h; Thu, 28 Nov 2024 11:31:12 +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 v11 08/10] nvme: add support for passing on the application tag Date: Thu, 28 Nov 2024 16:52:38 +0530 Message-Id: <20241128112240.8867-9-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241128112240.8867-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: H4sIAAA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+/Uqu1T+24veLYtS2K7K7m888yzaxXTmmc LqZq8ao+dffq/JNz3E/d27tJVFLl9f1n01+6ycUeiditfm3RKZFnfBHp8xP/mq1Ues8kJTRJ nPXMxsNyt7pTJQ3OHg9LKZlz4UVa7M2DXrcVT+9t6jERZU05NK3816/cRNlPAqtaHs1rOikx 2zytTMFLvJTT+aPY3t2VTKd/vJh8nCX8g17qpckbZ3nuXdlTHXXYoL7QqCEttDqJ/1zWA091 jnOfNrw28J/X/K2w4ZkSS3FGoqEWc1FxIgBZyNukJgMAAA== X-CMS-MailID: 20241128113114epcas5p29c7e2a71a136cb50c636a9fe5d87bb0b X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241128113114epcas5p29c7e2a71a136cb50c636a9fe5d87bb0b References: <20241128112240.8867-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);