On Fri, 2023-04-21 at 21:10 -0600, Vishal Verma wrote: > Add a new cxl-update-firmware command to initiate a firmware update on a > given memdev. This allows using a specified file to pass in as the > firmware binary for one or more memdevs, allows for a blocking mode, > where the command only exits after the update is complete for every > specified memdev, and includes an option to cancel an in-progress > update. Add the supporting libcxl APIs for the above functions as well. > > Signed-off-by: Vishal Verma <vishal.l.ve...@intel.com> > --- > cxl/lib/private.h | 5 ++ > cxl/lib/libcxl.c | 114 > ++++++++++++++++++++++++++++++++++++++++++ > cxl/builtin.h | 1 + > cxl/libcxl.h | 2 + > cxl/cxl.c | 1 + > cxl/memdev.c | 73 ++++++++++++++++++++++++++- > Documentation/cxl/meson.build | 1 + > cxl/lib/libcxl.sym | 2 + > 8 files changed, 198 insertions(+), 1 deletion(-) > Looks like I forgot to 'git add Documentation/cxl/cxl-update-firmware.txt'. I'll fix it for v2, but in the meanwhile here's what that looks like:
// SPDX-License-Identifier: GPL-2.0 cxl-update-firmware(1) ====================== NAME ---- cxl-update-firmware - update the firmware on a CXL memdev SYNOPSIS -------- [verse] 'cxl update-firmware <mem0> [<mem1>..<memN>] [<options>]' DESCRIPTION ----------- Update the firmware on one or more CXL mem devices. The mem devices must support the set of firmware related mailbox commands. This command doesn't directly issue the transfer / activate firmware mailbox commands. Instead, the kernel's firmware loader facility is used to provide the kernel with the data, and the kernel handles performing the actual update while also managing time slicing the transfer w.r.t. other background commands. EXAMPLE ------- ---- # cxl update-firmware mem0 -F firmware.bin -w [ { "memdev":"mem0", "pmem_size":1073741824, "ram_size":1073741824, "serial":0, "numa_node":0, "host":"cxl_mem.0", "firmware":{ "num_slots":3, "active_slot":2, "online_activate_capable":false, "slot_1_version":"cxl_test_fw_001", "slot_2_version":"cxl_test_fw_002", "slot_3_version":"cxl_test_new_fw", "fw_update_in_progress":false } } ] firmware update completed on 1 mem device ---- OPTIONS ------- include::bus-option.txt[] -F:: --firmware-file:: Firmware image file to use for the update. -c:: --cancel:: Attempt to abort an in-progress firmware update. This may fail depending on what stage the update process is in. -w:: --wait:: By default, the update-firmware command only initiates the firmware update, and returns, while the update operation happens asynchronously in the background. This option makes the firmware update command synchronous by waiting for it to complete before returning. If --wait is passed in without an accompanying firmware-file, it will initiate a wait on any current in-progress firmware updates, and then return. include::verbose-option.txt[] include::../copyright.txt[] SEE ALSO -------- linkcxl:cxl-list[1],