Skip to contentSkip to conversation

nvme-sysfs: add 'format_***' attributes

PATCH New Tokunori Ikegami 1 participant 1 message Sep 23, 2024 NVMe

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 nvme-sysfs: add 'format_***' attributes

The format_all_ns attriute is needed for the format NVM command.

---
Changes since v1:
- Split the sysfs fna attiributes to format_*** attributes.
- Add NVME_CTRL_FNA attiributes definitions.

 drivers/nvme/host/core.c  |  1 +
 drivers/nvme/host/nvme.h  |  1 +
 drivers/nvme/host/sysfs.c | 48 +++++++++++++++++++++++++++++++++++++++
 include/linux/nvme.h      |  4 ++++
 4 files changed, 54 insertions(+)
drivers/nvme/host/core.c +1 -0
index 2cc9876322e6..7aa291ca7d21 100644
@@ -3303,6 +3303,7 @@ static int nvme_init_identify(struct nvme_ctrl *ctrl)
 	ctrl->cctemp = le16_to_cpu(id->cctemp);
 
 	atomic_set(&ctrl->abort_limit, id->acl + 1);
+	ctrl->fna = id->fna;
 	ctrl->vwc = id->vwc;
 	if (id->mdts)
 		max_hw_sectors = nvme_mps_to_sectors(ctrl, id->mdts);
drivers/nvme/host/nvme.h +1 -0
index fb1d7c812135..2a3679ef1397 100644
@@ -328,6 +328,7 @@ struct nvme_ctrl {
 	u16 sqsize;
 	u32 max_namespaces;
 	atomic_t abort_limit;
+	u8 fna;
 	u8 vwc;
 	u32 vs;
 	u32 sgls;
drivers/nvme/host/sysfs.c +48 -0

60 lines not on this page · raw message

include/linux/nvme.h +4 -0
index b58d9405d65e..3505454549e9 100644
@@ -388,6 +388,10 @@ enum {
 	NVME_CTRL_CTRATT_PREDICTABLE_LAT	= 1 << 5,
 	NVME_CTRL_CTRATT_NAMESPACE_GRANULARITY	= 1 << 7,
 	NVME_CTRL_CTRATT_UUID_LIST		= 1 << 9,
+	NVME_CTRL_FNA_ALL_NS			= 1 << 0,
+	NVME_CTRL_FNA_SE_ALL_NS			= 1 << 1,
+	NVME_CTRL_FNA_CRYPTO_ERASE		= 1 << 2,
+	NVME_CTRL_FNA_NSID_ALL			= 1 << 3,
 };
 
 struct nvme_lbaf {
Signature · 1 line
2.43.0