introduce PLDM firmware update library
Subsystems (7)
Jacob Keller
maintainercover introduce PLDM firmware update library
This series goal is to enable support for updating the ice hardware flash using the devlink flash command.
The ice firmware update files are distributed using the file format described by the "PLDM for Firmware Update" standard:
https://www.dmtf.org/documents/pmci/pldm-firmware-update-specification-100
Because this file format is standard, this series introduces a new library that handles the generic logic for parsing the PLDM file header. The library uses a design that is very similar to the Mellanox mlxfw module. That is, a simple ops table is setup and device drivers instantiate an instance of the pldmfw library with the device specific operations.
Doing so allows for each device to implement the low level behavior for how to interact with its firmware.
This series includes the library and an implementation for the ice hardware. In addition, it includes a following patch with additional device parameters for controlling specific aspects of the update. I suspect that there is a better way to handle these parameters overall. Perhaps extensions to DEVLINK_CMD_FLASH_UPDATE? The main purpose of these parameters is to give additional control over the update choices. Specifically, Intel has flash update tools which provide similar functionality for other operating systems. Without these controls, we would not be able to replicate this functionality within Linux using the devlink interface.
Because the PLDM file format is a standard and not something that is specific to the Intel hardware, I opted to place this update library in lib/pldmfw. I should note that while I tried to make the library generic, it does not attempt to mimic the complete "Update Agent" as defined in the standard. This is mostly due to the fact that the actual interfaces exposed to software for the ice hardware would not allow this.
This series is currently based on top of Jeff Kirsher's dev-queue, as it relies on some cleanup of the device capabilities code that was recently published.
https://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue.git/log/?h=dev-queue
Cudzilo, Szymon T (1):
ice: Add AdminQ commands for FW update
Jacek Naczyk (1):
ice: Add support for unified NVM update flow capability
Jacob Keller (4):
ice: add flags indicating pending update of firmware module Add pldmfw library for PLDM firmware update
ice: implement device flash update via devlink
ice: implement devlink parameters to control flash update
Documentation/driver-api/index.rst | 1 + .../driver-api/pldmfw/driver-ops.rst | 56 ++ .../driver-api/pldmfw/file-format.rst | 203 ++++ Documentation/driver-api/pldmfw/index.rst | 72 ++ Documentation/networking/devlink/ice.rst | 46 + MAINTAINERS | 7 + drivers/net/ethernet/intel/Kconfig | 1 + drivers/net/ethernet/intel/ice/Makefile | 1 + drivers/net/ethernet/intel/ice/ice.h | 29 + .../net/ethernet/intel/ice/ice_adminq_cmd.h | 83 ++ drivers/net/ethernet/intel/ice/ice_common.c | 21 +- drivers/net/ethernet/intel/ice/ice_common.h | 4 +- drivers/net/ethernet/intel/ice/ice_devlink.c | 229 ++++- .../net/ethernet/intel/ice/ice_fw_update.c | 817 ++++++++++++++++ .../net/ethernet/intel/ice/ice_fw_update.h | 12 + drivers/net/ethernet/intel/ice/ice_main.c | 154 +++ drivers/net/ethernet/intel/ice/ice_nvm.c | 186 ++++ drivers/net/ethernet/intel/ice/ice_nvm.h | 16 + drivers/net/ethernet/intel/ice/ice_type.h | 12 + include/linux/pldmfw.h | 165 ++++ lib/Kconfig | 4 + lib/Makefile | 3 + lib/pldmfw/Makefile | 2 + lib/pldmfw/pldmfw.c | 879 ++++++++++++++++++ lib/pldmfw/pldmfw_private.h | 238 +++++ 25 files changed, 3237 insertions(+), 4 deletions(-) create mode 100644 Documentation/driver-api/pldmfw/driver-ops.rst create mode 100644 Documentation/driver-api/pldmfw/file-format.rst create mode 100644 Documentation/driver-api/pldmfw/index.rst create mode 100644 drivers/net/ethernet/intel/ice/ice_fw_update.c create mode 100644 drivers/net/ethernet/intel/ice/ice_fw_update.h create mode 100644 include/linux/pldmfw.h create mode 100644 lib/pldmfw/Makefile create mode 100644 lib/pldmfw/pldmfw.c create mode 100644 lib/pldmfw/pldmfw_private.h
Signature · 1 line
2.27.0.353.gb9a2d1a0207f
Jacob Keller
maintainerRFC PATCH 1/6 ice: Add support for unified NVM update flow capability
From: Jacek Naczyk <[email protected]>
Extends function parsing response from Discover Device Capability AQC to check if the device supports unified NVM update flow.
--- drivers/net/ethernet/intel/ice/ice_adminq_cmd.h | 1 + drivers/net/ethernet/intel/ice/ice_common.c | 7 +++++++ drivers/net/ethernet/intel/ice/ice_type.h | 3 +++ 3 files changed, 11 insertions(+)
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +1 -0
@@ -109,6 +109,7 @@ struct ice_aqc_list_caps_elem {#define ICE_AQC_CAPS_MSIX 0x0043#define ICE_AQC_CAPS_FD 0x0045#define ICE_AQC_CAPS_MAX_MTU 0x0047 +#define ICE_AQC_CAPS_NVM_MGMT 0x0080u8 major_ver;u8 minor_ver;
drivers/net/ethernet/intel/ice/ice_common.c +7 -0
@@ -1857,6 +1857,13 @@ ice_parse_common_caps(struct ice_hw *hw, struct ice_hw_common_caps *caps,"%s: msix_vector_first_id = %d\n" , prefix, caps->msix_vector_first_id);break ; +case ICE_AQC_CAPS_NVM_MGMT : + caps->nvm_unified_update = + (number &ICE_NVM_MGMT_UNIFIED_UPD_SUPPORT ) ? + true : false; +ice_debug (hw,ICE_DBG_INIT ,"%s: nvm_unified_update = %d\n" , prefix, + caps->nvm_unified_update); +break ;case ICE_AQC_CAPS_MAX_MTU : caps->max_mtu = number; ice_debug(hw, ICE_DBG_INIT, "%s: max_mtu = %d\n",
drivers/net/ethernet/intel/ice/ice_type.h +3 -0
@@ -262,6 +262,9 @@ struct ice_hw_common_caps {u8 rss_table_entry_width;/* RSS Entry width in bits */ u8 dcb; + +bool nvm_unified_update; +#define ICE_NVM_MGMT_UNIFIED_UPD_SUPPORT BIT(3) };/* Function specific capabilities */
Signature · 1 line
2.27.0.353.gb9a2d1a0207f
Jacob Keller
maintainerRFC PATCH 2/6 ice: Add AdminQ commands for FW update
In reply to Jacob KellerFrom: "Cudzilo, Szymon T" <[email protected]>
Add structures, identifiers, and helper functions for several AdminQ commands related to performing a firmware update for the ice hardware. These will be used in future code for implementing the devlink .flash_update handler.
--- .../net/ethernet/intel/ice/ice_adminq_cmd.h | 76 +++++++ drivers/net/ethernet/intel/ice/ice_common.h | 2 - drivers/net/ethernet/intel/ice/ice_nvm.c | 186 ++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_nvm.h | 16 ++ drivers/net/ethernet/intel/ice/ice_type.h | 3 + 5 files changed, 281 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +76 -0
@@ -1299,7 +1299,14 @@ struct ice_aqc_nvm {#define ICE_AQC_NVM_PRESERVATION_M (3 << ICE_AQC_NVM_PRESERVATION_S)#define ICE_AQC_NVM_NO_PRESERVATION (0 << ICE_AQC_NVM_PRESERVATION_S)#define ICE_AQC_NVM_PRESERVE_ALL BIT(1) +#define ICE_AQC_NVM_FACTORY_DEFAULT (2 << ICE_AQC_NVM_PRESERVATION_S)#define ICE_AQC_NVM_PRESERVE_SELECTED (3 << ICE_AQC_NVM_PRESERVATION_S) +#define ICE_AQC_NVM_ACTIV_SEL_NVM BIT(3)/* Write Activate/SR Dump only */ +#define ICE_AQC_NVM_ACTIV_SEL_OROM BIT(4) +#define ICE_AQC_NVM_ACTIV_SEL_NETLIST BIT(5) +#define ICE_AQC_NVM_SPECIAL_UPDATE BIT(6) +#define ICE_AQC_NVM_REVERT_LAST_ACTIV BIT(6)/* Write Activate only */ +#define ICE_AQC_NVM_ACTIV_SEL_MASK ICE_M(0x7, 3)#define ICE_AQC_NVM_FLASH_ONLY BIT(7)__le16 module_typeid;__le16 length;
@@ -1348,6 +1355,67 @@ struct ice_aqc_nvm_checksum {#define ICE_AQC_NVM_NETLIST_ID_BLK_SHA_HASH 0xA#define ICE_AQC_NVM_NETLIST_ID_BLK_CUST_VER 0x2F +/* Used for NVM Set Package Data command - 0x070A */ +struct ice_aqc_nvm_pkg_data { +u8 reserved[3 ]; +u8 cmd_flags; +#define ICE_AQC_NVM_PKG_DELETE BIT(0)/* used for command call */ +#define ICE_AQC_NVM_PKG_SKIPPED BIT(0)/* used for command response */ + +u32 reserved1; +__le32 addr_high; +__le32 addr_low; +}; + +/* Used for Pass Component Table command - 0x070B */ +struct ice_aqc_nvm_pass_comp_tbl { +u8 component_response;/* Response only */ +#define ICE_AQ_NVM_PASS_COMP_CAN_BE_UPDATED 0x0 +#define ICE_AQ_NVM_PASS_COMP_CAN_MAY_BE_UPDATEABLE 0x1 +#define ICE_AQ_NVM_PASS_COMP_CAN_NOT_BE_UPDATED 0x2 +u8 component_response_code;/* Response only */ +#define ICE_AQ_NVM_PASS_COMP_CAN_BE_UPDATED_CODE 0x0 +#define ICE_AQ_NVM_PASS_COMP_STAMP_IDENTICAL_CODE 0x1 +#define ICE_AQ_NVM_PASS_COMP_STAMP_LOWER 0x2 +#define ICE_AQ_NVM_PASS_COMP_INVALID_STAMP_CODE 0x3 +#define ICE_AQ_NVM_PASS_COMP_CONFLICT_CODE 0x4 +#define ICE_AQ_NVM_PASS_COMP_PRE_REQ_NOT_MET_CODE 0x5 +#define ICE_AQ_NVM_PASS_COMP_NOT_SUPPORTED_CODE 0x6 +#define ICE_AQ_NVM_PASS_COMP_CANNOT_DOWNGRADE_CODE 0x7 +#define ICE_AQ_NVM_PASS_COMP_INCOMPLETE_IMAGE_CODE 0x8 +#define ICE_AQ_NVM_PASS_COMP_VER_STR_IDENTICAL_CODE 0xA +#define ICE_AQ_NVM_PASS_COMP_VER_STR_LOWER_CODE 0xB +u8 reserved; +u8 transfer_flag; +#define ICE_AQ_NVM_PASS_COMP_TBL_START 0x1 +#define ICE_AQ_NVM_PASS_COMP_TBL_MIDDLE 0x2 +#define ICE_AQ_NVM_PASS_COMP_TBL_END 0x4 +#define ICE_AQ_NVM_PASS_COMP_TBL_START_AND_END 0x5 +__le32 reserved1; +__le32 addr_high; +__le32 addr_low; +}; + +struct ice_aqc_nvm_comp_tbl { +__le16 comp_class; +#define NVM_COMP_CLASS_ALL_FW 0x000A + +__le16 comp_id; +#define NVM_COMP_ID_OROM 0x5 +#define NVM_COMP_ID_NVM 0x6 +#define NVM_COMP_ID_NETLIST 0x8 + +u8 comp_class_idx; +#define FWU_COMP_CLASS_IDX_NOT_USE 0x0 + +__le32 comp_cmp_stamp; +u8 cvs_type; +#define NVM_CVS_TYPE_ASCII 0x1 + +u8 cvs_len; +u8 cvs[];/* Component Version String */ +} __packed; +/** * Send to PF command (indirect 0x0801) ID is only used by PF *
@@ -1795,6 +1863,8 @@ struct ice_aq_desc {struct ice_aqc_rl_profile rl_profile;struct ice_aqc_nvm nvm;struct ice_aqc_nvm_checksum nvm_checksum; +struct ice_aqc_nvm_pkg_data pkg_data; +struct ice_aqc_nvm_pass_comp_tbl pass_comp_tbl;struct ice_aqc_pf_vf_msg virt;struct ice_aqc_lldp_get_mib lldp_get_mib;struct ice_aqc_lldp_set_mib_change lldp_set_event;
@@ -1929,7 +1999,13 @@ enum ice_adminq_opc {/* NVM commands */ ice_aqc_opc_nvm_read =0x0701 , + ice_aqc_opc_nvm_erase =0x0702 , + ice_aqc_opc_nvm_write =0x0703 , ice_aqc_opc_nvm_checksum =0x0706 , + ice_aqc_opc_nvm_write_activate =0x0707 , + ice_aqc_opc_nvm_update_empr =0x0709 , + ice_aqc_opc_nvm_pkg_data =0x070A , + ice_aqc_opc_nvm_pass_component_tbl =0x070B ,/* PF/VF mailbox commands */ ice_mbx_opc_send_msg_to_pf = 0x0801,
drivers/net/ethernet/intel/ice/ice_common.h +0 -2
@@ -11,8 +11,6 @@#include "ice_switch.h" #include <linux/avf/virtchnl.h> -enum ice_status ice_nvm_validate_checksum (struct ice_hw *hw); -enum ice_status ice_init_hw (struct ice_hw *hw);void ice_deinit_hw (struct ice_hw *hw);enum ice_status ice_check_reset (struct ice_hw *hw);
drivers/net/ethernet/intel/ice/ice_nvm.c +186 -0
195 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_nvm.h +16 -0
@@ -17,4 +17,20 @@ enum ice_status ice_read_pba_string(struct ice_hw *hw, u8 *pba_num, u32 pba_num_size);enum ice_status ice_init_nvm (struct ice_hw *hw);enum ice_status ice_read_sr_word (struct ice_hw *hw,u16 offset,u16 *data); +enum ice_status +ice_aq_update_nvm (struct ice_hw *hw,u16 module_typeid,u32 offset, +u16 length,void *data,bool last_command,u8 command_flags, +struct ice_sq_cd *cd); +enum ice_status +ice_aq_erase_nvm (struct ice_hw *hw,u16 module_typeid,struct ice_sq_cd *cd); +enum ice_status ice_nvm_validate_checksum (struct ice_hw *hw); +enum ice_status ice_nvm_write_activate (struct ice_hw *hw,u8 cmd_flags); +enum ice_status ice_aq_nvm_update_empr (struct ice_hw *hw); +enum ice_status +ice_nvm_set_pkg_data (struct ice_hw *hw,bool del_pkg_data_flag,u8 *data, +u16 length,struct ice_sq_cd *cd); +enum ice_status +ice_nvm_pass_component_tbl (struct ice_hw *hw,u8 *data,u16 length, +u8 transfer_flag,u8 *comp_response, +u8 *comp_response_code,struct ice_sq_cd *cd);#endif /* _ICE_NVM_H_ */
drivers/net/ethernet/intel/ice/ice_type.h +3 -0
@@ -801,6 +801,9 @@ enum ice_sw_fwd_act_type {#define ICE_OROM_VER_SHIFT 24#define ICE_OROM_VER_MASK (0xff << ICE_OROM_VER_SHIFT)#define ICE_SR_PFA_PTR 0x40 +#define ICE_SR_1ST_NVM_BANK_PTR 0x42 +#define ICE_SR_1ST_OROM_BANK_PTR 0x44 +#define ICE_SR_NETLIST_BANK_PTR 0x46#define ICE_SR_SECTOR_SIZE_IN_WORDS 0x800/* Link override related */
Signature · 1 line
2.27.0.353.gb9a2d1a0207f
Jacob Keller
maintainerRFC PATCH 3/6 ice: add flags indicating pending update of firmware module
In reply to Jacob KellerAfter a flash update, the pending status of the update can be determined from the device capabilities.
Read the appropriate device capability and store whether there is a pending update awaiting a reboot.
--- drivers/net/ethernet/intel/ice/ice_adminq_cmd.h | 6 ++++++ drivers/net/ethernet/intel/ice/ice_common.c | 12 ++++++++++++ drivers/net/ethernet/intel/ice/ice_type.h | 6 ++++++ 3 files changed, 24 insertions(+)
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +6 -0
@@ -109,6 +109,12 @@ struct ice_aqc_list_caps_elem {#define ICE_AQC_CAPS_MSIX 0x0043#define ICE_AQC_CAPS_FD 0x0045#define ICE_AQC_CAPS_MAX_MTU 0x0047 +#define ICE_AQC_CAPS_NVM_VER 0x0048 +#define ICE_AQC_CAPS_PENDING_NVM_VER 0x0049 +#define ICE_AQC_CAPS_OROM_VER 0x004A +#define ICE_AQC_CAPS_PENDING_OROM_VER 0x004B +#define ICE_AQC_CAPS_NET_VER 0x004C +#define ICE_AQC_CAPS_PENDING_NET_VER 0x004D#define ICE_AQC_CAPS_NVM_MGMT 0x0080u8 major_ver;
drivers/net/ethernet/intel/ice/ice_common.c +12 -0
@@ -1857,6 +1857,18 @@ ice_parse_common_caps(struct ice_hw *hw, struct ice_hw_common_caps *caps,"%s: msix_vector_first_id = %d\n" , prefix, caps->msix_vector_first_id);break ; +case ICE_AQC_CAPS_PENDING_NVM_VER : + caps->nvm_update_pending_nvm = true; +ice_debug (hw,ICE_DBG_INIT ,"%s: update_pending_nvm\n" , prefix); +break ; +case ICE_AQC_CAPS_PENDING_OROM_VER : + caps->nvm_update_pending_orom = true; +ice_debug (hw,ICE_DBG_INIT ,"%s: update_pending_orom\n" , prefix); +break ; +case ICE_AQC_CAPS_PENDING_NET_VER : + caps->nvm_update_pending_netlist = true; +ice_debug (hw,ICE_DBG_INIT ,"%s: update_pending_netlist\n" , prefix); +break ;case ICE_AQC_CAPS_NVM_MGMT : caps->nvm_unified_update = (number & ICE_NVM_MGMT_UNIFIED_UPD_SUPPORT) ?
drivers/net/ethernet/intel/ice/ice_type.h +6 -0
@@ -263,6 +263,12 @@ struct ice_hw_common_caps {u8 dcb; +bool nvm_update_pending_nvm; +bool nvm_update_pending_orom; +bool nvm_update_pending_netlist; +#define ICE_NVM_PENDING_NVM_IMAGE BIT(0) +#define ICE_NVM_PENDING_OROM BIT(1) +#define ICE_NVM_PENDING_NETLIST BIT(2)bool nvm_unified_update;#define ICE_NVM_MGMT_UNIFIED_UPD_SUPPORT BIT(3) };
Signature · 1 line
2.27.0.353.gb9a2d1a0207f
Jacob Keller
maintainerRFC PATCH 4/6 Add pldmfw library for PLDM firmware update
In reply to Jacob KellerThe pldmfw library is used to implement common logic needed to flash devices based on firmware files using the format described by the PLDM for Firmware Update standard.
This library consists of logic to parse the PLDM file format from a firmware file object, as well as common logic for sending the relevant PLDM header data to the device firmware.
A simple ops table is provided so that device drivers can implement device specific hardware interactions while keeping the common logic to the pldmfw library.
This library will be used by the Intel ice networking driver as part of implementing device flash update via devlink. The library aims to be vendor and device agnostic. For this reason, it has been placed in lib/pldmfw, in the hopes that other devices which use the PLDM firmware file format may benefit from it in the future. However, do note that not all features defined in the PLDM standard have been implemented.
--- Documentation/driver-api/index.rst | 1 + .../driver-api/pldmfw/driver-ops.rst | 56 ++ .../driver-api/pldmfw/file-format.rst | 203 ++++ Documentation/driver-api/pldmfw/index.rst | 72 ++ MAINTAINERS | 7 + include/linux/pldmfw.h | 165 ++++ lib/Kconfig | 4 + lib/Makefile | 3 + lib/pldmfw/Makefile | 2 + lib/pldmfw/pldmfw.c | 879 ++++++++++++++++++ lib/pldmfw/pldmfw_private.h | 238 +++++ 11 files changed, 1630 insertions(+) create mode 100644 Documentation/driver-api/pldmfw/driver-ops.rst create mode 100644 Documentation/driver-api/pldmfw/file-format.rst create mode 100644 Documentation/driver-api/pldmfw/index.rst create mode 100644 include/linux/pldmfw.h create mode 100644 lib/pldmfw/Makefile create mode 100644 lib/pldmfw/pldmfw.c create mode 100644 lib/pldmfw/pldmfw_private.h
Documentation/driver-api/index.rst +1 -0
@@ -95,6 +95,7 @@ available subsections can be seen below. phy/index pti_intel_mid pwm + pldmfw/index rfkill serial/index sm501
Documentation/driver-api/pldmfw/driver-ops.rst new file +56 -0
56 lines not on this page · raw message
Documentation/driver-api/pldmfw/file-format.rst new file +203 -0
203 lines not on this page · raw message
Documentation/driver-api/pldmfw/index.rst new file +72 -0
72 lines not on this page · raw message
MAINTAINERS +7 -0
@@ -13585,6 +13585,13 @@ S: Maintained F: Documentation/devicetree/bindings/iio/chemical/plantower,pms7003.yaml F: drivers/iio/chemical/pms7003.c +PLDMFW LIBRARY +M: Jacob Keller <[email protected]> +S: Maintained +F: Documentation/driver-api/pldmfw/ +F: include/linux/pldmfw.h +F: lib/pldmfw/ + PLX DMA DRIVER M: Logan Gunthorpe <[email protected]> S: Maintained
include/linux/pldmfw.h new file +165 -0
165 lines not on this page · raw message
lib/Kconfig +4 -0
@@ -676,3 +676,7 @@ config GENERIC_LIB_CMPDI2 config GENERIC_LIB_UCMPDI2 bool + +config PLDMFW + bool + default n
lib/Makefile +3 -0
@@ -315,6 +315,9 @@ obj-$(CONFIG_GENERIC_LIB_CMPDI2) += cmpdi2.o obj-$(CONFIG_GENERIC_LIB_UCMPDI2) += ucmpdi2.o obj-$(CONFIG_OBJAGG) += objagg.o +# pldmfw library +obj-$(CONFIG_PLDMFW) += pldmfw/ + # KUnit tests obj-$(CONFIG_LIST_KUNIT_TEST) += list-test.o obj-$(CONFIG_LINEAR_RANGES_TEST) += test_linear_ranges.o
lib/pldmfw/Makefile new file +2 -0
@@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0-only +obj-$(CONFIG_PLDMFW) += pldmfw.o
lib/pldmfw/pldmfw.c new file +879 -0
879 lines not on this page · raw message
lib/pldmfw/pldmfw_private.h new file +238 -0
238 lines not on this page · raw message
Signature · 1 line
2.27.0.353.gb9a2d1a0207f
Jacob Keller
maintainerRFC PATCH 5/6 ice: implement device flash update via devlink
In reply to Jacob KellerUse the newly added pldmfw library to implement device flash update for the Intel ice networking device driver. This support uses the devlink flash update interface.
The main parts of the flash include the Option ROM, the netlist module, and the main NVM data. The PLDM firmware file contains modules for each of these components.
Using the pldmfw library, the provided firmware file will be scanned for the three major components, "fw.undi" for the Option ROM, "fw.mgmt" for the main NVM module containing the primary device firmware, and "fw.netlist" containing the netlist module.
The flash is separated into two banks, the active bank containing the running firmware, and the inactive bank which we use for update. Each module is updated in a staged process. First, the inactive bank is erased, preparing the device for update. Second, the contents of the component are copied to the inactive portion of the flash. After all components are updated, the driver signals the device to switch the active bank during the next EMP reset (which would usually occur during the next reboot).
Although the firmware AdminQ interface does report an immediate status for each command, the NVM erase and NVM write commands receive status asynchronously. The driver must not continue writing until previous erase and write commands have finished. The real status of the NVM commands is returned over the receive AdminQ. Implement a simple interface that uses a wait queue so that the main update thread can sleep until the completion status is reported by firmware. For erasing the inactive banks, this can take quite a while in practice.
To help visualize the process to the devlink application and other applications based on the devlink netlink interface, status is reported via the devlink_flash_update_status_notify. While we do report status after each 4k block when writing, there is no real status we can report during erasing. We simply must wait for the complete module erasure to finish.
With this implementation, basic flash update for the ice hardware is supported.
--- drivers/net/ethernet/intel/Kconfig | 1 + drivers/net/ethernet/intel/ice/Makefile | 1 + drivers/net/ethernet/intel/ice/ice.h | 9 + drivers/net/ethernet/intel/ice/ice_common.c | 2 +- drivers/net/ethernet/intel/ice/ice_common.h | 2 + drivers/net/ethernet/intel/ice/ice_devlink.c | 54 ++ .../net/ethernet/intel/ice/ice_fw_update.c | 752 ++++++++++++++++++ .../net/ethernet/intel/ice/ice_fw_update.h | 12 + drivers/net/ethernet/intel/ice/ice_main.c | 154 ++++ 9 files changed, 986 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ethernet/intel/ice/ice_fw_update.c create mode 100644 drivers/net/ethernet/intel/ice/ice_fw_update.h
drivers/net/ethernet/intel/Kconfig +1 -0
@@ -295,6 +295,7 @@ config ICE default n depends on PCI_MSI select NET_DEVLINK + select PLDMFW help This driver supports Intel(R) Ethernet Connection E800 Series of devices. For more information on how to identify your adapter, go
drivers/net/ethernet/intel/ice/Makefile +1 -0
@@ -23,6 +23,7 @@ ice-y := ice_main.o \ ice_flex_pipe.o \ ice_flow.o \ ice_devlink.o \ + ice_fw_update.o \ ice_ethtool.o ice-$(CONFIG_PCI_IOV) += ice_virtchnl_pf.o ice_sriov.o ice_dcf.o ice_virtchnl_fdir.o ice-$(CONFIG_DCB) += ice_dcb.o ice_dcb_nl.o ice_dcb_lib.o
drivers/net/ethernet/intel/ice/ice.h +9 -0
@@ -19,6 +19,7 @@#include <linux/dma-mapping.h> #include <linux/pci.h> #include <linux/workqueue.h> +#include <linux/wait.h> #include <linux/aer.h> #include <linux/interrupt.h> #include <linux/ethtool.h>
@@ -415,6 +416,12 @@ struct ice_pf {struct mutex sw_mutex;/* lock for protecting VSI alloc flow */ struct mutex tc_mutex;/* lock to protect TC changes */ u32 msg_enable; + +/* spinlock to protect the AdminQ wait list */ +spinlock_t aq_wait_lock; +struct hlist_head aq_wait_list; +wait_queue_head_t aq_wait_queue; +u32 hw_csum_rx_error;u16 oicr_idx;/* Other interrupt cause MSIX vector index */ u16 num_avail_sw_msix;/* remaining MSIX SW vectors left unclaimed */
@@ -598,6 +605,8 @@ void ice_fdir_release_flows(struct ice_hw *hw);void ice_fdir_replay_flows (struct ice_hw *hw);void ice_fdir_replay_fltrs (struct ice_pf *pf);int ice_fdir_create_dflt_rules (struct ice_pf *pf); +int ice_aq_wait_for_event (struct ice_pf *pf,u16 opcode,unsigned long timeout, +struct ice_rq_event_info *event);int ice_open (struct net_device *netdev);int ice_stop (struct net_device *netdev);void ice_service_task_schedule (struct ice_pf *pf);
drivers/net/ethernet/intel/ice/ice_common.c +1 -1
@@ -2223,7 +2223,7 @@ ice_aq_list_caps(struct ice_hw *hw, void *buf, u16 buf_size, u32 *cap_count,* Read the device capabilities and extract them into the dev_caps structure * for later use. */ -static enum ice_status +enum ice_status ice_discover_dev_caps (struct ice_hw *hw,struct ice_hw_dev_caps *dev_caps) {enum ice_status status;
drivers/net/ethernet/intel/ice/ice_common.h +2 -0
@@ -88,6 +88,8 @@ ice_aq_get_phy_caps(struct ice_port_info *pi, bool qual_mods, u8 report_mode,enum ice_status ice_aq_list_caps (struct ice_hw *hw,void *buf,u16 buf_size,u32 *cap_count,enum ice_adminq_opc opc,struct ice_sq_cd *cd); +enum ice_status +ice_discover_dev_caps (struct ice_hw *hw,struct ice_hw_dev_caps *dev_caps);void ice_update_phy_type (u64 *phy_type_low,u64 *phy_type_high,u16 link_speeds_bitmap);
drivers/net/ethernet/intel/ice/ice_devlink.c +54 -0
68 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_fw_update.c new file +752 -0
752 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_fw_update.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (C) 2018-2019, Intel Corporation. */ + +#ifndef _ICE_FW_UPDATE_H_ +#define _ICE_FW_UPDATE_H_ + +int ice_flash_pldm_image (struct ice_pf *pf,const struct firmware *fw, +struct netlink_ext_ack *extack); +int ice_check_for_pending_update (struct ice_pf *pf,const char *component, +struct netlink_ext_ack *extack); + +#endif
drivers/net/ethernet/intel/ice/ice_main.c +154 -0
178 lines not on this page · raw message
Signature · 1 line
2.27.0.353.gb9a2d1a0207f
Jacob Keller
maintainerRFC PATCH 6/6 ice: implement devlink parameters to control flash update
In reply to Jacob KellerThe flash update for the ice hardware currently supports a single fixed configuration:
* Firmware is always asked to preserve all changeable fields
* The driver never allows downgrades
* The driver will not allow canceling a previous update that never completed (for example because an EMP reset never occurred)
* The driver does not attempt to trigger an EMP reset immediately.
This default mode of operation is reasonable. However, it is often useful to allow system administrators more control over the update process. To enable this, implement devlink parameters that allow the system administrator to specify the desired behaviors:
* 'reset_after_flash_update'
If enabled, the driver will request that the firmware immediately trigger an EMP reset when completing the device update. This will result in the device switching active banks immediately and re-initializing with the new firmware.
* 'allow_downgrade_on_flash_update'
If enabled, the driver will attempt to update device flash even when firmware indicates that such an update would be a downgrade.
* 'ignore_pending_flash_update'
If enabled, the device driver will cancel a previous pending update. A pending update is one where the steps to write the update to the NVM bank has finished, but the device never reset, as the system had not yet been rebooted.
* 'flash_update_preservation_level'
The value determines the preservation mode to request from firmware, among the following 4 choices:
* PRESERVE_ALL (0)
Preserve all settings and fields in the NVM configuration
* PRESERVE_LIMITED (1)
Preserve only a limited set of fields, including the VPD, PCI serial ID, MAC address, etc. This results in permanent settings being reset, including changes to the port configuration, such as the number of physical functions created.
* PRESERVE_FACTORY_SETTINGS (2)
Reset all configuration fields to the factory default settings stored within the NVM.
* PRESERVE_NONE (3)
Do not perform any preservation.
--- Documentation/networking/devlink/ice.rst | 46 +++++ drivers/net/ethernet/intel/ice/ice.h | 20 ++ drivers/net/ethernet/intel/ice/ice_devlink.c | 175 +++++++++++++++++- .../net/ethernet/intel/ice/ice_fw_update.c | 73 +++++++- 4 files changed, 309 insertions(+), 5 deletions(-)
Documentation/networking/devlink/ice.rst +46 -0
@@ -156,3 +156,49 @@ Users can request an immediate capture of a snapshot via the 0000000000000210 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 $ devlink region delete pci/0000:01:00.0/device-caps snapshot 1 + +Parameters +========== + +The ``ice`` driver implements the following driver-specific parameters. + +.. list-table:: Driver-specific parameters implemented + :widths: 5 5 5 85 + + * - Name + - Type + - Mode + - Description + * - ``reset_after_flash_update`` + - Boolean + - runtime + - If set to true, the driver will request that firmware trigger an EMP + reset after completing a flash update. This causes the device to + immediately re-initialize with the new flash contents. + * - ``allow_downgrade_on_flash_update`` + - Boolean + - runtime + - If set to true, the driver will attempt to perform a flash update + even if the firmware indicates that the upgrade is a downgrade to a + previous version of the firmware. + * - ``ignore_pending_flash_update`` + - Boolean + - runtime + - If set to true, the driver will attempt to cancel any previous + pending flash update. Such an update is one where the device never + reset after finishing the flash update. + * - ``flash_update_preservation_level`` + - u8 + - runtime + - Controls the flash update preservation policy requested by the + driver. + - ``ICE_FLASH_UPDATE_PRESERVE_ALL`` (0) + Preserve all settings and fields in the current NVM configuration, + carrying them forward to the new version. + - ``ICE_FLASH_UPDATE_PRESERVE_LIMITED`` (1) + Preserve only a limited set of fields including the VPD, PCI + serial ID, and MAC address. + - ``ICE_FLASH_UPDATE_PRESERVE_FACTORY_SETTINGS`` (2) + Restore all configuration fields to the factory default settings. + - ``ICE_FLASH_UPDATE_PRESERVE_NONE`` (3) + Do not perform any preservation.
drivers/net/ethernet/intel/ice/ice.h +20 -0
@@ -374,6 +374,25 @@ enum ice_pf_flags {ICE_PF_FLAGS_NBITS /* must be last */ }; +enum ice_flash_update_preservation { +/* Preserve all settings and fields */ +ICE_FLASH_UPDATE_PRESERVE_ALL =0 , +/* Preserve limited fields, such as VPD, PCI serial ID, MACs, etc */ +ICE_FLASH_UPDATE_PRESERVE_LIMITED , +/* Return all fields to factory settings */ +ICE_FLASH_UPDATE_PRESERVE_FACTORY_SETTINGS , +/* Do not perform any preservation */ +ICE_FLASH_UPDATE_PRESERVE_NONE , +}; + +struct ice_devlink_flash_params { +u8 reset_after_update :1 ; +u8 allow_downgrade :1 ; +u8 ignore_pending_update :1 ; + +enum ice_flash_update_preservation preservation_level; +}; +struct ice_pf {struct pci_dev *pdev;
@@ -382,6 +401,7 @@ struct ice_pf {struct devlink_region *nvm_region;struct devlink_region *devcaps_region; +struct ice_devlink_flash_params flash_params;/* OS reserved IRQ details */ struct msix_entry *msix_entries;
drivers/net/ethernet/intel/ice/ice_devlink.c +174 -1
193 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_fw_update.c +69 -4
106 lines not on this page · raw message
Signature · 1 line
2.27.0.353.gb9a2d1a0207f
Re: [RFC PATCH net-next 6/6] ice: implement devlink parameters to control flash update
Quoted 14 lines · On Thu, 9 Jul 2020 14:26:52 -0700 Jacob Keller wrote:
The flash update for the ice hardware currently supports a single fixed configuration:
* Firmware is always asked to preserve all changeable fields
* The driver never allows downgrades
* The driver will not allow canceling a previous update that never completed (for example because an EMP reset never occurred)
* The driver does not attempt to trigger an EMP reset immediately.This default mode of operation is reasonable. However, it is often useful to allow system administrators more control over the update process. To enable this, implement devlink parameters that allow the system administrator to specify the desired behaviors:
Quoted 5 lines
* '
reset_after_flash_update'
If enabled, the driver will request that the firmware immediately trigger an EMP reset when completing the device update. This will result in the device switching active banks immediately and re-initializing with the new firmware.
This should probably be handled through a reset API like what Vasundhara is already working on.
Quoted 8 lines
* '
allow_downgrade_on_flash_update'
If enabled, the driver will attempt to update device flash even when firmware indicates that such an update would be a downgrade.
* 'ignore_pending_flash_update'
If enabled, the device driver will cancel a previous pending update. A pending update is one where the steps to write the update to the NVM bank has finished, but the device never reset, as the system had not yet been rebooted.
These can be implemented in user space based on the values of running and stored versions from devlink info.
Quoted 7 lines
* '
flash_update_preservation_level'
The value determines the preservation mode to request from firmware, among the following 4 choices:
*PRESERVE_ALL(0)
Preserve all settings and fields in the NVM configuration
*PRESERVE_LIMITED(1)
Preserve only a limited set of fields, including the VPD, PCI serial
Quoted 8 lines
ID, MAC address, etc. This results in permanent settings being reset, including changes to the port configuration, such as the number of physical functions created.
*PRESERVE_FACTORY_SETTINGS(2)
Reset all configuration fields to the factory default settings stored within the NVM.
*PRESERVE_NONE(3)
Do not perform any preservation.
Could this also be handled in a separate reset API? It seems useful to be able to reset to factory defaults at any time, not just FW upgrade..
Re: [RFC PATCH net-next 6/6] ice: implement devlink parameters to control flash update
Quoted 16 lines · Jakub Kicinski
Quoted 14 lines · On Thu, 9 Jul 2020 14:26:52 -0700 Jacob Keller wrote:
The flash update for the ice hardware currently supports a single fixed configuration:
* Firmware is always asked to preserve all changeable fields
* The driver never allows downgrades
* The driver will not allow canceling a previous update that never completed (for example because an EMP reset never occurred)
* The driver does not attempt to trigger an EMP reset immediately.This default mode of operation is reasonable. However, it is often useful to allow system administrators more control over the update process. To enable this, implement devlink parameters that allow the system administrator to specify the desired behaviors:
Quoted 8 lines
Quoted 5 lines
* '
reset_after_flash_update'
If enabled, the driver will request that the firmware immediately trigger an EMP reset when completing the device update. This will result in the device switching active banks immediately and re-initializing with the new firmware.This should probably be handled through a reset API like what Vasundhara is already working on.
Yes, please go through the discussions happening on "[RFC v2 net-next]
devlink: Add reset subcommand." mail thread. I am waiting for Moshe pachset for 'devlink dev reload' before further efforts.
Quoted 31 lines
Quoted 9 lines
* '
allow_downgrade_on_flash_update'
If enabled, the driver will attempt to update device flash even when firmware indicates that such an update would be a downgrade.
* 'ignore_pending_flash_update'
If enabled, the device driver will cancel a previous pending update. A pending update is one where the steps to write the update to the NVM bank has finished, but the device never reset, as the system had not yet been rebooted.These can be implemented in user space based on the values of running and stored versions from devlink info.
Quoted 7 lines
* '
flash_update_preservation_level'
The value determines the preservation mode to request from firmware, among the following 4 choices:
*PRESERVE_ALL(0)
Preserve all settings and fields in the NVM configuration
*PRESERVE_LIMITED(1)
Preserve only a limited set of fields, including the VPD, PCI serialQuoted 8 lines
ID, MAC address, etc. This results in permanent settings being reset, including changes to the port configuration, such as the number of physical functions created.
*PRESERVE_FACTORY_SETTINGS(2)
Reset all configuration fields to the factory default settings stored within the NVM.
*PRESERVE_NONE(3)
Do not perform any preservation.Could this also be handled in a separate reset API? It seems useful to be able to reset to factory defaults at any time, not just FW upgrade..
Jacob Keller
maintainerRe: [RFC PATCH net-next 6/6] ice: implement devlink parameters to control flash update
In reply to Jakub KicinskiQuoted 15 lines · Jakub Kicinski
Quoted 14 lines · On Thu, 9 Jul 2020 14:26:52 -0700 Jacob Keller wrote:
The flash update for the ice hardware currently supports a single fixed configuration:
* Firmware is always asked to preserve all changeable fields
* The driver never allows downgrades
* The driver will not allow canceling a previous update that never completed (for example because an EMP reset never occurred)
* The driver does not attempt to trigger an EMP reset immediately.This default mode of operation is reasonable. However, it is often useful to allow system administrators more control over the update process. To enable this, implement devlink parameters that allow the system administrator to specify the desired behaviors:
Quoted 9 lines
Quoted 5 lines
* '
reset_after_flash_update'
If enabled, the driver will request that the firmware immediately trigger an EMP reset when completing the device update. This will result in the device switching active banks immediately and re-initializing with the new firmware.This should probably be handled through a reset API like what Vasundhara is already working on.
Sure. I hadn't seen that work but I'll go take a look.
Quoted 3 lines
Quoted 3 lines
* '
allow_downgrade_on_flash_update'
If enabled, the driver will attempt to update device flash even when firmware indicates that such an update would be a downgrade.
There is also some trickiness here, because what this parameter does is cause the driver to ignore the firmware version check. I suppose we could just change the default behavior to ignoring that and assume user space will check itself?
Quoted 8 lines
Quoted 5 lines
* '
ignore_pending_flash_update'
If enabled, the device driver will cancel a previous pending update. A pending update is one where the steps to write the update to the NVM bank has finished, but the device never reset, as the system had not yet been rebooted.These can be implemented in user space based on the values of running and stored versions from devlink info.
So, there's some trickiness here. We actually have to perform some steps to cancel an update. Perhaps we should introduce a new option to request that a previous update be cancelled? If we don't tell the firmware to cancel the update, then future update requests will simply fail with some errors.
Quoted 17 lines
Quoted 16 lines
* '
flash_update_preservation_level'
The value determines the preservation mode to request from firmware, among the following 4 choices:
*PRESERVE_ALL(0)
Preserve all settings and fields in the NVM configuration
*PRESERVE_LIMITED(1)
Preserve only a limited set of fields, including the VPD, PCI serial ID, MAC address, etc. This results in permanent settings being reset, including changes to the port configuration, such as the number of physical functions created.
*PRESERVE_FACTORY_SETTINGS(2)
Reset all configuration fields to the factory default settings stored within the NVM.
*PRESERVE_NONE(3)
Do not perform any preservation.
Quoted 3 lines
Could this also be handled in a separate reset API? It seems useful to be able to reset to factory defaults at any time, not just FW upgrade..
I'm not sure. At least the way it's described in the datasheet here is that this must be done during an update. I'll have to look into this further.
For the other 3 (I kept preserve none for completeness), these are referring to how much of the settings we preserve when updating to the new image, so I think they only apply at update time.
Thanks,
Jake
Re: [RFC PATCH net-next 6/6] ice: implement devlink parameters to control flash update
Quoted 27 lines · On Fri, 10 Jul 2020 10:32:24 -0700 Jacob Keller wrote:
Quoted 15 lines · Jakub Kicinski
Quoted 14 lines · On Thu, 9 Jul 2020 14:26:52 -0700 Jacob Keller wrote:
The flash update for the ice hardware currently supports a single fixed configuration:
* Firmware is always asked to preserve all changeable fields
* The driver never allows downgrades
* The driver will not allow canceling a previous update that never completed (for example because an EMP reset never occurred)
* The driver does not attempt to trigger an EMP reset immediately.This default mode of operation is reasonable. However, it is often useful to allow system administrators more control over the update process. To enable this, implement devlink parameters that allow the system administrator to specify the desired behaviors:
Quoted 8 lines
Quoted 5 lines
* '
reset_after_flash_update'
If enabled, the driver will request that the firmware immediately trigger an EMP reset when completing the device update. This will result in the device switching active banks immediately and re-initializing with the new firmware.This should probably be handled through a reset API like what Vasundhara is already working on.
Sure. I hadn't seen that work but I'll go take a look.
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
* '
allow_downgrade_on_flash_update'
If enabled, the driver will attempt to update device flash even when firmware indicates that such an update would be a downgrade.There is also some trickiness here, because what this parameter does is cause the driver to ignore the firmware version check. I suppose we could just change the default behavior to ignoring that and assume user space will check itself?
Seems only appropriate to me.
I assume this is a safety check because downgrades are sometimes impossible without factory reset (new FW version makes incompatible changes to the NVM params or such)? FWIW that's a terrible user experience, best avoided and handled as a exceptional circumstance which it should be.
The defaults should be any FW version can be installed after any FW version. Including downgrades, skipping versions etc.
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
* '
ignore_pending_flash_update'
If enabled, the device driver will cancel a previous pending update. A pending update is one where the steps to write the update to the NVM bank has finished, but the device never reset, as the system had not yet been rebooted.
Quoted 8 lines
Quoted 2 lines
These can be implemented in user space based on the values of running and stored versions from devlink info.
So, there's some trickiness here. We actually have to perform some steps to cancel an update. Perhaps we should introduce a new option to request that a previous update be cancelled? If we don't tell the firmware to cancel the update, then future update requests will simply fail with some errors.
Can't it be canceled automatically when user requests a new image to be flashed?
Perhaps best to think about it from the user perspective rather than how the internal works. User wants a new FW, they flash it. Next boot - the last flashed version should be activated.
If user wants to "cancel" and upgrade they will most likely flash the previous version of the FW.
Is the pending update/ability to cancel thing also part of the DTMF spec?
Quoted 19 lines
Quoted 16 lines
Quoted 7 lines
* '
flash_update_preservation_level'
The value determines the preservation mode to request from firmware, among the following 4 choices:
*PRESERVE_ALL(0)
Preserve all settings and fields in the NVM configuration
*PRESERVE_LIMITED(1)
Preserve only a limited set of fields, including the VPD, PCI serialQuoted 8 lines
ID, MAC address, etc. This results in permanent settings being reset, including changes to the port configuration, such as the number of physical functions created.
*PRESERVE_FACTORY_SETTINGS(2)
Reset all configuration fields to the factory default settings stored within the NVM.
*PRESERVE_NONE(3)
Do not perform any preservation.Quoted 2 lines
Could this also be handled in a separate reset API? It seems useful to be able to reset to factory defaults at any time, not just FW upgrade..
Quoted 7 lines
I'm not sure. At least the way it's described in the datasheet here is that this must be done during an update. I'll have to look into this further.
For the other 3 (I kept preserve none for completeness), these are referring to how much of the settings we preserve when updating to the new image, so I think they only apply at update time.
Not sure what the difference is between 2 and 3.
Not sure differentiating between 0 and 1 matters in practice. Clearly users will not do 0 in the field, cause they don't have new IDs assigned per product, and don't want to loose the IDs they put in their HW DB.
0 is only something a OEM can use, right? OEMs presumably generate the image per device to flash the IDs, meaning difference between 0 and 1 seems to be equivalent to flashing a special OEM FW package vs flashing a normal customer FW update...
Jacob Keller
maintainerRe: [RFC PATCH net-next 6/6] ice: implement devlink parameters to control flash update
Quoted 70 lines · Jakub Kicinski
Quoted 27 lines · On Fri, 10 Jul 2020 10:32:24 -0700 Jacob Keller wrote:
Quoted 15 lines · Jakub Kicinski
Quoted 14 lines · On Thu, 9 Jul 2020 14:26:52 -0700 Jacob Keller wrote:
The flash update for the ice hardware currently supports a single fixed configuration:
* Firmware is always asked to preserve all changeable fields
* The driver never allows downgrades
* The driver will not allow canceling a previous update that never completed (for example because an EMP reset never occurred)
* The driver does not attempt to trigger an EMP reset immediately.This default mode of operation is reasonable. However, it is often useful to allow system administrators more control over the update process. To enable this, implement devlink parameters that allow the system administrator to specify the desired behaviors:
Quoted 8 lines
Quoted 5 lines
* '
reset_after_flash_update'
If enabled, the driver will request that the firmware immediately trigger an EMP reset when completing the device update. This will result in the device switching active banks immediately and re-initializing with the new firmware.This should probably be handled through a reset API like what Vasundhara is already working on.
Sure. I hadn't seen that work but I'll go take a look.
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
* '
allow_downgrade_on_flash_update'
If enabled, the driver will attempt to update device flash even when firmware indicates that such an update would be a downgrade.There is also some trickiness here, because what this parameter does is cause the driver to ignore the firmware version check. I suppose we could just change the default behavior to ignoring that and assume user space will check itself?
Seems only appropriate to me.
I assume this is a safety check because downgrades are sometimes impossible without factory reset (new FW version makes incompatible changes to the NVM params or such)? FWIW that's a terrible user experience, best avoided and handled as a exceptional circumstance which it should be.
The defaults should be any FW version can be installed after any FW version. Including downgrades, skipping versions etc.
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
* '
ignore_pending_flash_update'
If enabled, the device driver will cancel a previous pending update. A pending update is one where the steps to write the update to the NVM bank has finished, but the device never reset, as the system had not yet been rebooted.Quoted 8 lines
Quoted 2 lines
These can be implemented in user space based on the values of running and stored versions from devlink info.
So, there's some trickiness here. We actually have to perform some steps to cancel an update. Perhaps we should introduce a new option to request that a previous update be cancelled? If we don't tell the firmware to cancel the update, then future update requests will simply fail with some errors.
Can't it be canceled automatically when user requests a new image to be flashed?
Perhaps best to think about it from the user perspective rather than how the internal works. User wants a new FW, they flash it. Next boot - the last flashed version should be activated.
Quoted 6 lines
If user wants to "cancel" and upgrade they will most likely flash the previous version of the FW.
Is the pending update/ability to cancel thing also part of the DTMF spec?
Sure, I suppose we could simply always cancel if we detect a previous update.
I'm not sure if it's part of the spec. I mostly focused on the file format.
Quoted 23 lines
Quoted 23 lines
Quoted 16 lines
Quoted 7 lines
* '
flash_update_preservation_level'
The value determines the preservation mode to request from firmware, among the following 4 choices:
*PRESERVE_ALL(0)
Preserve all settings and fields in the NVM configuration
*PRESERVE_LIMITED(1)
Preserve only a limited set of fields, including the VPD, PCI serialQuoted 8 lines
ID, MAC address, etc. This results in permanent settings being reset, including changes to the port configuration, such as the number of physical functions created.
*PRESERVE_FACTORY_SETTINGS(2)
Reset all configuration fields to the factory default settings stored within the NVM.
*PRESERVE_NONE(3)
Do not perform any preservation.Quoted 2 lines
Could this also be handled in a separate reset API? It seems useful to be able to reset to factory defaults at any time, not just FW upgrade..
I'm not sure. At least the way it's described in the datasheet here is that this must be done during an update. I'll have to look into this further.
Quoted 6 lines
Quoted 3 lines
For the other 3 (I kept preserve none for completeness), these are referring to how much of the settings we preserve when updating to the new image, so I think they only apply at update time.
Not sure what the difference is between 2 and 3.
I'll ask my colleagues. It is my understanding is currently the following:
0 (ALL) -> keep all of the settings/fields that can be configured within the flash the same. This includes things like the port configuration (number of physical functions). This is the default behavior.
1 (SELECTIVE) -> keep only a small subset that includes the static fields that shouldn't change.
2 (FACTORY) -> as discussed earlier, restores fields from a factory settings section. AFAIK this is a write-once thing where it is written at the factory.
3 (NONE) -> just write what is in the flash image, don't preserve anything.
Quoted 9 lines
Not sure differentiating between 0 and 1 matters in practice. Clearly users will not do 0 in the field, cause they don't have new IDs assigned per product, and don't want to loose the IDs they put in their HW DB.
0 is only something a OEM can use, right? OEMs presumably generate the image per device to flash the IDs, meaning difference between 0 and 1 seems to be equivalent to flashing a special OEM FW package vs flashing a normal customer FW update...
So, I think 3) would be the case where you want to jsut use what's in the image, while the diff between 0 and 1 is that 0 will preserve more settings, while 1 will only preserve the smallest necessary set.
I can ask for further information. This list was given to me as part of the request.
Jacob Keller
maintainerRe: [RFC PATCH net-next 6/6] ice: implement devlink parameters to control flash update
Quoted 140 lines · Jacob Keller
Quoted 70 lines · Jakub Kicinski
Quoted 27 lines · On Fri, 10 Jul 2020 10:32:24 -0700 Jacob Keller wrote:
Quoted 15 lines · Jakub Kicinski
Quoted 14 lines · On Thu, 9 Jul 2020 14:26:52 -0700 Jacob Keller wrote:
The flash update for the ice hardware currently supports a single fixed configuration:
* Firmware is always asked to preserve all changeable fields
* The driver never allows downgrades
* The driver will not allow canceling a previous update that never completed (for example because an EMP reset never occurred)
* The driver does not attempt to trigger an EMP reset immediately.This default mode of operation is reasonable. However, it is often useful to allow system administrators more control over the update process. To enable this, implement devlink parameters that allow the system administrator to specify the desired behaviors:
Quoted 8 lines
Quoted 5 lines
* '
reset_after_flash_update'
If enabled, the driver will request that the firmware immediately trigger an EMP reset when completing the device update. This will result in the device switching active banks immediately and re-initializing with the new firmware.This should probably be handled through a reset API like what Vasundhara is already working on.
Sure. I hadn't seen that work but I'll go take a look.
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
* '
allow_downgrade_on_flash_update'
If enabled, the driver will attempt to update device flash even when firmware indicates that such an update would be a downgrade.There is also some trickiness here, because what this parameter does is cause the driver to ignore the firmware version check. I suppose we could just change the default behavior to ignoring that and assume user space will check itself?
Seems only appropriate to me.
I assume this is a safety check because downgrades are sometimes impossible without factory reset (new FW version makes incompatible changes to the NVM params or such)? FWIW that's a terrible user experience, best avoided and handled as a exceptional circumstance which it should be.
The defaults should be any FW version can be installed after any FW version. Including downgrades, skipping versions etc.
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
* '
ignore_pending_flash_update'
If enabled, the device driver will cancel a previous pending update. A pending update is one where the steps to write the update to the NVM bank has finished, but the device never reset, as the system had not yet been rebooted.Quoted 8 lines
Quoted 2 lines
These can be implemented in user space based on the values of running and stored versions from devlink info.
So, there's some trickiness here. We actually have to perform some steps to cancel an update. Perhaps we should introduce a new option to request that a previous update be cancelled? If we don't tell the firmware to cancel the update, then future update requests will simply fail with some errors.
Can't it be canceled automatically when user requests a new image to be flashed?
Perhaps best to think about it from the user perspective rather than how the internal works. User wants a new FW, they flash it. Next boot - the last flashed version should be activated.
Quoted 6 lines
If user wants to "cancel" and upgrade they will most likely flash the previous version of the FW.
Is the pending update/ability to cancel thing also part of the DTMF spec?
Sure, I suppose we could simply always cancel if we detect a previous update.
I'm not sure if it's part of the spec. I mostly focused on the file format.
Quoted 23 lines
Quoted 23 lines
Quoted 16 lines
Quoted 7 lines
* '
flash_update_preservation_level'
The value determines the preservation mode to request from firmware, among the following 4 choices:
*PRESERVE_ALL(0)
Preserve all settings and fields in the NVM configuration
*PRESERVE_LIMITED(1)
Preserve only a limited set of fields, including the VPD, PCI serialQuoted 8 lines
ID, MAC address, etc. This results in permanent settings being reset, including changes to the port configuration, such as the number of physical functions created.
*PRESERVE_FACTORY_SETTINGS(2)
Reset all configuration fields to the factory default settings stored within the NVM.
*PRESERVE_NONE(3)
Do not perform any preservation.Quoted 2 lines
Could this also be handled in a separate reset API? It seems useful to be able to reset to factory defaults at any time, not just FW upgrade..
I'm not sure. At least the way it's described in the datasheet here is that this must be done during an update. I'll have to look into this further.
Quoted 6 lines
Quoted 3 lines
For the other 3 (I kept preserve none for completeness), these are referring to how much of the settings we preserve when updating to the new image, so I think they only apply at update time.
Not sure what the difference is between 2 and 3.
I'll ask my colleagues. It is my understanding is currently the following:
0 (ALL) -> keep all of the settings/fields that can be configured within the flash the same. This includes things like the port configuration (number of physical functions). This is the default behavior.
1 (SELECTIVE) -> keep only a small subset that includes the static fields that shouldn't change.
2 (FACTORY) -> as discussed earlier, restores fields from a factory settings section. AFAIK this is a write-once thing where it is written at the factory.
3 (NONE) -> just write what is in the flash image, don't preserve anything.
Quoted 9 lines
Not sure differentiating between 0 and 1 matters in practice. Clearly users will not do 0 in the field, cause they don't have new IDs assigned per product, and don't want to loose the IDs they put in their HW DB.
0 is only something a OEM can use, right? OEMs presumably generate the image per device to flash the IDs, meaning difference between 0 and 1 seems to be equivalent to flashing a special OEM FW package vs flashing a normal customer FW update...
Quoted 7 lines
So, I think 3) would be the case where you want to jsut use what's in the image, while the diff between 0 and 1 is that 0 will preserve more settings, while 1 will only preserve the smallest necessary set.
I can ask for further information. This list was given to me as part of the request.
Hi Jakub,
To summarize this discussion, the next spin will have the following changes:
1) remove all parameters except for the preservation_level. Both ignore_pending_flash_update and allow_downgrade_on_flash_update will be removed and change the default behavior to the most accepting case:
updates will always be tried even if firmware says its a downgrade, and we will always cancel a pending update. We will now expect user space tools to be aware of this and handle the equivalent options themselves if they desire.
2) reset_after_flash_update will be removed, and we will replace it with a new interface, perhaps like the devlink reset command suggested in another thread.
3) preservation_level will remain, but I have updated the documentation slightly.
Unfortunately it looks like FACTORY_SETTINGS option is not directly available without doing an update. It may work with a sort of "update to the same version" but I'm not sure if or how we could implement that silently in the driver. There's no other way to ask firmware to perform factory reset though. Otherwise I would remove this and make it part of a new command.
I'd also like to clarify the reasoning behind all of the options. The preservation is referring to "what to keep in the existing NVM", so "PRESERVE_ALL" is the one where the most fields and data are kept by the firmware when updating. In this mode, we do not change any settings, device-specific fields, or other configuration. This is the default. With "PRESERVE_LIMITED" the limited subset of device-specific fields are preserved, but all of the settings and configuration are overwritten. With PRESERVE_NONE, we simply write what is in the image.
The intent behind this parameter is to enable our existing tools to learn the devlink tool while being able to maintain existing behavior. For other operating systems, these tools support the preservation level, so without this parameter, we would not be able to support it. The expectation is that most of the time PRESERVE_ALL is the correct mode. However, the other options do have some usefulness, either when debugging or to recover from bad situations such as if the firmware preservation doesn't behave properly as expected.
I hope this information further clarifies our goals and why I believe the parameter is valuable.
Thanks,
Jake
Re: [RFC PATCH net-next 6/6] ice: implement devlink parameters to control flash update
Quoted 10 lines · On Wed, 15 Jul 2020 14:41:04 -0700 Jacob Keller wrote:
To summarize this discussion, the next spin will have the following changes:
1) remove all parameters except for the
preservation_level. Bothignore_pending_flash_updateandallow_downgrade_on_flash_updatewill be removed and change the default behavior to the most accepting case:
updates will always be tried even if firmware says its a downgrade, and we will always cancel a pending update. We will now expect user space tools to be aware of this and handle the equivalent options themselves if they desire.
Quoted 6 lines
2)
reset_after_flash_updatewill be removed, and we will replace it with a new interface, perhaps like the devlink reset command suggested in another thread.3)
preservation_levelwill remain, but I have updated the documentation slightly.
Okay, then. But let's make it a parameter to the flash update operation (extend the uAPI), rather than a devlink param, shall we?
Quoted 6 lines
Unfortunately it looks like
FACTORY_SETTINGSoption is not directly available without doing an update. It may work with a sort of "update to the same version" but I'm not sure if or how we could implement that silently in the driver. There's no other way to ask firmware to perform factory reset though. Otherwise I would remove this and make it part of a new command.
If the settings are restored from within the device and not the flashed image - it sounds like it's a matter of a FW change to add this functionality. Right? Maybe it's not immediately necessary if we go with the new option to flashing.
Quoted 8 lines
I'd also like to clarify the reasoning behind all of the options. The preservation is referring to "what to keep in the existing NVM", so "
PRESERVE_ALL" is the one where the most fields and data are kept by the firmware when updating. In this mode, we do not change any settings, device-specific fields, or other configuration. This is the default. With "PRESERVE_LIMITED" the limited subset of device-specific fields are preserved, but all of the settings and configuration are overwritten. WithPRESERVE_NONE, we simply write what is in the image.
IMO we need to come up with names for the reset levels which correspond to what's being reset more directly. Ones which will actually be meaningful without a 4-email-exchange with the developer :)
It makes immediate sense to me to reset any subset of { settings, identifying information }. But I don't see how reset to factory defaults fits into this. Is it controlling the source of the defaults? I.e. reset to factory defaults vs reset to FW build defaults?
Quoted 11 lines
The intent behind this parameter is to enable our existing tools to learn the devlink tool while being able to maintain existing behavior. For other operating systems, these tools support the preservation level, so without this parameter, we would not be able to support it. The expectation is that most of the time
PRESERVE_ALLis the correct mode. However, the other options do have some usefulness, either when debugging or to recover from bad situations such as if the firmware preservation doesn't behave properly as expected.I hope this information further clarifies our goals and why I believe the parameter is valuable.
Jacob Keller
maintainerRe: [RFC PATCH net-next 6/6] ice: implement devlink parameters to control flash update
Quoted 15 lines · Jakub Kicinski
Quoted 14 lines · On Wed, 15 Jul 2020 14:41:04 -0700 Jacob Keller wrote:
To summarize this discussion, the next spin will have the following changes:
1) remove all parameters except for the
preservation_level. Bothignore_pending_flash_updateandallow_downgrade_on_flash_updatewill be removed and change the default behavior to the most accepting case:
updates will always be tried even if firmware says its a downgrade, and we will always cancel a pending update. We will now expect user space tools to be aware of this and handle the equivalent options themselves if they desire.2)
reset_after_flash_updatewill be removed, and we will replace it with a new interface, perhaps like the devlink reset command suggested in another thread.
Quoted 6 lines
Quoted 2 lines
3)
preservation_levelwill remain, but I have updated the documentation slightly.Okay, then. But let's make it a parameter to the flash update operation (extend the uAPI), rather than a devlink param, shall we?
Ok, that seems reasonable. Ofcourse we'll need to find something generic enough that it can be re-used and isn't driver specific.
Quoted 11 lines
Quoted 6 lines
Unfortunately it looks like
FACTORY_SETTINGSoption is not directly available without doing an update. It may work with a sort of "update to the same version" but I'm not sure if or how we could implement that silently in the driver. There's no other way to ask firmware to perform factory reset though. Otherwise I would remove this and make it part of a new command.If the settings are restored from within the device and not the flashed image - it sounds like it's a matter of a FW change to add this functionality. Right? Maybe it's not immediately necessary if we go with the new option to flashing.
I'm not at all sure how the firmware handles this, but I was told "it's not currently possible to access this without doing an update" by the firmware engineer I talked to.
Quoted 10 lines
Quoted 9 lines
I'd also like to clarify the reasoning behind all of the options. The preservation is referring to "what to keep in the existing NVM", so "
PRESERVE_ALL" is the one where the most fields and data are kept by the firmware when updating. In this mode, we do not change any settings, device-specific fields, or other configuration. This is the default. With "PRESERVE_LIMITED" the limited subset of device-specific fields are preserved, but all of the settings and configuration are overwritten. WithPRESERVE_NONE, we simply write what is in the image.
Quoted 4 lines
IMO we need to come up with names for the reset levels which correspond to what's being reset more directly. Ones which will actually be meaningful without a 4-email-exchange with the developer :)
Ok.
Quoted 5 lines
It makes immediate sense to me to reset any subset of { settings, identifying information }. But I don't see how reset to factory defaults fits into this. Is it controlling the source of the defaults? I.e. reset to factory defaults vs reset to FW build defaults?
So basically preservation is done via a set of data stored within the image, associated with the PLDM record as "package" data. This data determines how to identify what set of fields to preserve when updating.
Essentially, when we update, we overwrite a secondary bank, and after finishing that copy, firmware needs to determine what information to copy back in so that fields don't change.
The fields are all stored within the NVM's "Preserved Field Area". When updating, the firmware merges the old images PFA with the new PFA from the new image. When "ALL" is used, then the old image's TLVs are preferred over new ones. When "LIMITED" is used, only some fields such as the identifying information, are preferred from the old image. (So that, after an update, you retain the same values). When "NONE" is used, then no preservation is done on the old image PFA, so all of its data is lost, replaced with contents from the new image.
Factory settings causes the firmware to read the PFA data from the factory settings area, rather than from the old image.
So in my examples, it's not about "what is reset" but "what is retained".
(I'm sure I got some of the details wrong, it is pretty complicated).
Having this be a parameter of the flash update command itself seems reasonable to me.
I don't know if I can get firmware to support a new command for performing the factory reset operation without doing an update. If so, then we could drop that entirely. Perhaps if the Linux interface doesn't expose this as an option, that would put more pressure to extend the firmware...
Jacob Keller
maintainerRe: [RFC PATCH net-next 6/6] ice: implement devlink parameters to control flash update
Quoted 21 lines · Jacob Keller
Quoted 18 lines · Jakub Kicinski
Quoted 16 lines · On Wed, 15 Jul 2020 14:41:04 -0700 Jacob Keller wrote:
To summarize this discussion, the next spin will have the following changes:
1) remove all parameters except for the
preservation_level. Bothignore_pending_flash_updateandallow_downgrade_on_flash_updatewill be removed and change the default behavior to the most accepting case:
updates will always be tried even if firmware says its a downgrade, and we will always cancel a pending update. We will now expect user space tools to be aware of this and handle the equivalent options themselves if they desire.2)
reset_after_flash_updatewill be removed, and we will replace it with a new interface, perhaps like the devlink reset command suggested in another thread.3)
preservation_levelwill remain, but I have updated the documentation slightly.
Quoted 7 lines
Quoted 3 lines
Okay, then. But let's make it a parameter to the flash update operation (extend the uAPI), rather than a devlink param, shall we?
Ok, that seems reasonable. Ofcourse we'll need to find something generic enough that it can be re-used and isn't driver specific.
Hi Jakub,
I think I have something that will be more clear and will be sending a new RFC with the change this afternoon:
an extension to the DEVLINK_CMD_FLASH_UPDATE with a new parameter, "overwrite" with these values:
a) "nothing" (or maybe, "firmware-only" or "binary-only"?, need a way to clarify difference between settings/vital data and firmware program binary) will request that we do not overwrite any settings or fields. This is equivalent to the "PRESERVE_ALL" I had in the original proposal, where we will maintain all settings and all vital data, but update the firmware binary.
b) "settings" will request that the firmware overwrite all the settings fields with the contents from the new image. However, vital data such as the PCI Serial ID, VPD section, MAC Addresses, and similar "static" data will be kept (not overwritten). This is the same as the "PRESERVE_LIMITED" option I had in the original proposal
c) "all" or "everything" will request that firmware overwrite all contents of the image. This means all settings and all vital data will be overwritten by the contents in the new image.
d) if we need it, a "default" that would be the current behavior of doing whatever the driver default is? (since it's not clear to me what other implementations do but perhaps they all behavior as either "nothing" or "all"?
I think I agree that "factory" settings doesn't really belong here, and I will try to push for finding an alternative way to allow access to that behavior. If we wanted it we could use "from_factory" to request that we overwrite the settings and vital data "from" the factory portion, but I think that is pushing the boundary here a bit...
I am aiming to have a new patch up with this proposal
Thanks,
Jake
Re: [RFC PATCH net-next 6/6] ice: implement devlink parameters to control flash update
Quoted 25 lines · On Thu, 16 Jul 2020 14:29:40 -0700 Jacob Keller wrote:
Quoted 2 lines · Jacob Keller
Ok, that seems reasonable. Ofcourse we'll need to find something generic enough that it can be re-used and isn't driver specific.
Hi Jakub,
I think I have something that will be more clear and will be sending a new RFC with the change this afternoon:
an extension to the
DEVLINK_CMD_FLASH_UPDATEwith a new parameter, "overwrite" with these values:a) "nothing" (or maybe, "firmware-only" or "binary-only"?, need a way to clarify difference between settings/vital data and firmware program binary) will request that we do not overwrite any settings or fields. This is equivalent to the "
PRESERVE_ALL" I had in the original proposal, where we will maintain all settings and all vital data, but update the firmware binary.b) "settings" will request that the firmware overwrite all the settings fields with the contents from the new image. However, vital data such as the PCI Serial ID, VPD section, MAC Addresses, and similar "static" data will be kept (not overwritten). This is the same as the "
PRESERVE_LIMITED" option I had in the original proposal
Quoted 3 lines
c) "all" or "everything" will request that firmware overwrite all contents of the image. This means all settings and all vital data will be overwritten by the contents in the new image.
Sorry but I'm still not 100% sure of what the use for this option is beyond an OEM. Is it possible to reset the VPD, board serial, MAC address etc. while flashing a FW image downloaded from a support site? Would that mean that if I flash a rack with one FW image all NICs will start reporting the same serial numbers and use the same MACs?
Quoted 4 lines
d) if we need it, a "default" that would be the current behavior of doing whatever the driver default is? (since it's not clear to me what other implementations do but perhaps they all behavior as either "nothing" or "all"?
As a user I'd expect "nothing" to be the default. Same as your OS update does not wipe out your settings. I think it's also better if the default is decided by Linux, not the drivers.
Quoted 7 lines
I think I agree that "factory" settings doesn't really belong here, and I will try to push for finding an alternative way to allow access to that behavior. If we wanted it we could use "
from_factory" to request that we overwrite the settings and vital data "from" the factory portion, but I think that is pushing the boundary here a bit...I am aiming to have a new patch up with this proposal
Probably best if we understand the use case more clearly, too. Since you have this implemented in your tooling what are the scenarios where factory is expected to be preferred over FW default?
Jacob Keller
maintainerRe: [RFC PATCH net-next 6/6] ice: implement devlink parameters to control flash update
Quoted 30 lines · Jakub Kicinski
Quoted 25 lines · On Thu, 16 Jul 2020 14:29:40 -0700 Jacob Keller wrote:
Quoted 2 lines · Jacob Keller
Ok, that seems reasonable. Ofcourse we'll need to find something generic enough that it can be re-used and isn't driver specific.
Hi Jakub,
I think I have something that will be more clear and will be sending a new RFC with the change this afternoon:
an extension to the
DEVLINK_CMD_FLASH_UPDATEwith a new parameter, "overwrite" with these values:a) "nothing" (or maybe, "firmware-only" or "binary-only"?, need a way to clarify difference between settings/vital data and firmware program binary) will request that we do not overwrite any settings or fields. This is equivalent to the "
PRESERVE_ALL" I had in the original proposal, where we will maintain all settings and all vital data, but update the firmware binary.b) "settings" will request that the firmware overwrite all the settings fields with the contents from the new image. However, vital data such as the PCI Serial ID, VPD section, MAC Addresses, and similar "static" data will be kept (not overwritten). This is the same as the "
PRESERVE_LIMITED" option I had in the original proposalQuoted 3 lines
c) "all" or "everything" will request that firmware overwrite all contents of the image. This means all settings and all vital data will be overwritten by the contents in the new image.
Quoted 6 lines
Sorry but I'm still not 100% sure of what the use for this option is beyond an OEM. Is it possible to reset the VPD, board serial, MAC address etc. while flashing a FW image downloaded from a support site? Would that mean that if I flash a rack with one FW image all NICs will start reporting the same serial numbers and use the same MACs?
I think the intent here is for OEMs which would generate/customize the images, though I've also been told it may be useful to get a card out of some situation where firmware preservation was broken.. (No, I don't really have more details on what specifically the situation might be). Obviously in most update cases I don't think we expect this to be used.
Quoted 9 lines
Quoted 4 lines
d) if we need it, a "default" that would be the current behavior of doing whatever the driver default is? (since it's not clear to me what other implementations do but perhaps they all behavior as either "nothing" or "all"?
As a user I'd expect "nothing" to be the default. Same as your OS update does not wipe out your settings. I think it's also better if the default is decided by Linux, not the drivers.
Right, but I wasn't sure what other drivers/devices implement today and didn't want to end up in a "well we don't behave that way so you just changed our behavior"..? Hmm. If they all behave this way today then it's fine to make "nothing" the default and modify all implementations to reject other options.
Quoted 6 lines
Quoted 6 lines
I think I agree that "factory" settings doesn't really belong here, and I will try to push for finding an alternative way to allow access to that behavior. If we wanted it we could use "
from_factory" to request that we overwrite the settings and vital data "from" the factory portion, but I think that is pushing the boundary here a bit...
Quoted 6 lines
Quoted 1 line
I am aiming to have a new patch up with this proposal
Probably best if we understand the use case more clearly, too. Since you have this implemented in your tooling what are the scenarios where factory is expected to be preferred over FW default?
I'll see if I can gather any further information on both this and the overwrite-all mode.
My understanding so far is that it is intended as a way to restore the device settings/config to what was written in the factory. I agree from Linux perspective having this be a separate command (without requiring an update) would make the most sense, but that isn't how it was implemented today.
The factory settings are stored in a separate section of flash so they aren't modified by normal update flows. I am not sure if there is a procedure for updating them or if it truly is write-once.
Thanks,
Jake
Re: [RFC PATCH net-next 6/6] ice: implement devlink parameters to control flash update
Quoted 37 lines · On Thu, 16 Jul 2020 14:52:15 -0700 Jacob Keller wrote:
Quoted 30 lines · Jakub Kicinski
Quoted 25 lines · On Thu, 16 Jul 2020 14:29:40 -0700 Jacob Keller wrote:
Quoted 2 lines · Jacob Keller
Ok, that seems reasonable. Ofcourse we'll need to find something generic enough that it can be re-used and isn't driver specific.
Hi Jakub,
I think I have something that will be more clear and will be sending a new RFC with the change this afternoon:
an extension to the
DEVLINK_CMD_FLASH_UPDATEwith a new parameter, "overwrite" with these values:a) "nothing" (or maybe, "firmware-only" or "binary-only"?, need a way to clarify difference between settings/vital data and firmware program binary) will request that we do not overwrite any settings or fields. This is equivalent to the "
PRESERVE_ALL" I had in the original proposal, where we will maintain all settings and all vital data, but update the firmware binary.b) "settings" will request that the firmware overwrite all the settings fields with the contents from the new image. However, vital data such as the PCI Serial ID, VPD section, MAC Addresses, and similar "static" data will be kept (not overwritten). This is the same as the "
PRESERVE_LIMITED" option I had in the original proposalQuoted 3 lines
c) "all" or "everything" will request that firmware overwrite all contents of the image. This means all settings and all vital data will be overwritten by the contents in the new image.
Quoted 5 lines
Sorry but I'm still not 100% sure of what the use for this option is beyond an OEM. Is it possible to reset the VPD, board serial, MAC address etc. while flashing a FW image downloaded from a support site? Would that mean that if I flash a rack with one FW image all NICs will start reporting the same serial numbers and use the same MACs?
Quoted 5 lines
I think the intent here is for OEMs which would generate/customize the images, though I've also been told it may be useful to get a card out of some situation where firmware preservation was broken.. (No, I don't really have more details on what specifically the situation might be). Obviously in most update cases I don't think we expect this to be used.
What I'm getting at is that this seems to inherently require a special FW image which will carry unique IDs, custom-selected for a particular board. So I was hoping we can infer the setting from the image being flashed. But perhaps that's risky.
Let's make sure the description of the option captures the fact that this is mostly useful in manufacturing and otherwise very rarely needed.
Quoted 9 lines
Quoted 8 lines
Quoted 4 lines
d) if we need it, a "default" that would be the current behavior of doing whatever the driver default is? (since it's not clear to me what other implementations do but perhaps they all behavior as either "nothing" or "all"?
As a user I'd expect "nothing" to be the default. Same as your OS update does not wipe out your settings. I think it's also better if the default is decided by Linux, not the drivers.
Quoted 5 lines
Right, but I wasn't sure what other
drivers/devicesimplement today and didn't want to end up in a "well we don't behave that way so you just changed our behavior"..? Hmm. If they all behave this way today then it's fine to make "nothing" the default and modify all implementations to reject other options.
Understood. Let's make things clear in the submission and CC maintainers of all drivers which implement devlink flashing today. Let them complain. If we're too cautious we'll never arrive on sane defaults.
Quoted 24 lines
Quoted 11 lines
Quoted 7 lines
I think I agree that "factory" settings doesn't really belong here, and I will try to push for finding an alternative way to allow access to that behavior. If we wanted it we could use "
from_factory" to request that we overwrite the settings and vital data "from" the factory portion, but I think that is pushing the boundary here a bit...I am aiming to have a new patch up with this proposal
Probably best if we understand the use case more clearly, too. Since you have this implemented in your tooling what are the scenarios where factory is expected to be preferred over FW default?
I'll see if I can gather any further information on both this and the overwrite-all mode.
My understanding so far is that it is intended as a way to restore the device settings/config to what was written in the factory. I agree from Linux perspective having this be a separate command (without requiring an update) would make the most sense, but that isn't how it was implemented today.
The factory settings are stored in a separate section of flash so they aren't modified by normal update flows. I am not sure if there is a procedure for updating them or if it truly is write-once.
Jacob Keller
maintainerRe: [RFC PATCH net-next 6/6] ice: implement devlink parameters to control flash update
Quoted 14 lines · Jakub Kicinski
Quoted 7 lines · On Thu, 16 Jul 2020 14:52:15 -0700 Jacob Keller wrote:
Quoted 5 lines · Jakub Kicinski
Sorry but I'm still not 100% sure of what the use for this option is beyond an OEM. Is it possible to reset the VPD, board serial, MAC address etc. while flashing a FW image downloaded from a support site? Would that mean that if I flash a rack with one FW image all NICs will start reporting the same serial numbers and use the same MACs?
Quoted 5 lines
I think the intent here is for OEMs which would generate/customize the images, though I've also been told it may be useful to get a card out of some situation where firmware preservation was broken.. (No, I don't really have more details on what specifically the situation might be). Obviously in most update cases I don't think we expect this to be used.
Quoted 5 lines
What I'm getting at is that this seems to inherently require a special FW image which will carry unique IDs, custom-selected for a particular board. So I was hoping we can infer the setting from the image being flashed. But perhaps that's risky.
Hmm. I don't think we have any obvious way to tell this.
Quoted 3 lines
Let's make sure the description of the option captures the fact that this is mostly useful in manufacturing and otherwise very rarely needed.
Sure. I'll try to make that clear in the documentation and in the naming.
Quoted 15 lines
Quoted 9 lines
Quoted 8 lines
Quoted 4 lines
d) if we need it, a "default" that would be the current behavior of doing whatever the driver default is? (since it's not clear to me what other implementations do but perhaps they all behavior as either "nothing" or "all"?
As a user I'd expect "nothing" to be the default. Same as your OS update does not wipe out your settings. I think it's also better if the default is decided by Linux, not the drivers.
Quoted 5 lines
Right, but I wasn't sure what other
drivers/devicesimplement today and didn't want to end up in a "well we don't behave that way so you just changed our behavior"..? Hmm. If they all behave this way today then it's fine to make "nothing" the default and modify all implementations to reject other options.
Quoted 4 lines
Understood. Let's make things clear in the submission and CC maintainers of all drivers which implement devlink flashing today. Let them complain. If we're too cautious we'll never arrive on sane defaults.
Yep.
I hope to have this out today, I got sidetracked yesterday.
Regards,
Jake