Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1346725pxb; Wed, 2 Feb 2022 02:55:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJzdY0Pl1srjdKSkQvzkb0xrZqW8V8zkKBZ3MRuJ+CmCMoDUQDgpDk17+WePvca2jREt94cK X-Received: by 2002:a17:903:2311:: with SMTP id d17mr29847948plh.39.1643799319640; Wed, 02 Feb 2022 02:55:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643799319; cv=none; d=google.com; s=arc-20160816; b=HkzjOz4JCWnLDcjDn8sv+erK/S747iSd3AIEEQh28EAfi1ZYcLO+c5jdnBKCGggR/k IHiidAUDup1Vxxlk6evs9beejoQKW4u5oboEoFgdKAJSVWsZIUtzvYsJzVaYml0UPJyd KZJ/ZSzb/Jpy8RP0tgsdCz6EQpDtfdXn0n5Qzi3o9R5cdHecq9ZxLbEdGyVqNmXe/OJr ROYtK4hO4CSel0kBxB6pE2L084dBmtktpPhA7EOamYmrPCgbSd8ko6AbLekNcLntHAVS 1DRUro0gdnXGzWCk/F1fTpmYUeMtV9vchSJwB4D1TEHHiM5OCxSWyucExwmPHBDFN83p Sh/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wziSKiUNPiCMmJZ4Pb9zHTKfpMpgK93z7lnQtngVPeg=; b=P/BA2VRudLWXTRRJnaGjsi59M5LBlG1enzoAXnnZokLyzivS3UGS52uF+8qUMa99ge aV9Mj1yC0DlxW6Oq1vjcbnnrHtaf6df/84opSmZrcDYM3y7YGHcD0Tke99wm6sZzJ456 6O8El9KB2KWXKNaXp6zwn+mekKzI3ms11sZE+y7tOPPd6I6k1SISWZaTl/ydT0dH8IJ3 WqpOZzQ6yWGlBpRPpsjGAqYWYeozQq0d+fgCYOrEXk3KF3j29ZSbBKv8w05fjBoYl6X3 kU328+L/Ivzo24AhlANOtO8K438WknUgAelGPB1bQLF0485wQquTjaKcTlMwqE+W2rR9 gnqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fi+UTk5g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j63si13368357pgd.605.2022.02.02.02.55.07; Wed, 02 Feb 2022 02:55:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fi+UTk5g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242237AbiBATBh (ORCPT + 99 others); Tue, 1 Feb 2022 14:01:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242227AbiBATBg (ORCPT ); Tue, 1 Feb 2022 14:01:36 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20B57C061714; Tue, 1 Feb 2022 11:01:36 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DCD0EB82F6E; Tue, 1 Feb 2022 19:01:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C45A5C340F2; Tue, 1 Feb 2022 19:01:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643742093; bh=VRyH49oabNK9tq5d8ITbMCbDVSNwxXXmYIC92KD8pAk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fi+UTk5gKsIOw6y/x5rzHWQN/dnuO/rcJ2Xny2s+2Q88W0N8SybiTPxqM2DK7/24v oc/3jbMdTQsoMiKdWMxWYVug5ow3HaLAUjFRczq7DhXBMLgmVYgqlGG7GzGug2KnPL QMIK3GC9JD7b2hkx+iWsEuDTTJ9VWjJkHm/KlN90BXsGZMzDLbHaTGTXnwICBQFsAp 3ntQ6T9fgHXAf9+1oLBj6GojrZacR5vN2aX5zv91rESdRcNN7/ch++E5T2Ny111EC6 yzKSfynwDKOzwRKqAn8Zn/scTeWnqa39hGJMBEGczewg6o3A2HNtN83ohpkyX0pDCm JWJht0H1Jfp6Q== From: Keith Busch To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org Cc: axboe@kernel.dk, hch@lst.de, martin.petersen@oracle.com, colyli@suse.de, Keith Busch Subject: [PATCHv2 2/7] nvme: allow integrity on extended metadata formats Date: Tue, 1 Feb 2022 11:01:23 -0800 Message-Id: <20220201190128.3075065-3-kbusch@kernel.org> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20220201190128.3075065-1-kbusch@kernel.org> References: <20220201190128.3075065-1-kbusch@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The block integrity subsystem knows how to construct protection information buffers with metadata beyond the protection information fields. Remove the driver restriction. Note, this can only work if the PI field appears first in the metadata, as the integrity subsystem doesn't calculate guard tags on preceding metadata. Signed-off-by: Keith Busch --- drivers/nvme/host/core.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 5e0bfda04bd7..b3eabf6a08b9 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1726,12 +1726,9 @@ static int nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *id) { struct nvme_ctrl *ctrl = ns->ctrl; - /* - * The PI implementation requires the metadata size to be equal to the - * t10 pi tuple size. - */ ns->ms = le16_to_cpu(id->lbaf[id->flbas & NVME_NS_FLBAS_LBA_MASK].ms); - if (ns->ms == sizeof(struct t10_pi_tuple)) + if (id->dps & NVME_NS_DPS_PI_FIRST || + ns->ms == sizeof(struct t10_pi_tuple)) ns->pi_type = id->dps & NVME_NS_DPS_PI_MASK; else ns->pi_type = 0; -- 2.25.4