From patchwork Tue Mar 1 10:44:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Klaus Jensen X-Patchwork-Id: 12764546 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3F7B5C433F5 for ; Tue, 1 Mar 2022 10:50:40 +0000 (UTC) Received: from localhost ([::1]:38868 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nP05W-0001EP-UN for qemu-devel@archiver.kernel.org; Tue, 01 Mar 2022 05:50:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:41202) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOzzi-0006IA-HY; Tue, 01 Mar 2022 05:44:39 -0500 Received: from new2-smtp.messagingengine.com ([66.111.4.224]:55693) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOzzg-0005gx-Dq; Tue, 01 Mar 2022 05:44:38 -0500 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id 175F25801FA; Tue, 1 Mar 2022 05:44:33 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Tue, 01 Mar 2022 05:44:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irrelevant.dk; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:message-id:mime-version:reply-to:sender :subject:subject:to:to; s=fm2; bh=Q1pLH+qS4YeFYxht4Y2tah7Kn/9h2U l8BOSoMEiPsgc=; b=a5siqCpGIJ+srhPklbUPHXFD+A9NGA+HqIjEdIvvwDk6GM 6rL/lo2t44pkbMHj76xa4XGvPjWCtaxPrhFQ3SYUAfSeVrqR82TtFgdlygTcyWhU imKbNl2HaqzPhG3xPuUr8ZP52ZtuPFYaR66Mrqe2OFlncZCMZ5uuVKh/FmHnA0ew AWFNk3htfqjiON4OS0eJniajKqONGJxzS8sIHnzS5r2y2a3T5SOTAp2tIF+xTXH1 LpbnrpmNzUz85IuI5EABF7QuDnGI22s6LBYIj+z/Hhf+Uw0LPjrWTjRBM7TrbvCU ewvYqvTYenbDr09diQL0LdunWkbfuU2HWP6/xx2Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=Q1pLH+ qS4YeFYxht4Y2tah7Kn/9h2Ul8BOSoMEiPsgc=; b=XnGSO5a6AGVeTZZwS6YFlP ph7PQdRi2118sUxtbcKl9TN2R0OOFVxhFDjgwFb0VAzsnhDHCmYVKJtew64kxG5I BVibl9yvqjWvDN82piTT1upPeFbqTTbCNHLm3T7FAkevdOgIiWmLaVS+cDj7RzKr rNm9sfuBirgpHH1t5twi+dhJOSL7EhXDf7Q6ZTWfKZJt8gQAsNGqLhHrJwkwQ7da Yw3B/gwmILGUgoYXb1AQ33+8tatxD8pdXuqLyZ17izM6NSJl81RxcziTAiVELq13 90PmJqAhEH4SEnmgzJ3UHYSFAG3z6P+faL/sija5ltKEfhMr2NmMNVfJSZR70g4g == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddruddtvddgudejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffotggggfesthhqredtredtjeenucfhrhhomhepmfhlrghushcu lfgvnhhsvghnuceoihhtshesihhrrhgvlhgvvhgrnhhtrdgukheqnecuggftrfgrthhtvg hrnhepveetleefgeekhfelkedvffduleefvdefgeejjeehfeevtdeulefhudetgffgtdfg necuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehithhssehirhhrvghlvghvrghnthdrughk X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 1 Mar 2022 05:44:30 -0500 (EST) From: Klaus Jensen To: qemu-devel@nongnu.org, Keith Busch Subject: [PATCH v2 0/6] hw/nvme: enhanced protection information (64-bit guard) Date: Tue, 1 Mar 2022 11:44:22 +0100 Message-Id: <20220301104428.160017-1-its@irrelevant.dk> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Received-SPF: pass client-ip=66.111.4.224; envelope-from=its@irrelevant.dk; helo=new2-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Fam Zheng , qemu-block@nongnu.org, Klaus Jensen , Naveen Nagar , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Hanna Reitz , Stefan Hajnoczi , Klaus Jensen Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Klaus Jensen This adds support for one possible new protection information format introduced in TP4068 (and integrated in NVMe 2.0): the 64-bit CRC guard and 48-bit reference tag. This version does not support storage tags. Like the CRC16 support already present, this uses a software implementation of CRC64 (so it is naturally pretty slow). But its good enough for verification purposes. This goes hand-in-hand with the support that Keith submitted for the Linux kernel[1]. [1]: https://lore.kernel.org/linux-nvme/20220201190128.3075065-1-kbusch@kernel.org/ Changes since v1 ~~~~~~~~~~~~~~~~ - Check metadata size depending on pi guard type selected. (Keith) Klaus Jensen (3): hw/nvme: move dif/pi prototypes into dif.h hw/nvme: move format parameter parsing hw/nvme: add pi tuple size helper Naveen Nagar (3): hw/nvme: add host behavior support feature hw/nvme: add support for the lbafee hbs feature hw/nvme: 64-bit pi support hw/nvme/ctrl.c | 235 +++++++++++++++++++++------ hw/nvme/dif.c | 378 +++++++++++++++++++++++++++++++++---------- hw/nvme/dif.h | 191 ++++++++++++++++++++++ hw/nvme/ns.c | 50 ++++-- hw/nvme/nvme.h | 58 +------ hw/nvme/trace-events | 12 +- include/block/nvme.h | 81 ++++++++-- 7 files changed, 793 insertions(+), 212 deletions(-) create mode 100644 hw/nvme/dif.h Reviewed-by: Keith Busch