From patchwork Thu Nov 14 10:45:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Gupta X-Patchwork-Id: 843422 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 C5A6D1F8F12 for ; Thu, 14 Nov 2024 11:20:26 +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=1731583228; cv=none; b=SmDWGFrsfKshgEVVrLr5AN33gvwLmbnYLB/WfnVr/atWMzmAsIzL9nhvGCe2Asdd74hrFUEVzKHKurWvSkWfW73jFR+r29IUodQdIggS4fHMabrUnQ9zlrNcdin9RYsRJPqKuGVClwh0siuM/ROIpjzUzR+aY/jkJebIiZqz1r8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731583228; c=relaxed/simple; bh=wf16SXbPE7IKcuRRSTK3G6OqCzknXrmBf1Mn0Cr7weM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version: Content-Type:References; b=tedTUotNKaVF0mrE7ibSyfL0iW0nQwuGS3/0Ue64saIsWavNgVm99lmU3ndA8A8+Kl3hADgO4tT4Ie5ajfbcwPiRXk0A7W7h/ltP50d3/IiSiW+TQayQDae/wZEjpfA0mQllCoKvZbT0VA+ZNF8hUm+47eznqQPsWlUlJP/Jiao= 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=Mraw92l0; 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="Mraw92l0" Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20241114112025epoutp022843877c3850e84058722c73ed83b200~H0cTjtWJ70643106431epoutp021 for ; Thu, 14 Nov 2024 11:20:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20241114112025epoutp022843877c3850e84058722c73ed83b200~H0cTjtWJ70643106431epoutp021 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1731583225; bh=DV5DBIpEJMoashvJk+4uhGWWufd3TPgC6b7DXtx2rfc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mraw92l0VTxVNPIgrxdp4KDv/btGJpKItYoy2wNip5+pDtJyfjELuqn9c4/CsrY3z 8r4z48j0YgLp+W1h4N/tZHzMPQfe3ruTZf4HQwmq4efDV0uHPLO7oXJKe4/McMGyFX qRviu6s0/LALVMSmFuFGFvnUxbQ22k6qEvKw0wN0= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20241114112024epcas5p48d9c06b1bc34a8bbfb319ae30a8394c3~H0cTD0v7c0985309853epcas5p4Z; Thu, 14 Nov 2024 11:20:24 +0000 (GMT) Received: from epsmgec5p1-new.samsung.com (unknown [182.195.38.180]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4XpyPL2Ttjz4x9Q2; Thu, 14 Nov 2024 11:20:22 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmgec5p1-new.samsung.com (Symantec Messaging Gateway) with SMTP id DB.4F.37975.36CD5376; Thu, 14 Nov 2024 20:17:55 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPA id 20241114105416epcas5p3a7aa552775cfe50f60ef89f7d982ea12~H0FeHIZif2916029160epcas5p3E; Thu, 14 Nov 2024 10:54:16 +0000 (GMT) Received: from epsmgms1p2new.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20241114105416epsmtrp1ba676ae188c5ea171608ff0bdbbdb333~H0FeGSpZv1676716767epsmtrp1d; Thu, 14 Nov 2024 10:54:16 +0000 (GMT) X-AuditID: b6c32a50-085ff70000049457-e5-6735dc632dbb Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 4C.B3.08227.7D6D5376; Thu, 14 Nov 2024 19:54:15 +0900 (KST) Received: from localhost.localdomain (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20241114105413epsmtip2b05a4c14310035d341e7ef6031e99ca4~H0Fbx4AkK1420714207epsmtip2W; Thu, 14 Nov 2024 10:54: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, Anuj Gupta Subject: [PATCH v9 10/11] scsi: add support for user-meta interface Date: Thu, 14 Nov 2024 16:15:16 +0530 Message-Id: <20241114104517.51726-11-anuj20.g@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241114104517.51726-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: H4sIAAAAAAAAA+NgFrrN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bTd7V2vFwp21d2Hw3Svye8pt3FjOcnK5/PGqtpHp5QZDF450l8vPYJRxi9tZHbJi2+P51 8//Gaf6bfb+dzZof7ZFZ2Wq44KFUZjj3BYGipgqP31GfDXsZlr6Y53VrqshM/abOZO2/Xvc7 xObfbdkfvHVPziy32jXlSSv9/DRDI8pv5Mn+fKj6+fIFm4Wr17q8t6yU/yyfL/Fxon3Lm4mV U5RYijMSDbWYi4oTAT5DThchAwAA X-CMS-MailID: 20241114105416epcas5p3a7aa552775cfe50f60ef89f7d982ea12 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20241114105416epcas5p3a7aa552775cfe50f60ef89f7d982ea12 References: <20241114104517.51726-1-anuj20.g@samsung.com> Add support for sending user-meta buffer. Set tags to be checked using flags specified by user/block-layer. With this change, BIP_CTRL_NOCHECK becomes unused. Remove it. Signed-off-by: Anuj Gupta Reviewed-by: Christoph Hellwig --- drivers/scsi/sd.c | 4 ++-- include/linux/bio-integrity.h | 16 +++++++--------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 8947dab132d7..cb7ac8736b91 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -814,14 +814,14 @@ static unsigned char sd_setup_protect_cmnd(struct scsi_cmnd *scmd, if (bio_integrity_flagged(bio, BIP_IP_CHECKSUM)) scmd->prot_flags |= SCSI_PROT_IP_CHECKSUM; - if (bio_integrity_flagged(bio, BIP_CTRL_NOCHECK) == false) + if (bio_integrity_flagged(bio, BIP_CHECK_GUARD)) scmd->prot_flags |= SCSI_PROT_GUARD_CHECK; } if (dif != T10_PI_TYPE3_PROTECTION) { /* DIX/DIF Type 0, 1, 2 */ scmd->prot_flags |= SCSI_PROT_REF_INCREMENT; - if (bio_integrity_flagged(bio, BIP_CTRL_NOCHECK) == false) + if (bio_integrity_flagged(bio, BIP_CHECK_REFTAG)) scmd->prot_flags |= SCSI_PROT_REF_CHECK; } diff --git a/include/linux/bio-integrity.h b/include/linux/bio-integrity.h index fe2bfe122db2..2195bc06dcde 100644 --- a/include/linux/bio-integrity.h +++ b/include/linux/bio-integrity.h @@ -7,13 +7,12 @@ enum bip_flags { BIP_BLOCK_INTEGRITY = 1 << 0, /* block layer owns integrity data */ BIP_MAPPED_INTEGRITY = 1 << 1, /* ref tag has been remapped */ - BIP_CTRL_NOCHECK = 1 << 2, /* disable HBA integrity checking */ - BIP_DISK_NOCHECK = 1 << 3, /* disable disk integrity checking */ - BIP_IP_CHECKSUM = 1 << 4, /* IP checksum */ - BIP_COPY_USER = 1 << 5, /* Kernel bounce buffer in use */ - BIP_CHECK_GUARD = 1 << 6, /* guard check */ - BIP_CHECK_REFTAG = 1 << 7, /* reftag check */ - BIP_CHECK_APPTAG = 1 << 8, /* apptag check */ + BIP_DISK_NOCHECK = 1 << 2, /* disable disk integrity checking */ + BIP_IP_CHECKSUM = 1 << 3, /* IP checksum */ + BIP_COPY_USER = 1 << 4, /* Kernel bounce buffer in use */ + BIP_CHECK_GUARD = 1 << 5, /* guard check */ + BIP_CHECK_REFTAG = 1 << 6, /* reftag check */ + BIP_CHECK_APPTAG = 1 << 7, /* apptag check */ }; struct bio_integrity_payload { @@ -33,8 +32,7 @@ struct bio_integrity_payload { struct bio_vec bip_inline_vecs[];/* embedded bvec array */ }; -#define BIP_CLONE_FLAGS (BIP_MAPPED_INTEGRITY | BIP_CTRL_NOCHECK | \ - BIP_DISK_NOCHECK | BIP_IP_CHECKSUM | \ +#define BIP_CLONE_FLAGS (BIP_MAPPED_INTEGRITY | BIP_IP_CHECKSUM | \ BIP_CHECK_GUARD | BIP_CHECK_REFTAG | BIP_CHECK_APPTAG) #ifdef CONFIG_BLK_DEV_INTEGRITY