From nobody Tue Aug 27 18:07:16 2024 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Wtb9J6CzGz52ZD4; Tue, 27 Aug 2024 18:07:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Wtb9J3zC2z4ZMt; Tue, 27 Aug 2024 18:07:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1724782036; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gDLTx7dM55ttv2J1BNj5W4PXepGzQDjvEXO5kN7rqlk=; b=BBxwKNsF4N6QMNteqCOEf0sS12lYtVtRrYAbxTvZJWSFXTDwXvaau9snTDakpiQ1BZzQhL NTkh8ioDRYuKDykcz1mir8S5S7ixlUJtCoG5Uje+U99Tsdtmf/knclWQqf6R99oz8Ugbal Za81rbR0+eNGiC7UBWcqb5iWYCslX5/3bhCHrZotYl05ywCqpOnO2ZJnz0n+q0aionfIat 6ZqW04d8sUPFWtD7rw6CNBXh+D6AG102I0fpvwF+p+vUID2VhyGkO8WFWHzRlgweTVMLp3 7h+q9YzD4xI35A1CrXBitGi/l+VopqqRsUAN43mLhXHMuMDT5Hft/nmXs9jtyg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1724782036; a=rsa-sha256; cv=none; b=k8s5QkJjsT/qc5IaULYs+Va2TDn+yVViR+5J/NxmlHEw9Bo7iUk3VTWpNSCBEwthLqcigQ wPwUjcFTac31w4kWyimvIAijXZzUmIjEsxpqwhfilzI7zqQDssmVXDcgPBab7nhOzzHbBV RFGR4z13BvJDYlBAqkYT5POt9Lw0V5Tf7mk4tkeZrgUXVDaAcQ8aY1FhbPa9S0gECVrCcE SiSA86DaY4mpkFaBNVzXYFq9NTwRrZI2/T1ymgCCpPsNdwtLlYgHpUwe10XQXLBTueAK3U 4EAjKtejKd5CMrEobc0AYRa4t4KCzaYj6Io/7ungAmQvXF6BXsIqLco+lhjc2A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1724782036; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gDLTx7dM55ttv2J1BNj5W4PXepGzQDjvEXO5kN7rqlk=; b=mlmLPsvcvDu6Os48JVxKvIB7sWz7XYDXICxuOGQXgCk490xsx8Q/lhda7vA7+Boq9vl58A PcGHRsRyeieN8lljb9WpVQlKZAGDvQiGVm0MIJZZb04r5o2WykoGfMpQ8low5mvqXLlbEV +oiHIAvZtOtTVF1xTHxt+Ug0rTpvmyl7N81D1qAAEGUaY9ulzs5GarDleIIh0F7kkO+IPJ w1vBz8W4+xGprI2Qf82VOy+QotOBR9BfgJjbH1RTnE9wYkzCh2OpyfaCzgkiSubYVyeA4V KAux7ETdjA2CV9R4qTcofVo+k/CDicha5n6fkEpQTGuoXBqFiwjG1qZYv5hRJw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Wtb9J3Yv9z10Th; Tue, 27 Aug 2024 18:07:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 47RI7GWZ094099; Tue, 27 Aug 2024 18:07:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47RI7GXg094096; Tue, 27 Aug 2024 18:07:16 GMT (envelope-from git) Date: Tue, 27 Aug 2024 18:07:16 GMT Message-Id: <202408271807.47RI7GXg094096@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 1d56b7ed637c - stable/14 - nvmecontrol: Flesh out nvmecontrol format information List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 1d56b7ed637cf283c7773c857a86e8a6ab218751 Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=1d56b7ed637cf283c7773c857a86e8a6ab218751 commit 1d56b7ed637cf283c7773c857a86e8a6ab218751 Author: Warner Losh AuthorDate: 2024-04-25 23:47:18 +0000 Commit: John Baldwin CommitDate: 2024-08-27 16:35:34 +0000 nvmecontrol: Flesh out nvmecontrol format information The format command takes a number of different parameters. Include a brief summary of what the values mean, though since the driver's support for metadata is at best weak, 0's are almost always used for values other than -f format. Add an example that ties it all together. Sponsored by: Netflix Reviewed by: pauamma@gundo.com, chuck Differential Revision: https://reviews.freebsd.org/D44958 (cherry picked from commit ce3b53ffcc3ecc00fa6283542c60ff1fe697d853) --- sbin/nvmecontrol/nvmecontrol.8 | 81 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 70 insertions(+), 11 deletions(-) diff --git a/sbin/nvmecontrol/nvmecontrol.8 b/sbin/nvmecontrol/nvmecontrol.8 index b812149b5c7d..b5a85b1ab9f5 100644 --- a/sbin/nvmecontrol/nvmecontrol.8 +++ b/sbin/nvmecontrol/nvmecontrol.8 @@ -442,24 +442,62 @@ Use Extended Data Structure. .Ss format Format either specified namespace, or all namespaces of specified controller, using specified parameters: +.Bl -tag -width 8n +.It Fl f Ar fmt +The index .Ar fmt -LBA Format, +of the parameters to use. +LBA Format #, as specified in the identification of the namespace using +.Dq nvmecontrol identify +command with a namespace specified maps this index into these parameters. +.It Fl m Ar mset +Metadata Setting. .Ar mset -Metadata Settings, -.Ar pi -Protection Information, -.Ar pil +.Bl -tag -compact -width 6n +.It Dv 0 +do not transfer metadata with LBA information +.It Dv 1 +Transfer the metadata as part of the extended LBA information. +.El +.It Fl p Ar pi +Protection Information. +.Bl -tag -compact -width 6n +.It Dv 0 +Protection Information not enabled. +.It Dv 1 +Type 1 information protection enabled. +.It Dv 2 +Type 2 information protection enabled. +.It Dv 3 +Type 3 information protection enabled. +.El +.It Fl l Ar pil Protection Information Location. +.Bl -tag -compact -width 6n +.It Dv 0 +Transfer the protection metadata as the last N bytes of the transfer. +.It Dv 1 +Transfer the protection metadata as the first N bytes of the transfer. +.El +.It Fl E +Enables User Data Erase during format. +All users data is erased and subsequent reads are indeterminate. +The drive may implement this as a cryptographic erase or it may +physically erase the underlying media. +.It Fl C +Enables Cryptographic Erase during format. +All user data is erased cryptographically by deleting the encryption key, +rendering it unintelligible. +.El +.Pp When formatting specific namespace, existing values are used as defaults. When formatting all namespaces, all parameters should be specified. Some controllers may not support formatting or erasing specific or all namespaces. -Option -.Fl E -enables User Data Erase during format. -Option -.Fl C -enables Cryptographic Erase during format. +The +.Xr nvme 4 +driver does not currently support metadata and protection information +transfers. .Ss sanitize Sanitize NVM subsystem of specified controller, using specified parameters: @@ -763,6 +801,27 @@ device. The corresponding .Pa nvmeXnsY device is used automatically. +.Pp +.Dl nvmecontrol format -f 2 -m 0 -p 0 -l 0 -C nvme2 +.Pp +Format all the name spaces on nvme2 using parameters from +.Dq LBA Format #2 +with no metadata or protection data using cryptographic erase. +If the +.Dq nvmecontrol identify -n 1 nvme2 +command ended with +.Pp +.Bl -verbatim +LBA Format #00: Data Size: 512 Metadata Size: 0 Performance: Good +LBA Format #01: Data Size: 512 Metadata Size: 8 Performance: Good +LBA Format #02: Data Size: 4096 Metadata Size: 0 Performance: Good +LBA Format #03: Data Size: 4096 Metadata Size: 8 Performance: Good +LBA Format #04: Data Size: 4096 Metadata Size: 64 Performance: Good +.El +.Pp +then this would give a 4k data format for at least namespace 1, with no +metadata. +.Pp .Sh DYNAMIC LOADING The directories .Pa /lib/nvmecontrol