NVME_LOG_CDW11_NUMDU_SHIFT = 0,
NVME_LOG_CDW11_LSI_SHIFT = 16,
NVME_LOG_CDW14_UUID_SHIFT = 0,
+ NVME_LOG_CDW14_CSI_SHIFT = 24,
NVME_LOG_CDW10_LID_MASK = 0xff,
NVME_LOG_CDW10_LSP_MASK = 0xf,
NVME_LOG_CDW10_RAE_MASK = 0x1,
NVME_LOG_CDW11_NUMDU_MASK = 0xff,
NVME_LOG_CDW11_LSI_MASK = 0xff,
NVME_LOG_CDW14_UUID_MASK = 0x7f,
+ NVME_LOG_CDW14_CSI_MASK = 0xff,
NVME_IDENTIFY_CDW10_CNS_SHIFT = 0,
NVME_IDENTIFY_CDW10_CNTID_SHIFT = 16,
NVME_IDENTIFY_CDW11_NVMSETID_SHIFT = 0,
NVME_IDENTIFY_CDW14_UUID_SHIFT = 0,
+ NVME_IDENTIFY_CDW11_CSI_SHIFT = 24,
NVME_IDENTIFY_CDW10_CNS_MASK = 0xff,
NVME_IDENTIFY_CDW10_CNTID_MASK = 0xffff,
NVME_IDENTIFY_CDW11_NVMSETID_MASK = 0xffff,
NVME_IDENTIFY_CDW14_UUID_MASK = 0x7f,
+ NVME_IDENTIFY_CDW11_CSI_MASK = 0xff,
NVME_NAMESPACE_ATTACH_CDW10_SEL_SHIFT = 0,
NVME_NAMESPACE_ATTACH_CDW10_SEL_MASK = 0xf,
NVME_NAMESPACE_MGMT_CDW10_SEL_SHIFT = 0,
NVME_GET_LBA_STATUS_CDW13_ATYPE_SHIFT = 24,
NVME_GET_LBA_STATUS_CDW13_RL_MASK = 0xffff,
NVME_GET_LBA_STATUS_CDW13_ATYPE_MASK = 0xff,
+ NVME_ZNS_MGMT_SEND_SEL_SHIFT = 8,
+ NVME_ZNS_MGMT_SEND_SEL_MASK = 0x1,
+ NVME_ZNS_MGMT_SEND_ZSA_SHIFT = 0,
+ NVME_ZNS_MGMT_SEND_ZSA_MASK = 0xff,
+ NVME_ZNS_MGMT_RECV_ZRA_SHIFT = 0,
+ NVME_ZNS_MGMT_RECV_ZRA_MASK = 0xff,
+ NVME_ZNS_MGMT_RECV_ZRASF_SHIFT = 8,
+ NVME_ZNS_MGMT_RECV_ZRASF_MASK = 0xff,
+ NVME_ZNS_MGMT_RECV_ZRAS_FEAT_SHIFT = 16,
+ NVME_ZNS_MGMT_RECV_ZRAS_FEAT_MASK = 0x1,
};
enum features {
NVME_FEATURES_LBAS_LSIPI_SHIFT = 16,
NVME_FEATURES_LBAS_LSIRI_MASK = 0xffff,
NVME_FEATURES_LBAS_LSIPI_MASK = 0xffff,
+ NVME_FEATURES_IOCSP_IOCSCI_SHIFT = 0,
+ NVME_FEATURES_IOCSP_IOCSCI_MASK = 0xff,
};
#define DW(value, prefix) ((value) & (prefix ## _MASK)) << prefix ## _SHIFT
int nvme_identify(int fd, enum nvme_identify_cns cns, __u32 nsid, __u16 cntid,
- __u16 nvmsetid, __u8 uuidx, void *data)
+ __u16 nvmsetid, __u8 uuidx, __u8 csi, void *data)
{
__u32 cdw10 = DW(cntid, NVME_IDENTIFY_CDW10_CNTID) |
DW(cns, NVME_IDENTIFY_CDW10_CNS);
- __u32 cdw11 = DW(nvmsetid, NVME_IDENTIFY_CDW11_NVMSETID);
+ __u32 cdw11 = DW(nvmsetid, NVME_IDENTIFY_CDW11_NVMSETID) |
+ DW(csi, NVME_IDENTIFY_CDW11_CSI);
__u32 cdw14 = DW(uuidx, NVME_IDENTIFY_CDW14_UUID);
struct nvme_passthru_cmd cmd = {
static int __nvme_identify(int fd, __u8 cns, __u32 nsid, void *data)
{
return nvme_identify(fd, cns, nsid, NVME_CNTLID_NONE,
- NVME_NVMSETID_NONE, NVME_UUID_NONE, data);
+ NVME_NVMSETID_NONE, NVME_UUID_NONE, NVME_CSI_NVM,
+ data);
}
int nvme_identify_ctrl(int fd, struct nvme_id_ctrl *id)
BUILD_ASSERT(sizeof(struct nvme_ctrl_list) == 4096);
return nvme_identify(fd, NVME_IDENTIFY_CNS_CTRL_LIST,
NVME_NSID_NONE, cntid, NVME_NVMSETID_NONE,
- NVME_UUID_NONE, ctrlist);
+ NVME_UUID_NONE, NVME_CSI_NVM, ctrlist);
}
int nvme_identify_nsid_ctrl_list(int fd, __u32 nsid, __u16 cntid,
{
return nvme_identify(fd, NVME_IDENTIFY_CNS_NS_CTRL_LIST, nsid,
cntid, NVME_NVMSETID_NONE, NVME_UUID_NONE,
- ctrlist);
+ NVME_CSI_NVM, ctrlist);
}
int nvme_identify_ns_descs(int fd, __u32 nsid, struct nvme_ns_id_desc *descs)
BUILD_ASSERT(sizeof(struct nvme_id_nvmset_list) == 4096);
return nvme_identify(fd, NVME_IDENTIFY_CNS_NVMSET_LIST,
NVME_NSID_NONE, NVME_CNTLID_NONE, nvmsetid,
- NVME_UUID_NONE, nvmset);
+ NVME_UUID_NONE, NVME_CSI_NVM, nvmset);
}
int nvme_identify_primary_ctrl(int fd, __u16 cntid,
BUILD_ASSERT(sizeof(struct nvme_primary_ctrl_cap) == 4096);
return nvme_identify(fd, NVME_IDENTIFY_CNS_PRIMARY_CTRL_CAP,
NVME_NSID_NONE, cntid, NVME_NVMSETID_NONE,
- NVME_UUID_NONE, cap);
+ NVME_UUID_NONE, NVME_CSI_NVM, cap);
}
int nvme_identify_secondary_ctrl_list(int fd, __u16 cntid,
BUILD_ASSERT(sizeof(struct nvme_secondary_ctrl_list) == 4096);
return nvme_identify(fd, NVME_IDENTIFY_CNS_SECONDARY_CTRL_LIST,
NVME_NSID_NONE, cntid, NVME_NVMSETID_NONE,
- NVME_UUID_NONE, list);
+ NVME_UUID_NONE, NVME_CSI_NVM, list);
}
int nvme_identify_ns_granularity(int fd,
list);
}
+int nvme_identify_ctrl_csi(int fd, __u8 csi, void *data)
+{
+ return nvme_identify(fd, NVME_IDENTIFY_CNS_CSI_CTRL, NVME_NSID_NONE,
+ NVME_CNTLID_NONE, NVME_NVMSETID_NONE,
+ NVME_UUID_NONE, csi, data);
+}
+
+int nvme_identify_ns_csi(int fd, __u32 nsid, __u8 csi, void *data)
+{
+ return nvme_identify(fd, NVME_IDENTIFY_CNS_CSI_NS, nsid,
+ NVME_CNTLID_NONE, NVME_NVMSETID_NONE,
+ NVME_UUID_NONE, csi, data);
+}
+
+int nvme_identify_iocs(int fd, struct nvme_id_iocs *iocs)
+{
+ BUILD_ASSERT(sizeof(struct nvme_id_iocs) == 4096);
+ return nvme_identify(fd, NVME_IDENTIFY_CNS_CSI_CTRL, NVME_NSID_NONE,
+ NVME_CNTLID_NONE, NVME_NVMSETID_NONE,
+ NVME_UUID_NONE, NVME_CSI_NVM, iocs);
+}
+
+int nvme_zns_identify_ns(int fd, __u32 nsid, struct nvme_zns_id_ns *data)
+{
+ BUILD_ASSERT(sizeof(struct nvme_zns_id_ns) == 4096);
+ return nvme_identify(fd, NVME_IDENTIFY_CNS_CSI_NS, nsid,
+ NVME_CNTLID_NONE, NVME_NVMSETID_NONE,
+ NVME_UUID_NONE, NVME_CSI_ZNS, data);
+}
+
+int nvme_zns_identify_ctrl(int fd, struct nvme_zns_id_ctrl *data)
+{
+ BUILD_ASSERT(sizeof(struct nvme_zns_id_ctrl) == 4096);
+ return nvme_identify(fd, NVME_IDENTIFY_CNS_CSI_CTRL, NVME_NSID_NONE,
+ NVME_CNTLID_NONE, NVME_NVMSETID_NONE,
+ NVME_UUID_NONE, NVME_CSI_ZNS, data);
+}
+
int nvme_get_log(int fd, enum nvme_cmd_get_log_lid lid, __u32 nsid, __u64 lpo,
- __u8 lsp, __u16 lsi, bool rae, __u8 uuidx, __u32 len, void *log)
+ __u8 lsp, __u16 lsi, bool rae, __u8 uuidx, enum nvme_csi csi,
+ __u32 len, void *log)
{
__u32 numd = (len >> 2) - 1;
__u16 numdu = numd >> 16, numdl = numd & 0xffff;
DW(lsi, NVME_LOG_CDW11_LSI);
__u32 cdw12 = lpo & 0xffffffff;
__u32 cdw13 = lpo >> 32;
- __u32 cdw14 = DW(uuidx, NVME_LOG_CDW14_UUID);
+ __u32 cdw14 = DW(uuidx, NVME_LOG_CDW14_UUID) |
+ DW(csi, NVME_LOG_CDW14_CSI);
struct nvme_passthru_cmd cmd = {
.opcode = nvme_admin_get_log_page,
__u32 len, void *log)
{
return nvme_get_log(fd, lid, NVME_NSID_ALL, 0, NVME_LOG_LSP_NONE,
- NVME_LOG_LSI_NONE, NVME_UUID_NONE, rae, len, log);
+ NVME_LOG_LSI_NONE, NVME_UUID_NONE, NVME_CSI_NVM,
+ rae, len, log);
}
int nvme_get_log_error(int fd, unsigned nr_entries, bool rae,
BUILD_ASSERT(sizeof(struct nvme_smart_log) == 512);
return nvme_get_log(fd, NVME_LOG_LID_SMART, nsid, 0,
NVME_LOG_LSP_NONE, NVME_LOG_LSI_NONE, rae,
- NVME_UUID_NONE, sizeof(*log), log);
+ NVME_UUID_NONE, NVME_CSI_NVM, sizeof(*log), log);
}
int nvme_get_log_fw_slot(int fd, bool rae, struct nvme_firmware_slot *log)
sizeof(*log), log);
}
-int nvme_get_log_cmd_effects(int fd, struct nvme_cmd_effects_log *log)
+int nvme_get_log_cmd_effects(int fd, enum nvme_csi csi,
+ struct nvme_cmd_effects_log *log)
{
BUILD_ASSERT(sizeof(struct nvme_cmd_effects_log) == 4096);
- return __nvme_get_log(fd, NVME_LOG_LID_CMD_EFFECTS, false,
- sizeof(*log), log);
+ return nvme_get_log(fd, NVME_LOG_LID_CMD_EFFECTS, NVME_NSID_ALL, 0,
+ NVME_LOG_LSP_NONE, NVME_LOG_LSI_NONE,
+ NVME_UUID_NONE, csi, false, sizeof(*log),
+ log);
}
int nvme_get_log_device_self_test(int fd, struct nvme_self_test_log *log)
BUILD_ASSERT(sizeof(struct nvme_telemetry_log) == 512);
return nvme_get_log(fd, NVME_LOG_LID_TELEMETRY_HOST, NVME_NSID_NONE, 0,
NVME_LOG_TELEM_HOST_LSP_CREATE, NVME_LOG_LSI_NONE,
- false, NVME_UUID_NONE, sizeof(*log), log);
+ false, NVME_UUID_NONE, NVME_CSI_NVM, sizeof(*log),
+ log);
}
int nvme_get_log_telemetry_host(int fd, __u64 offset, __u32 len, void *log)
{
return nvme_get_log(fd, NVME_LOG_LID_TELEMETRY_HOST, NVME_NSID_NONE,
offset, NVME_LOG_TELEM_HOST_LSP_RETAIN,
- NVME_LOG_LSI_NONE,
- false, NVME_UUID_NONE, len, log);
+ NVME_LOG_LSI_NONE, false, NVME_UUID_NONE,
+ NVME_CSI_NVM, len, log);
}
int nvme_get_log_telemetry_ctrl(int fd, bool rae, __u64 offset, __u32 len,
{
return nvme_get_log(fd, NVME_LOG_LID_TELEMETRY_CTRL, NVME_NSID_NONE,
offset, NVME_LOG_LSP_NONE, NVME_LOG_LSI_NONE, rae,
- NVME_UUID_NONE, len, log);
+ NVME_UUID_NONE, NVME_CSI_NVM, len, log);
}
int nvme_get_log_endurance_group(int fd, __u16 endgid,
BUILD_ASSERT(sizeof(struct nvme_endurance_group_log) == 512);
return nvme_get_log(fd, NVME_LOG_LID_ENDURANCE_GROUP, NVME_NSID_NONE,
0, NVME_LOG_LSP_NONE, endgid, false, NVME_UUID_NONE,
- sizeof(*log), log);
+ NVME_CSI_NVM, sizeof(*log), log);
}
int nvme_get_log_predictable_lat_nvmset(int fd, __u16 nvmsetid,
BUILD_ASSERT(sizeof(struct nvme_nvmset_predictable_lat_log) == 512);
return nvme_get_log(fd, NVME_LOG_LID_PREDICTABLE_LAT_NVMSET,
NVME_NSID_NONE, 0, NVME_LOG_LSP_NONE, nvmsetid,
- false, NVME_UUID_NONE, sizeof(*log), log);
+ false, NVME_UUID_NONE, NVME_CSI_NVM, sizeof(*log),
+ log);
}
int nvme_get_log_predictable_lat_event(int fd, bool rae, __u32 offset,
{
return nvme_get_log(fd, NVME_LOG_LID_PREDICTABLE_LAT_AGG,
NVME_NSID_NONE, offset, NVME_LOG_LSP_NONE, NVME_LOG_LSI_NONE,
- rae, NVME_UUID_NONE, len, log);
+ rae, NVME_UUID_NONE, NVME_CSI_NVM, len, log);
}
int nvme_get_log_ana(int fd, enum nvme_log_ana_lsp lsp, bool rae, __u64 offset,
{
return nvme_get_log(fd, NVME_LOG_LID_ANA, NVME_NSID_NONE, offset,
lsp,NVME_LOG_LSI_NONE, false, NVME_UUID_NONE,
- len, log);
+ NVME_CSI_NVM, len, log);
}
int nvme_get_log_ana_groups(int fd, bool rae, __u32 len,
{
return nvme_get_log(fd, NVME_LOG_LID_LBA_STATUS, NVME_NSID_NONE,
offset, NVME_LOG_LSP_NONE, NVME_LOG_LSI_NONE, rae,
- NVME_UUID_NONE, len, log);
+ NVME_UUID_NONE, NVME_CSI_NVM, len, log);
}
int nvme_get_log_endurance_grp_evt(int fd, bool rae, __u32 offset, __u32 len,
{
return nvme_get_log(fd, NVME_LOG_LID_ENDURANCE_GRP_EVT,
NVME_NSID_NONE, offset, NVME_LOG_LSP_NONE,
- NVME_LOG_LSI_NONE, rae, NVME_UUID_NONE, len, log);
+ NVME_LOG_LSI_NONE, rae, NVME_UUID_NONE,
+ NVME_CSI_NVM, len, log);
}
int nvme_get_log_discovery(int fd, bool rae, __u32 offset, __u32 len, void *log)
{
return nvme_get_log(fd, NVME_LOG_LID_DISCOVER, NVME_NSID_NONE, offset,
NVME_LOG_LSP_NONE, NVME_LOG_LSI_NONE, rae,
- NVME_UUID_NONE, len, log);
+ NVME_UUID_NONE, NVME_CSI_NVM, len, log);
}
int nvme_get_log_reservation(int fd, bool rae,
log);
}
+int nvme_get_log_zns_changed_zones(int fd, __u32 nsid, bool rae,
+ struct nvme_zns_changed_zone_log *log)
+{
+ BUILD_ASSERT(sizeof(struct nvme_zns_changed_zone_log) == 4096);
+ return nvme_get_log(fd, NVME_LOG_LID_ZNS_CHANGED_ZONES, nsid, 0,
+ NVME_LOG_LSP_NONE, NVME_LOG_LSI_NONE, rae,
+ NVME_UUID_NONE, NVME_CSI_ZNS, sizeof(*log), log);
+}
+
int nvme_set_features(int fd, __u8 fid, __u32 nsid, __u32 cdw11, __u32 cdw12,
bool save, __u8 uuidx, __u32 cdw15, __u32 data_len,
void *data, __u32 *result)
save, result);
}
+int nvme_set_features_iocs_profile(int fd, __u8 iocsi, bool save)
+{
+ __u32 value = DW(iocsi, NVME_FEATURES_IOCSP_IOCSCI);
+
+ return __nvme_set_features(fd, NVME_FEAT_FID_IOCS_PROFILE, value,
+ save, NULL);
+}
+
int nvme_get_features(int fd, enum nvme_features_id fid, __u32 nsid,
enum nvme_get_features_sel sel, __u32 cdw11, __u8 uuidx,
__u32 data_len, void *data, __u32 *result)
NVME_UUID_NONE, 0, NULL, result);
}
+int nvme_get_features_iocs_profile(int fd, enum nvme_get_features_sel sel,
+ __u32 *result)
+{
+ return __nvme_get_features(fd, NVME_FEAT_FID_IOCS_PROFILE, sel, result);
+}
+
int nvme_format_nvm(int fd, __u32 nsid, __u8 lbaf,
enum nvme_cmd_format_mset mset, enum nvme_cmd_format_pi pi,
enum nvme_cmd_format_pil pil, enum nvme_cmd_format_ses ses,
return nvme_submit_io_passthru(fd, &cmd, NULL);
}
+
+int nvme_zns_mgmt_send(int fd, __u32 nsid, __u64 slba, bool select_all,
+ enum nvme_zns_send_action zsa, __u32 data_len,
+ void *data)
+{
+ __u32 cdw10 = slba & 0xffffffff;
+ __u32 cdw11 = slba >> 32;
+ __u32 cdw13 = DW(!!select_all, NVME_ZNS_MGMT_SEND_SEL) |
+ DW(zsa, NVME_ZNS_MGMT_SEND_ZSA);
+
+ struct nvme_passthru_cmd cmd = {
+ .opcode = nvme_zns_cmd_mgmt_send,
+ .nsid = nsid,
+ .cdw10 = cdw10,
+ .cdw11 = cdw11,
+ .cdw13 = cdw13,
+ .addr = (__u64)(uintptr_t)data,
+ .data_len = data_len,
+ };
+
+ return nvme_submit_io_passthru(fd, &cmd, NULL);
+}
+
+int nvme_zns_mgmt_recv(int fd, __u32 nsid, __u64 slba,
+ enum nvme_zns_recv_action zra, __u16 zrasf,
+ bool zras_feat, __u32 data_len, void *data)
+{
+ __u32 cdw10 = slba & 0xffffffff;
+ __u32 cdw11 = slba >> 32;
+ __u32 cdw12 = (data_len >> 2) - 1;
+ __u32 cdw13 = DW(zra , NVME_ZNS_MGMT_RECV_ZRA) |
+ DW(zrasf, NVME_ZNS_MGMT_RECV_ZRASF) |
+ DW(zras_feat, NVME_ZNS_MGMT_RECV_ZRAS_FEAT);
+
+ struct nvme_passthru_cmd cmd = {
+ .opcode = nvme_zns_cmd_mgmt_send,
+ .nsid = nsid,
+ .cdw10 = cdw10,
+ .cdw11 = cdw11,
+ .cdw12 = cdw12,
+ .cdw13 = cdw13,
+ .addr = (__u64)(uintptr_t)data,
+ .data_len = data_len,
+ };
+
+ return nvme_submit_io_passthru(fd, &cmd, NULL);
+}
+
+int nvme_zns_append(int fd, __u32 nsid, __u64 zslba, __u16 nlb, __u16 control,
+ __u32 ilbrt, __u16 lbat, __u16 lbatm, __u32 data_len,
+ void *data, __u32 metadata_len, void *metadata,
+ __u64 *result)
+{
+ __u32 cdw10 = zslba & 0xffffffff;
+ __u32 cdw11 = zslba >> 32;
+ __u32 cdw12 = nlb | (control << 16);
+ __u32 cdw14 = ilbrt;
+ __u32 cdw15 = lbat | (lbatm << 16);
+
+ struct nvme_passthru_cmd64 cmd = {
+ .opcode = nvme_zns_cmd_append,
+ .nsid = nsid,
+ .cdw10 = cdw10,
+ .cdw11 = cdw11,
+ .cdw12 = cdw12,
+ .cdw14 = cdw14,
+ .cdw15 = cdw15,
+ .metadata = (__u64)(uintptr_t)metadata,
+ .addr = (__u64)(uintptr_t)data,
+ .metadata_len = metadata_len,
+ .data_len = data_len,
+ };
+
+ return nvme_submit_io_passthru64(fd, &cmd, result);
+}
* @NVME_IDENTIFY_CNS_NS_ACTIVE_LIST:
* @NVME_IDENTIFY_CNS_NS_DESC_LIST:
* @NVME_IDENTIFY_CNS_NVMSET_LIST:
+ * @NVME_IDENTIFY_CNS_CSI_NS:
+ * @NVME_IDENTIFY_CNS_CSI_CTRL:
* @NVME_IDENTIFY_CNS_ALLOCATED_NS_LIST:
* @NVME_IDENTIFY_CNS_ALLOCATED_NS:
* @NVME_IDENTIFY_CNS_NS_CTRL_LIST:
* @NVME_IDENTIFY_CNS_SECONDARY_CTRL_LIST:
* @NVME_IDENTIFY_CNS_NS_GRANULARITY:
* @NVME_IDENTIFY_CNS_UUID_LIST:
+ * @NVME_IDENTIFY_CNS_CSI_ALLOCATED_NS:
*/
enum nvme_identify_cns {
NVME_IDENTIFY_CNS_NS = 0x00,
NVME_IDENTIFY_CNS_NS_ACTIVE_LIST = 0x02,
NVME_IDENTIFY_CNS_NS_DESC_LIST = 0x03,
NVME_IDENTIFY_CNS_NVMSET_LIST = 0x04,
+ NVME_IDENTIFY_CNS_CSI_NS = 0x05, /* XXX: Placeholder until assigned */
+ NVME_IDENTIFY_CNS_CSI_CTRL = 0x06, /* XXX: Placeholder until assigned */
NVME_IDENTIFY_CNS_ALLOCATED_NS_LIST = 0x10,
NVME_IDENTIFY_CNS_ALLOCATED_NS = 0x11,
NVME_IDENTIFY_CNS_NS_CTRL_LIST = 0x12,
NVME_IDENTIFY_CNS_SECONDARY_CTRL_LIST = 0x15,
NVME_IDENTIFY_CNS_NS_GRANULARITY = 0x16,
NVME_IDENTIFY_CNS_UUID_LIST = 0x17,
+ NVME_IDENTIFY_CNS_CSI_ALLOCATED_NS = 0x18, /* XXX: Placeholder until assigned */
};
/**
* @NVME_LOG_LID_DISCOVER:
* @NVME_LOG_LID_RESERVATION:
* @NVME_LOG_LID_SANITIZE:
+ * @NVME_LOG_LID_ZNS_CHANGED_ZONES:
*/
enum nvme_cmd_get_log_lid {
NVME_LOG_LID_ERROR = 0x01,
NVME_LOG_LID_DISCOVER = 0x70,
NVME_LOG_LID_RESERVATION = 0x80,
NVME_LOG_LID_SANITIZE = 0x81,
+ NVME_LOG_LID_ZNS_CHANGED_ZONES = 0xbf,
};
/**
* @NVME_FEAT_FID_HOST_BEHAVIOR:
* @NVME_FEAT_FID_SANITIZE:
* @NVME_FEAT_FID_ENDURANCE_EVT_CFG:
+ * @NVME_FEAT_FID_IOCS_PROFILE:
* @NVME_FEAT_FID_SW_PROGRESS:
* @NVME_FEAT_FID_HOST_ID:
* @NVME_FEAT_FID_RESV_MASK:
NVME_FEAT_FID_HOST_BEHAVIOR = 0x16,
NVME_FEAT_FID_SANITIZE = 0x17,
NVME_FEAT_FID_ENDURANCE_EVT_CFG = 0x18,
+ NVME_FEAT_FID_IOCS_PROFILE = 0x19, /* XXX: Placeholder until assigned */
NVME_FEAT_FID_SW_PROGRESS = 0x80,
NVME_FEAT_FID_HOST_ID = 0x81,
NVME_FEAT_FID_RESV_MASK = 0x82,
* @cntid: The Controller Identifier, if applicable
* @nvmsetid: The NVMe Set ID if CNS is 04h
* @uuidx: UUID Index if controller supports this id selection method
+ * @csi: Command Set Identifier
* @data: User space destination address to transfer the data
*
* The Identify command returns a data buffer that describes information about
* &enum nvme_status_field) or -1 with errno set otherwise.
*/
int nvme_identify(int fd, enum nvme_identify_cns cns, __u32 nsid,
- __u16 cntid, __u16 nvmsetid, __u8 uuidx, void *data);
+ __u16 cntid, __u16 nvmsetid, __u8 uuidx, __u8 csi,
+ void *data);
/**
* nvme_identify_ctrl() - Retrieves nvme identify controller
*/
int nvme_identify_uuid(int fd, struct nvme_id_uuid_list *list);
+/**
+ * nvme_identify_ns_csi() -
+ * @fd: File descriptor of nvme device
+ * @nsid: Namespace to identify
+ * @csi: Command Set Identifier
+ * @data: User space destination address to transfer the data
+ *
+ * Return: The nvme command status if a response was received (see
+ * &enum nvme_status_field) or -1 with errno set otherwise.
+ */
+int nvme_identify_ns_csi(int fd, __u32 nsid, __u8 csi, void *data);
+
+/**
+ * nvme_identify_ctrl_csi() -
+ * @fd: File descriptor of nvme device
+ * @csi: Command Set Identifier
+ * @data: User space destination address to transfer the data
+ *
+ * Return: The nvme command status if a response was received (see
+ * &enum nvme_status_field) or -1 with errno set otherwise.
+ */
+int nvme_identify_ctrl_csi(int fd, __u8 csi, void *data);
+
+/**
+ * nvme_identify_iocs() -
+ * @fd: File descriptor of nvme device
+ * @iocs: User space destination address to transfer the data
+ *
+ * Retrieves list of the controller's supported io command set vectors. See
+ * @struct nvme_id_iocs.
+ *
+ * Return: The nvme command status if a response was received (see
+ * &enum nvme_status_field) or -1 with errno set otherwise.
+ */
+int nvme_identify_iocs(int fd, struct nvme_id_iocs *iocs);
+
+/**
+ * nvme_zns_identify_ns() -
+ * @fd: File descriptor of nvme device
+ * @nsid: Namespace to identify
+ * @data: User space destination address to transfer the data
+ *
+ * Return: The nvme command status if a response was received (see
+ * &enum nvme_status_field) or -1 with errno set otherwise.
+ */
+int nvme_zns_identify_ns(int fd, __u32 nsid, struct nvme_zns_id_ns *data);
+
+/**
+ * nvme_zns_identify_ctrl() -
+ * @fd: File descriptor of nvme device
+ * @data: User space destination address to transfer the data
+ *
+ * Return: The nvme command status if a response was received (see
+ * &enum nvme_status_field) or -1 with errno set otherwise.
+ */
+int nvme_zns_identify_ctrl(int fd, struct nvme_zns_id_ctrl *data);
+
/**
* nvme_get_log() - NVMe Admin Get Log command
* @fd: File descriptor of nvme device
* &enum nvme_status_field) or -1 with errno set otherwise.
*/
int nvme_get_log(int fd, enum nvme_cmd_get_log_lid lid, __u32 nsid, __u64 lpo,
- __u8 lsp, __u16 lsi, bool rae, __u8 uuidx, __u32 len, void *log);
+ __u8 lsp, __u16 lsi, bool rae, __u8 uuidx, enum nvme_csi csi,
+ __u32 len, void *log);
/**
* nvme_get_log_error() - Retrieve nvme error log
/**
* nvme_get_log_cmd_effects() - Retrieve nvme command effects log
* @fd: File descriptor of nvme device
+ * @csi: Command Set Identifier
* @effects_log:User address to store the effects log
*
* This log page describes the commands that the controller supports and the
* Return: The nvme command status if a response was received (see
* &enum nvme_status_field) or -1 with errno set otherwise.
*/
-int nvme_get_log_cmd_effects(int fd, struct nvme_cmd_effects_log *log);
+int nvme_get_log_cmd_effects(int fd, enum nvme_csi csi,
+ struct nvme_cmd_effects_log *log);
/**
* nvme_get_log_device_self_test() - Retrieve the device self test log
int nvme_get_log_sanitize(int fd, bool rae,
struct nvme_sanitize_log_page *log);
+/**
+ * nvme_get_log_zns_changed_zones() -
+ * @fd: File descriptor of nvme device
+ * @nsid: Namespace ID
+ * @rae: Retain asynchronous events
+ * @log: User address to store the changed zone log
+ *
+ * The list of zones that have changed state due to an exceptional event.
+ *
+ * Return: The nvme command status if a response was received (see
+ * &enum nvme_status_field) or -1 with errno set otherwise.
+ */
+int nvme_get_log_zns_changed_zones(int fd, __u32 nsid, bool rae,
+ struct nvme_zns_changed_zone_log *log);
+
/**
* nvme_set_features() - Set a feature attribute
* @fd: File descriptor of nvme device
int nvme_set_features_write_protect(int fd, enum nvme_feat_nswpcfg_state state,
bool save, __u32 *result);
+/**
+ * nvme_set_features_iocs_profile() -
+ * @fd: File descriptor of nvme device
+ * @iocsi: IO Command Set Combination Index
+ * @save: Save value across power states
+ *
+ * Return: The nvme command status if a response was received (see
+ * &enum nvme_status_field) or -1 with errno set otherwise.
+ */
+int nvme_set_features_iocs_profile(int fd, __u8 iocsi, bool save);
+
/**
* nvme_get_features() - Retrieve a feature attribute
* @fd: File descriptor of nvme device
int nvme_get_features_lba_range(int fd, enum nvme_get_features_sel sel,
struct nvme_lba_range_type *data,
__u32 *result);
-
/**
* nvme_get_features_temp_thresh() -
* @fd: File descriptor of nvme device
enum nvme_get_features_sel sel,
__u32 *result);
+/**
+ * nvme_get_features_iocs_profile() -
+ * @fd: File descriptor of nvme device
+ * @sel: Select which type of attribute to return, see &enum nvme_get_features_sel
+ * @result: The command completion result from CQE dword0
+ *
+ * Return: The nvme command status if a response was received (see
+ * &enum nvme_status_field) or -1 with errno set otherwise.
+ */
+int nvme_get_features_iocs_profile(int fd, enum nvme_get_features_sel sel,
+ __u32 *result);
/**
* nvme_format_nvm() - Format nvme namespace(s)
nvme_cmd_resv_report = 0x0e,
nvme_cmd_resv_acquire = 0x11,
nvme_cmd_resv_release = 0x15,
+ nvme_zns_cmd_mgmt_send = 0x79,
+ nvme_zns_cmd_mgmt_recv = 0x7a,
+ nvme_zns_cmd_append = 0x7d,
};
/**
* enum nvme_io_control_flags -
* @NVME_IO_DTYPE_STREAMS:
* @NVME_IO_DEAC:
+ * @NVME_IO_ZNS_APPEND_PIREMAP:
* @NVME_IO_PRINFO_PRCHK_REF:
* @NVME_IO_PRINFO_PRCHK_APP:
* @NVME_IO_PRINFO_PRCHK_GUARD:
enum nvme_io_control_flags {
NVME_IO_DTYPE_STREAMS = 1 << 4,
NVME_IO_DEAC = 1 << 9,
+ NVME_IO_ZNS_APPEND_PIREMAP = 1 << 9,
NVME_IO_PRINFO_PRCHK_REF = 1 << 10,
NVME_IO_PRINFO_PRCHK_APP = 1 << 11,
NVME_IO_PRINFO_PRCHK_GUARD = 1 << 12,
*/
int nvme_resv_report(int fd, __u32 nsid, bool eds, __u32 len,
struct nvme_resv_status *report);
+
+enum nvme_zns_send_action {
+ NVME_ZNS_ZSA_CLOSE = 0x1,
+ NVME_ZNS_ZSA_FINISH = 0x2,
+ NVME_ZNS_ZSA_OPEN = 0x3,
+ NVME_ZNS_ZSA_RESET = 0x4,
+ NVME_ZNS_ZSA_OFFLINE = 0x5,
+ NVME_ZNS_ZSA_SET_DESC_EXT = 0x10,
+};
+
+/**
+ * nvme_zns_mgmt_send() -
+ * @fd: File descriptor of nvme device
+ * @nsid: Namespace ID
+ * @slba:
+ * @select_all:
+ * @zsa:
+ * @data_len:
+ * @data:
+ *
+ * Return: The nvme command status if a response was received (see
+ * &enum nvme_status_field) or -1 with errno set otherwise.
+ */
+int nvme_zns_mgmt_send(int fd, __u32 nsid, __u64 slba, bool select_all,
+ enum nvme_zns_send_action zsa, __u32 data_len,
+ void *data);
+
+/**
+ * enum nvme_zns_recv_action -
+ */
+enum nvme_zns_recv_action {
+ NVME_ZNS_ZRA_REPORT_ZONES = 0x0,
+ NVME_ZNS_ZRA_EXTENDED_REPORT_ZONES = 0x1,
+};
+
+/**
+ * enum nvme_zns_recv_action_spec -
+ */
+enum nvme_zns_recv_action_spec {
+ NVME_ZNS_ZRAS_REPORT_ALL = 0x0,
+ NVME_ZNS_ZRAS_REPORT_EMPTY = 0x1,
+ NVME_ZNS_ZRAS_REPORT_IMPL_OPENED = 0x2,
+ NVME_ZNS_ZRAS_REPORT_EXPL_OPENED = 0x3,
+ NVME_ZNS_ZRAS_REPORT_CLOSED = 0x4,
+ NVME_ZNS_ZRAS_REPORT_FULL = 0x5,
+ NVME_ZNS_ZRAS_REPORT_READ_ONLY = 0x6,
+ NVME_ZNS_ZRAS_REPORT_OFFLINE = 0x7,
+};
+
+/**
+ * nvme_zns_mgmt_recv() -
+ * @fd: File descriptor of nvme device
+ * @nsid: Namespace ID
+ *
+ * Return: The nvme command status if a response was received (see
+ * &enum nvme_status_field) or -1 with errno set otherwise.
+ */
+int nvme_zns_mgmt_recv(int fd, __u32 nsid, __u64 slba,
+ enum nvme_zns_recv_action zra, __u16 zrasf,
+ bool zras_feat, __u32 data_len, void *data);
+
+/**
+ * nvme_zns_append() -
+ * @fd: File descriptor of nvme device
+ * @nsid: Namespace ID
+ *
+ * Return: The nvme command status if a response was received (see
+ * &enum nvme_status_field) or -1 with errno set otherwise.
+ */
+int nvme_zns_append(int fd, __u32 nsid, __u64 zslba, __u16 nlb, __u16 control,
+ __u32 ilbrt, __u16 lbat, __u16 lbatm, __u32 data_len,
+ void *data, __u32 metadata_len, void *metadata,
+ __u64 *result);
+
#endif /* _LIBNVME_IOCTL_H */