import nvme-cli-1.16-5.el8

This commit is contained in:
CentOS Sources 2022-07-18 18:10:20 +00:00 committed by Stepan Oksanichenko
parent 57fb1e38fe
commit 132481b2d4
9 changed files with 647 additions and 1 deletions

View File

@ -0,0 +1,59 @@
From db50dbf5692325cfef8fb77e56e1e44af83a022e Mon Sep 17 00:00:00 2001
From: Maurizio Lombardi <mlombard@redhat.com>
Date: Wed, 29 Jun 2022 16:47:30 +0200
Subject: [PATCH 1/7] nvme-cli: nvme gen-hostnqn use partition UUID on IBM
POWER
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
---
nvme.c | 27 +++++++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)
diff --git a/nvme.c b/nvme.c
index 5beeac78..0535ed2b 100644
--- a/nvme.c
+++ b/nvme.c
@@ -6516,6 +6516,26 @@ static int admin_passthru(int argc, char **argv, struct command *cmd, struct plu
return passthru(argc, argv, NVME_IOCTL_ADMIN_CMD, 1, desc, cmd);
}
+#define PATH_UUID_IBM "/proc/device-tree/ibm,partition-uuid"
+
+static int uuid_from_device_tree(char *system_uuid)
+{
+ ssize_t len;
+ int f;
+
+ f = open(PATH_UUID_IBM, O_RDONLY);
+ if (f < 0)
+ return -ENXIO;
+
+ memset(system_uuid, 0, 37);
+ len = read(f, system_uuid, 37 - 1);
+ close(f);
+ if (len < 0)
+ return -ENXIO;
+
+ return strlen(system_uuid) ? 0 : -ENXIO;
+}
+
static int gen_hostnqn_cmd(int argc, char **argv, struct command *command, struct plugin *plugin)
{
int ret;
@@ -6525,8 +6545,11 @@ static int gen_hostnqn_cmd(int argc, char **argv, struct command *command, struc
#endif
ret = uuid_from_dmi(uuid_str);
- if (ret < 0)
- ret = uuid_from_systemd(uuid_str);
+ if (ret < 0) {
+ ret = uuid_from_device_tree(uuid_str);
+ if (ret < 0)
+ ret = uuid_from_systemd(uuid_str);
+ }
#ifdef LIBUUID
if (ret < 0) {
uuid_generate_random(uuid);
--
2.31.1

View File

@ -0,0 +1,41 @@
From f491884513bfba7bb007428e4664c2dfda21d424 Mon Sep 17 00:00:00 2001
From: Maurizio Lombardi <mlombard@redhat.com>
Date: Wed, 29 Jun 2022 17:33:10 +0200
Subject: [PATCH 2/7] Add new events support in PEL
Add two new events support in header file.
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
---
linux/nvme.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/linux/nvme.h b/linux/nvme.h
index 7a925c7a..8b4c6833 100644
--- a/linux/nvme.h
+++ b/linux/nvme.h
@@ -862,6 +862,12 @@ struct nvme_thermal_exc_event {
__u8 threshold;
};
+/* persistent event type 0Bh */
+struct nvme_set_feature_event {
+ __le32 layout;
+ __le32 cdw_mem[0];
+};
+
/* persistent event entry head */
struct nvme_persistent_event_entry_head {
__u8 etype;
@@ -909,6 +915,8 @@ enum nvme_persistent_event_types {
NVME_FORMAT_COMPLETION_EVENT = 0x08,
NVME_SANITIZE_START_EVENT = 0x09,
NVME_SANITIZE_COMPLETION_EVENT = 0x0a,
+ NVME_SET_FEATURE_EVENT = 0x0b,
+ NVME_TELEMETRY_CRT = 0x0c,
NVME_THERMAL_EXCURSION_EVENT = 0x0d
};
--
2.31.1

View File

@ -0,0 +1,146 @@
From a0db61992c14b34fcf6787b957d5d5d0e77c6f33 Mon Sep 17 00:00:00 2001
From: Maurizio Lombardi <mlombard@redhat.com>
Date: Wed, 29 Jun 2022 18:00:44 +0200
Subject: [PATCH 3/7] nvme-cli: Decode "Supported Events Bitmap" in PEL header
"Supported Events Bitmap" in PEL header shows what events
are supported in current nvme devices.
Persistent Event Log for device: nvme0n1
Action for Persistent Event Log: 0
..
..
..
Supported Events Bitmap:
Support SMART/Health Log Snapshot Event(0x1)
Support Firmware Commit Event(0x2)
Support Timestamp Change Event(0x3)
Support Power-on or Reset Event(0x4)
Support NVM Subsystem Hardware Error Event(0x5)
Support Change Namespace Event(0x6)
Support Format NVM Start Event(0x7)
Support Format NVM Completion Event(0x8)
Support Sanitize Start Event(0x9)
Support Sanitize Completion Event(0xa)
Support Set Feature Event(0xb)
Support Set Telemetry CRT Event(0xc)
Support Thermal Excursion Event(0xd)
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
---
nvme-print.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++------
nvme.c | 4 ++--
2 files changed, 48 insertions(+), 8 deletions(-)
diff --git a/nvme-print.c b/nvme-print.c
index f631b347..21524a50 100755
--- a/nvme-print.c
+++ b/nvme-print.c
@@ -1015,6 +1015,26 @@ void nvme_show_predictable_latency_event_agg_log(
}
}
+const char *nvme_pel_event_to_string(int type)
+{
+ switch (type) {
+ case NVME_SMART_HEALTH_EVENT: return "SMART/Health Log Snapshot Event(0x1)";
+ case NVME_FW_COMMIT_EVENT: return "Firmware Commit Event(0x2)";
+ case NVME_TIMESTAMP_EVENT: return "Timestamp Change Event(0x3)";
+ case NVME_POWER_ON_RESET_EVENT: return "Power-on or Reset Event(0x4)";
+ case NVME_NSS_HW_ERROR_EVENT: return "NVM Subsystem Hardware Error Event(0x5)";
+ case NVME_CHANGE_NS_EVENT: return "Change Namespace Event(0x6)";
+ case NVME_FORMAT_START_EVENT: return "Format NVM Start Event(0x7)";
+ case NVME_FORMAT_COMPLETION_EVENT: return "Format NVM Completion Event(0x8)";
+ case NVME_SANITIZE_START_EVENT: return "Sanitize Start Event(0x9)";
+ case NVME_SANITIZE_COMPLETION_EVENT: return "Sanitize Completion Event(0xa)";
+ case NVME_SET_FEATURE_EVENT: return "Set Feature Event(0xb)";
+ case NVME_TELEMETRY_CRT: return "Set Telemetry CRT Event(0xc)";
+ case NVME_THERMAL_EXCURSION_EVENT: return "Thermal Excursion Event(0xd)";
+ default: return NULL;
+ }
+}
+
static const char *nvme_show_nss_hw_error(__u16 error_code)
{
switch (error_code) {
@@ -1043,6 +1063,29 @@ static const char *nvme_show_nss_hw_error(__u16 error_code)
}
}
+static void add_bitmap(int i, __u8 seb, struct json_object *root, int json_flag)
+{
+ char evt_str[50];
+ char key[128];
+
+ for (int bit = 0; bit < 8; bit++) {
+ if (nvme_pel_event_to_string(bit + i * 8)) {
+ if (json_flag == 1) {
+ sprintf(key, "bitmap_%x", (bit + i * 8));
+ if ((seb >> bit) & 0x1)
+ snprintf(evt_str, sizeof(evt_str), "Support %s",
+ nvme_pel_event_to_string(bit + i * 8));
+ json_object_add_value_string(root, key, evt_str);
+ } else {
+ if (nvme_pel_event_to_string(bit + i * 8))
+ if ((seb >> bit) & 0x1)
+ printf(" Support %s\n",
+ nvme_pel_event_to_string(bit + i * 8));
+ }
+ }
+ }
+}
+
void json_persistent_event_log(void *pevent_log_info, __u32 size)
{
struct json_object *root;
@@ -1112,9 +1155,7 @@ void json_persistent_event_log(void *pevent_log_info, __u32 size)
for (int i = 0; i < 32; i++) {
if (pevent_log_head->supp_event_bm[i] == 0)
continue;
- sprintf(key, "bitmap_%d", i);
- json_object_add_value_uint(root, key,
- pevent_log_head->supp_event_bm[i]);
+ add_bitmap(i, pevent_log_head->supp_event_bm[i], root, 1);
}
} else {
printf("No log data can be shown with this log len at least " \
@@ -1440,12 +1481,11 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
le32_to_cpu(pevent_log_head->rci));
if(human)
nvme_show_persistent_event_log_rci(pevent_log_head->rci);
- printf("Supported Events Bitmap: ");
+ printf("Supported Events Bitmap: \n");
for (int i = 0; i < 32; i++) {
if (pevent_log_head->supp_event_bm[i] == 0)
continue;
- printf("BitMap[%d] is 0x%x\n", i,
- pevent_log_head->supp_event_bm[i]);
+ add_bitmap(i, pevent_log_head->supp_event_bm[i], NULL, 0);
}
} else {
printf("No log data can be shown with this log len at least " \
diff --git a/nvme.c b/nvme.c
index 0535ed2b..44c53e6b 100644
--- a/nvme.c
+++ b/nvme.c
@@ -4808,7 +4808,7 @@ static int dsm(int argc, char **argv, struct command *cmd, struct plugin *plugin
nc = argconfig_parse_comma_sep_array(cfg.ctx_attrs, ctx_attrs, ARRAY_SIZE(ctx_attrs));
nb = argconfig_parse_comma_sep_array(cfg.blocks, nlbs, ARRAY_SIZE(nlbs));
- ns = argconfig_parse_comma_sep_array_long(cfg.slbas, slbas, ARRAY_SIZE(slbas));
+ ns = argconfig_parse_comma_sep_array_long(cfg.slbas, (long long unsigned int *)slbas, ARRAY_SIZE(slbas));
nr = max(nc, max(nb, ns));
if (!nr || nr > 256) {
fprintf(stderr, "No range definition provided\n");
@@ -4963,7 +4963,7 @@ static int copy(int argc, char **argv, struct command *cmd, struct plugin *plugi
}
}
- copy = nvme_setup_copy_range(nlbs, slbas, eilbrts, elbatms, elbats, nr);
+ copy = nvme_setup_copy_range(nlbs, (__u64 *)slbas, eilbrts, elbatms, elbats, nr);
if (!copy) {
fprintf(stderr, "failed to allocate payload\n");
errno = ENOMEM;
--
2.31.1

View File

@ -0,0 +1,141 @@
From 6c916ee527e14bf4c4640ffeef8efdd891ba9ef4 Mon Sep 17 00:00:00 2001
From: Maurizio Lombardi <mlombard@redhat.com>
Date: Thu, 30 Jun 2022 16:17:44 +0200
Subject: [PATCH 4/7] nvme-cli: Adds event number in persistent event entries
Persistent Event Entries:
Event Number: 0
Event Type: SMART/Health Log Snapshot Event(0x1)
Event Type Revision: 1
Event Header Length: 21
Controller Identifier: 66
Event Timestamp: 44392
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
---
nvme-print.c | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/nvme-print.c b/nvme-print.c
index 21524a50..3b82b174 100755
--- a/nvme-print.c
+++ b/nvme-print.c
@@ -1174,8 +1174,9 @@ void json_persistent_event_log(void *pevent_log_info, __u32 size)
break;
valid_attrs = json_create_object();
- json_object_add_value_uint(valid_attrs, "event_type",
- pevent_entry_head->etype);
+ json_object_add_value_uint(valid_attrs, "event_number", i);
+ json_object_add_value_string(valid_attrs, "event_type",
+ nvme_pel_event_to_string(pevent_entry_head->etype));
json_object_add_value_uint(valid_attrs, "event_type_rev",
pevent_entry_head->etype_rev);
json_object_add_value_uint(valid_attrs, "event_header_len",
@@ -1505,7 +1506,8 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
le16_to_cpu(pevent_entry_head->el)) >= size)
break;
- printf("Event Type: %u\n", pevent_entry_head->etype);
+ printf("Event Number: %u\n", i);
+ printf("Event Type: %s\n", nvme_pel_event_to_string(pevent_entry_head->etype));
printf("Event Type Revision: %u\n", pevent_entry_head->etype_rev);
printf("Event Header Length: %u\n", pevent_entry_head->ehl);
printf("Controller Identifier: %u\n",
@@ -1521,12 +1523,12 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
switch (pevent_entry_head->etype) {
case NVME_SMART_HEALTH_EVENT:
smart_event = pevent_log_info + offset;
- printf("Smart Health Event: \n");
+ printf("Smart Health Event Entry: \n");
nvme_show_smart_log(smart_event, NVME_NSID_ALL, devname, flags);
break;
case NVME_FW_COMMIT_EVENT:
fw_commit_event = pevent_log_info + offset;
- printf("FW Commit Event: \n");
+ printf("FW Commit Event Entry: \n");
printf("Old Firmware Revision: %"PRIu64"\n",
le64_to_cpu(fw_commit_event->old_fw_rev));
printf("New Firmware Revision: %"PRIu64"\n",
@@ -1543,7 +1545,7 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
break;
case NVME_TIMESTAMP_EVENT:
ts_change_event = pevent_log_info + offset;
- printf("Time Stamp Change Event: \n");
+ printf("Time Stamp Change Event Entry: \n");
printf("Previous Timestamp: %"PRIu64"\n",
le64_to_cpu(ts_change_event->previous_timestamp));
printf("Milliseconds Since Reset: %"PRIu64"\n",
@@ -1555,7 +1557,7 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
por_info_list = por_info_len / sizeof(*por_event);
- printf("Power On Reset Event: \n");
+ printf("Power On Reset Event Entry: \n");
fw_rev = pevent_log_info + offset;
printf("Firmware Revision: %"PRIu64"\n", le64_to_cpu(*fw_rev));
printf("Reset Information List: \n");
@@ -1578,13 +1580,13 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
break;
case NVME_NSS_HW_ERROR_EVENT:
nss_hw_err_event = pevent_log_info + offset;
- printf("NVM Subsystem Hardware Error Event Code: %u, %s\n",
+ printf("NVM Subsystem Hardware Error Event Code Entry: %u, %s\n",
le16_to_cpu(nss_hw_err_event->nss_hw_err_event_code),
nvme_show_nss_hw_error(nss_hw_err_event->nss_hw_err_event_code));
break;
case NVME_CHANGE_NS_EVENT:
ns_event = pevent_log_info + offset;
- printf("Change Namespace Event: \n");
+ printf("Change Namespace Event Entry: \n");
printf("Namespace Management CDW10: %u\n",
le32_to_cpu(ns_event->nsmgt_cdw10));
printf("Namespace Size: %"PRIu64"\n",
@@ -1603,7 +1605,7 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
break;
case NVME_FORMAT_START_EVENT:
format_start_event = pevent_log_info + offset;
- printf("Format NVM Start Event: \n");
+ printf("Format NVM Start Event Entry: \n");
printf("Namespace Identifier: %u\n",
le32_to_cpu(format_start_event->nsid));
printf("Format NVM Attributes: %u\n",
@@ -1613,7 +1615,7 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
break;
case NVME_FORMAT_COMPLETION_EVENT:
format_cmpln_event = pevent_log_info + offset;
- printf("Format NVM Completion Event: \n");
+ printf("Format NVM Completion Event Entry: \n");
printf("Namespace Identifier: %u\n",
le32_to_cpu(format_cmpln_event->nsid));
printf("Smallest Format Progress Indicator: %u\n",
@@ -1627,7 +1629,7 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
break;
case NVME_SANITIZE_START_EVENT:
sanitize_start_event = pevent_log_info + offset;
- printf("Sanitize Start Event: \n");
+ printf("Sanitize Start Event Entry: \n");
printf("SANICAP: %u\n", sanitize_start_event->sani_cap);
printf("Sanitize CDW10: %u\n",
le32_to_cpu(sanitize_start_event->sani_cdw10));
@@ -1636,7 +1638,7 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
break;
case NVME_SANITIZE_COMPLETION_EVENT:
sanitize_cmpln_event = pevent_log_info + offset;
- printf("Sanitize Completion Event: \n");
+ printf("Sanitize Completion Event Entry: \n");
printf("Sanitize Progress: %u\n",
le16_to_cpu(sanitize_cmpln_event->sani_prog));
printf("Sanitize Status: %u\n",
@@ -1646,7 +1648,7 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
break;
case NVME_THERMAL_EXCURSION_EVENT:
thermal_exc_event = pevent_log_info + offset;
- printf("Thermal Excursion Event: \n");
+ printf("Thermal Excursion Event Entry: \n");
printf("Over Temperature: %u\n", thermal_exc_event->over_temp);
printf("Threshold: %u\n", thermal_exc_event->threshold);
break;
--
2.31.1

View File

@ -0,0 +1,113 @@
From 7e858ab53eb23083205d75f590ca2c2b256c2a7b Mon Sep 17 00:00:00 2001
From: Maurizio Lombardi <mlombard@redhat.com>
Date: Thu, 30 Jun 2022 16:37:40 +0200
Subject: [PATCH 5/7] nvme-cli: Adds readable firmware level in persistent
For example, In Firmware Commit Event:
Old Firmware Revision: 3617604718875264338
New Firmware Revision: 3833777500989048146
changes to
Old Firmware Revision: 3617604718875264338 (REV.SP42)
New Firmware Revision: 3833777500989048146 (REV.SP45)
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
---
nvme-print.c | 43 ++++++++++++++++++++++++++++---------------
1 file changed, 28 insertions(+), 15 deletions(-)
diff --git a/nvme-print.c b/nvme-print.c
index 3b82b174..74ecd95a 100755
--- a/nvme-print.c
+++ b/nvme-print.c
@@ -104,12 +104,15 @@ const char *nvme_cmd_to_string(int admin, __u8 opcode)
return "Unknown";
}
-static char *fw_to_string(__u8 fw[])
+static const char *fw_to_string(char *c)
{
- static char frs[9];
+ static char ret[9];
+ int i;
- snprintf(frs, sizeof(frs), "%-.*s", 8, fw);
- return frs;
+ for (i = 0; i < 8; i++)
+ ret[i] = c[i] >= '!' && c[i] <= '~' ? c[i] : '.';
+ ret[i] = '\0';
+ return ret;
}
static const char *get_sanitize_log_sstat_status_str(__u16 status)
@@ -1094,6 +1097,7 @@ void json_persistent_event_log(void *pevent_log_info, __u32 size)
__u32 offset, por_info_len, por_info_list;
__u64 *fw_rev;
char key[128];
+ char fw_str[50];
struct nvme_smart_log *smart_event;
struct nvme_fw_commit_event *fw_commit_event;
struct nvme_time_stamp_change_event *ts_change_event;
@@ -1266,10 +1270,14 @@ void json_persistent_event_log(void *pevent_log_info, __u32 size)
break;
case NVME_FW_COMMIT_EVENT:
fw_commit_event = pevent_log_info + offset;
- json_object_add_value_uint(valid_attrs, "old_fw_rev",
- le64_to_cpu(fw_commit_event->old_fw_rev));
- json_object_add_value_uint(valid_attrs, "new_fw_rev",
- le64_to_cpu(fw_commit_event->new_fw_rev));
+ snprintf(fw_str, sizeof(fw_str), "%"PRIu64" (%s)",
+ le64_to_cpu(fw_commit_event->old_fw_rev),
+ fw_to_string((char *)&fw_commit_event->old_fw_rev));
+ json_object_add_value_string(valid_attrs, "old_fw_rev", fw_str);
+ snprintf(fw_str, sizeof(fw_str), "%"PRIu64" (%s)",
+ le64_to_cpu(fw_commit_event->new_fw_rev),
+ fw_to_string((char *)&fw_commit_event->new_fw_rev));
+ json_object_add_value_string(valid_attrs, "new_fw_rev", fw_str);
json_object_add_value_uint(valid_attrs, "fw_commit_action",
fw_commit_event->fw_commit_action);
json_object_add_value_uint(valid_attrs, "fw_slot",
@@ -1297,8 +1305,10 @@ void json_persistent_event_log(void *pevent_log_info, __u32 size)
por_info_list = por_info_len / sizeof(*por_event);
fw_rev = pevent_log_info + offset;
- json_object_add_value_uint(valid_attrs, "fw_rev",
- le64_to_cpu(*fw_rev));
+ snprintf(fw_str, sizeof(fw_str), "%"PRIu64" (%s)",
+ le64_to_cpu(*fw_rev),
+ fw_to_string((char *)fw_rev));
+ json_object_add_value_string(valid_attrs, "fw_rev", fw_str);
for (int i = 0; i < por_info_list; i++) {
por_event = pevent_log_info + offset +
sizeof(*fw_rev) + i * sizeof(*por_event);
@@ -1529,10 +1539,12 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
case NVME_FW_COMMIT_EVENT:
fw_commit_event = pevent_log_info + offset;
printf("FW Commit Event Entry: \n");
- printf("Old Firmware Revision: %"PRIu64"\n",
- le64_to_cpu(fw_commit_event->old_fw_rev));
- printf("New Firmware Revision: %"PRIu64"\n",
- le64_to_cpu(fw_commit_event->new_fw_rev));
+ printf("Old Firmware Revision: %"PRIu64" (%s)\n",
+ le64_to_cpu(fw_commit_event->old_fw_rev),
+ fw_to_string((char *)&fw_commit_event->old_fw_rev));
+ printf("New Firmware Revision: %"PRIu64" (%s)\n",
+ le64_to_cpu(fw_commit_event->new_fw_rev),
+ fw_to_string((char *)&fw_commit_event->new_fw_rev));
printf("FW Commit Action: %u\n",
fw_commit_event->fw_commit_action);
printf("FW Slot: %u\n", fw_commit_event->fw_slot);
@@ -1559,7 +1571,8 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
printf("Power On Reset Event Entry: \n");
fw_rev = pevent_log_info + offset;
- printf("Firmware Revision: %"PRIu64"\n", le64_to_cpu(*fw_rev));
+ printf("Firmware Revision: %"PRIu64" (%s)\n", le64_to_cpu(*fw_rev),
+ fw_to_string((char *)fw_rev));
printf("Reset Information List: \n");
for (int i = 0; i < por_info_list; i++) {
--
2.31.1

View File

@ -0,0 +1,69 @@
From 859b8ee99a725bdcfbb7c8352c50449d126cffc4 Mon Sep 17 00:00:00 2001
From: Maurizio Lombardi <mlombard@redhat.com>
Date: Thu, 30 Jun 2022 16:41:59 +0200
Subject: [PATCH 6/7] nvme-cli: Add support set feature event in PEL
Add "Set Feature" event in PEL.
Persistent Event Entries:
Event Number: 0
Event Type: Set Feature Event(0xb)
Event Type Revision: 1
Event Header Length: 21
Controller Identifier: 65
Event Timestamp: 564587204146155
Vendor Specific Information Length: 0
Event Length: 16
Set Feature Event Entry:
Set Feature ID :0x7 (Number of Queues), value:0x270027
Number of IO Completion Queues Allocated (NCQA): 40
Number of IO Submission Queues Allocated (NSQA): 40
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
---
nvme-print.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/nvme-print.c b/nvme-print.c
index 74ecd95a..37011dbe 100755
--- a/nvme-print.c
+++ b/nvme-print.c
@@ -1436,6 +1436,8 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
{
__u32 offset, por_info_len, por_info_list;
__u64 *fw_rev;
+ int fid, cdw11, dword_cnt;
+ unsigned char *mem_buf = NULL;
struct nvme_smart_log *smart_event;
struct nvme_fw_commit_event *fw_commit_event;
struct nvme_time_stamp_change_event *ts_change_event;
@@ -1446,6 +1448,7 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
struct nvme_format_nvm_compln_event *format_cmpln_event;
struct nvme_sanitize_start_event *sanitize_start_event;
struct nvme_sanitize_compln_event *sanitize_cmpln_event;
+ struct nvme_set_feature_event *set_feat_event;
struct nvme_thermal_exc_event *thermal_exc_event;
struct nvme_persistent_event_log_head *pevent_log_head;
struct nvme_persistent_event_entry_head *pevent_entry_head;
@@ -1659,6 +1662,18 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
printf("Completion Information: %u\n",
le16_to_cpu(sanitize_cmpln_event->cmpln_info));
break;
+ case NVME_SET_FEATURE_EVENT:
+ set_feat_event = pevent_log_info + offset;
+ printf("Set Feature Event Entry: \n");
+ dword_cnt = set_feat_event->layout & 0x03;
+ fid = le32_to_cpu(set_feat_event->cdw_mem[0]) & 0x000f;
+ cdw11 = le32_to_cpu(set_feat_event->cdw_mem[1]);
+ if (((set_feat_event->layout & 0xff) >> 2) != 0)
+ mem_buf = (unsigned char *)(set_feat_event + 4 + dword_cnt * 4);
+ printf("Set Feature ID :%#02x (%s), value:%#08x\n", fid,
+ nvme_feature_to_string(fid), cdw11);
+ nvme_feature_show_fields(fid, cdw11, mem_buf);
+ break;
case NVME_THERMAL_EXCURSION_EVENT:
thermal_exc_event = pevent_log_info + offset;
printf("Thermal Excursion Event Entry: \n");
--
2.31.1

View File

@ -0,0 +1,29 @@
From 44b23d2daf246db0ac09a4a79a9a5161843a4936 Mon Sep 17 00:00:00 2001
From: Maurizio Lombardi <mlombard@redhat.com>
Date: Thu, 30 Jun 2022 16:44:07 +0200
Subject: [PATCH 7/7] nvme-cli: Add support Telemetry CRT in PEL
Add "Telemetry CRT" event in PEL.
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
---
nvme-print.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/nvme-print.c b/nvme-print.c
index 37011dbe..992b9b83 100755
--- a/nvme-print.c
+++ b/nvme-print.c
@@ -1674,6 +1674,9 @@ void nvme_show_persistent_event_log(void *pevent_log_info,
nvme_feature_to_string(fid), cdw11);
nvme_feature_show_fields(fid, cdw11, mem_buf);
break;
+ case NVME_TELEMETRY_CRT:
+ d(pevent_log_info + offset, 512, 16, 1);
+ break;
case NVME_THERMAL_EXCURSION_EVENT:
thermal_exc_event = pevent_log_info + offset;
printf("Thermal Excursion Event Entry: \n");
--
2.31.1

View File

@ -0,0 +1,26 @@
From b3db6509e1f70bdde9205ab97bd87fbb94a49f0a Mon Sep 17 00:00:00 2001
From: Maurizio Lombardi <mlombard@redhat.com>
Date: Fri, 15 Jul 2022 11:10:59 +0200
Subject: [PATCH] fix firmware log page frs variable sign
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
---
linux/nvme.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/linux/nvme.h b/linux/nvme.h
index 8b4c6833..2c402688 100644
--- a/linux/nvme.h
+++ b/linux/nvme.h
@@ -1539,7 +1539,7 @@ struct nvme_error_log_page {
struct nvme_firmware_log_page {
__u8 afi;
__u8 resv[7];
- __u8 frs[7][8];
+ char frs[7][8];
__u8 resv2[448];
};
--
2.31.1

View File

@ -3,7 +3,7 @@
Name: nvme-cli
Version: 1.16
Release: 3%{?dist}
Release: 5%{?dist}
Summary: NVMe management command line interface
License: GPLv2+
@ -18,6 +18,14 @@ Patch4: 0004-nvme-do-not-leak-an-open-file-handle.patch
Patch5: 0005-nvme-topology-fix-memory-leaks-in-nvme_logical_block.patch
Patch6: 0006-nvme-cli-nvmf-connect-.service-Remove-matching-from-.patch
Patch7: 0007-nvme-cli-Make-connect-all-matching-be-case-insensiti.patch
Patch8: 0008-nvme-cli-nvme-gen-hostnqn-use-partition-UUID-on-IBM-.patch
Patch9: 0009-Add-new-events-support-in-PEL.patch
Patch10: 0010-nvme-cli-Decode-Supported-Events-Bitmap-in-PEL-heade.patch
Patch11: 0011-nvme-cli-Adds-event-number-in-persistent-event-entri.patch
Patch12: 0012-nvme-cli-Adds-readable-firmware-level-in-persistent.patch
Patch13: 0013-nvme-cli-Add-support-set-feature-event-in-PEL.patch
Patch14: 0014-nvme-cli-Add-support-Telemetry-CRT-in-PEL.patch
Patch15: 0015-fix-firmware-log-page-frs-variable-sign.patch
BuildRequires: libuuid-devel
BuildRequires: gcc
@ -38,6 +46,14 @@ nvme-cli provides NVM-Express user space tooling for Linux.
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%build
@ -94,6 +110,12 @@ if [ $1 -eq 1 ] || [ $1 -eq 2 ]; then
fi
%changelog
* Fri Jul 15 2022 Maurizio Lombardi <mlombard@redhat.com> - 1.16-5
- Fix a compiler warning
* Tue Jul 12 2022 Maurizio Lombardi <mlombard@redhat.com> - 1.16-4
- Merge fixes for PowerPC
* Fri Jan 07 2022 Maurizio Lombardi <mlombard@redhat.com> - 1.16-3
- Merge a few bugfixes