目录
NSID 为 FFFFFFFFh,但没有 namespaces in the NVM subsystem
简介
属于 Admin Cmd。
used to low level format the NVM media.
change the LBA data size and/or metadata size by the host.
本文主要参考协议规范 NVMe 1.4c 版本,同时参考 2.0b 版本。
本文中的 Spec 截图默认源自 1.4c 版本,如若源自 2.0b 版本会特殊注释。
详细描述
作用
- A low level format 可以破坏所有 namespaces ,也可以仅破坏指定 namespace,破坏其中的 all data and metadata。
- 该命令执行成功后,controller 不能返回任何在先前 namespace 中的 user data。
设定
Secure Erase Settings (SES)
作为 Format NVM 的一部分,host 请求 format operation 时,可以请求是否进行 secure erase。
有 2 种 secure erase:
- User Data Erase:NVM subsystem 中的所有 user content 都需要被擦除,应改为未知数。
- Cryptographic Erase:通过删除加密 user data 的 encryption key 来完成 NVM subsystem 中的用户内容删除。
Operation Scope
根据 host 是否要求 Secure Erase, 来决定看 FNA bit 0 还是 bit 1。
- 当相应的 FNA bit 为 0,NSID 为 FFFFFFFFh 时,Format NVM 的作用域为整个 controller 的 namespaces。除此之外的其他 namespaces 不受影响。
- 当相应的 FNA bit 为 0,NSID 为已分配的值,Format NVM 的作用域为指定的 namespace。除此之外的其他 namespaces 不受影响。
- 当相应的 FNA bit 为 1,NSID 无论配置为已分配的值还是配置为 FFFFFFFFh,作用域均为整个 NVM subsystem 中的所有 namespaces。
with Secure Erase
当该条 Format NVM command 附带 Secure Erase 时,我们仅需关注 FNA bit 1 的配置。
without Secure Erase
当该条 Format NVM command 没有 Secure Erase 要求时,我们仅需关注 FNA bit 0 的配置。
Format NVM Attributes (FNA)
在 Identify 中表明了 controller 对 Format NVM command 的支持情况。
- 【bit 2】表示 whether cryptographic erase is supported as part of the secure erase functionality.
-
- 为 0 表示 not support cryptographic erase。
- 为 1 表示 support cryptographic erase。
- 【bit 1】表示 in an NVM subsystem, secure erase 是否适用于 all namespaces 还是 the particular namespace specified。
-
- 为 0 表示 secure erase 仅作用于 the particular namespace specified。
- 为 1 表示 secure erase 会作用于 all namespaces。
- 【bit 0】表示 in an NVM subsystem, format operation (excluding secure erase) 是否适用于 all namespaces 还是 the particular namespace specified。
-
- 为 0 表示 the controller supports format on a per namespace basis.
- 为 1 表示 all namespaces 只能一起 format。
- 【bit 3】表示 Format NVM 是否 supports an NSID value set toFFFFFFFFh。(2.0b 新增描述)
-
- 为 0 表示 supports an NSID value set to FFFFFFFFh。
- 为 1 表示 not support an NSID value set to FFFFFFFFh。此时 bit 1 和 bit 0 必须为 0。
下图源自 2.0b
LBA Format (LBAF)
待补充描述。
事件处理
被终止
- The Format NVM command may be aborted with a status code defined in this specification under circumstances defined by a security specification (e.g., invalid security state as specified in TCG Storage Interface Interactions specification).
- 收到 Format NVM command 的 namespace 正在执行 I/O commands,Format NVM command may be aborted。如果终止,则应回报 status code 为 Command Sequence Error。
终止其他命令
- 当前 namespace 正在执行 Format NVM command,收到的 I/O commands may be aborted。如果终止,则应回报 status code 为 Format in Progress。
NSID 为 FFFFFFFFh,但没有 namespaces in the NVM subsystem
无论是否 secure erase,无论 FNA bit 1 设定为 0 还是 1,无论 FNA bit 0 设定为 0 还是 1;Format NVM command shall complete without error。
成功执行
- the settings (e.g., PI, MSET, LBAF) 应该在 Identify Namespace data structure 更新。
- namespace size (i.e., NSZE) and the namespace capacity (i.e., NCAP) 可以不同于执行 Format NVM comand 之前的值。根据 LBA Format 的值进行改变。
回报信息
异常回报
Invalid Format:指定的 format 无效。可能有如下几种原因:
- LBA Format 字段值无效。
- 每个 LBA 没有足够的 metadata 启用保护信息
- 指定的 format 在当前配置中不可使用。
- 无效的安全状态
Command Sequence Error:违反了 multi-command sequence。
Operation Denied:缺乏访问权限,该命令被拒绝。
Namespace is Write Protected:namespace 处于 protected 状态,Format NVM 命令被禁止。
Access Denied:缺乏访问权限,namespace 和 LBA range 被拒绝访问。