diff mbox series

[ndctl,03/16] ndctl/list: Indicate firmware update capability

Message ID 159408963461.2386154.18353152465451652005.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive)
State Superseded
Headers show
Series Firmware Activation and Test Updates | expand

Commit Message

Dan Williams July 7, 2020, 2:40 a.m. UTC
Given all the components that need to be lined up to support firmware
update, add a "can_update" flag to indicate that all the proper plumbing is
in place.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 Documentation/ndctl/ndctl-update-firmware.txt |   21 ++++++++++++++++++---
 ndctl/util/json-firmware.c                    |    5 +++++
 2 files changed, 23 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/Documentation/ndctl/ndctl-update-firmware.txt b/Documentation/ndctl/ndctl-update-firmware.txt
index 1aa7fee502ca..f93da6bf15e7 100644
--- a/Documentation/ndctl/ndctl-update-firmware.txt
+++ b/Documentation/ndctl/ndctl-update-firmware.txt
@@ -5,7 +5,7 @@  ndctl-update-firmware(1)
 
 NAME
 ----
-ndctl-update-firmware - provides for updating the firmware on an NVDIMM
+ndctl-update-firmware - update the firmware the given device
 
 SYNOPSIS
 --------
@@ -15,9 +15,24 @@  SYNOPSIS
 DESCRIPTION
 -----------
 Provide a generic interface for updating NVDIMM firmware. The use of this
-depends on support from the underlying libndctl, kernel, as well as the
-platform itself.
+depends on support for the NVDIMM "family" in libndctl, the kernel needs
+to enable that command set, and the device itself needs to implement the
+command. Use "ndctl list -DF" to interrogate if firmware
+update is enabled. For example:
 
+[verse]
+ndctl list -DFu -d nmem1
+{
+  "dev":"nmem1",
+  "id":"cdab-0a-07e0-ffffffff",
+  "handle":"0",
+  "phys_id":"0",
+  "security":"disabled",
+  "firmware":{
+    "current_version":"0",
+    "can_update":true
+  }
+}
 
 OPTIONS
 -------
diff --git a/ndctl/util/json-firmware.c b/ndctl/util/json-firmware.c
index f7150d82d174..9a9db064d851 100644
--- a/ndctl/util/json-firmware.c
+++ b/ndctl/util/json-firmware.c
@@ -46,6 +46,11 @@  struct json_object *util_dimm_firmware_to_json(struct ndctl_dimm *dimm,
 	if (jobj)
 		json_object_object_add(jfirmware, "current_version", jobj);
 
+	rc = ndctl_dimm_fw_update_supported(dimm);
+	jobj = json_object_new_boolean(rc == 0);
+	if (jobj)
+		json_object_object_add(jfirmware, "can_update", jobj);
+
 	next = ndctl_cmd_fw_info_get_updated_version(cmd);
 	if (next == ULLONG_MAX) {
 		jobj = util_json_object_hex(-1, flags);