Skip to contentSkip to conversation

add override mask from factory settings

PATCH New Konrad Knitter 1 participant 4 messages Jun 11, 2025

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover add override mask from factory settings

Support for restoring settings and identifiers from factory settings instead of using those found in the image during the update.

Restoring data from factory settings requires restoring both settings and identifiers simultaneously. Other combinations are not supported.

The following command can be used to overwrite settings and identifiers with data from factory settings.

$ devlink dev flash <pci-address> <update-image.bin> overwrite settings
     overwrite identifier overwrite from_factory_settings

Konrad Knitter (3):
devlink: add overwrite mask from factory settings
ice: add overwrite mask from factory settings
ixgbe: add overwrite mask from factory settings

 Documentation/networking/devlink/devlink-flash.rst | 3 +++
 Documentation/networking/devlink/ice.rst           | 6 ++++++
 drivers/net/ethernet/intel/ice/ice_fw_update.c     | 4 ++++
 drivers/net/ethernet/intel/ixgbe/ixgbe_fw_update.c | 6 ++++++
 drivers/net/ethernet/intel/ixgbe/ixgbe_type_e610.h | 1 +
 include/uapi/linux/devlink.h                       | 2 ++
 6 files changed, 22 insertions(+)
Signature · 1 line
2.38.1
#1 lore raw

PATCH 1/3 devlink: add overwrite mask from factory settings

Certain sections of the device flash, containing settings or device identifying information, may be set by the OEM.

This patch introduce the ability for users to decide whether these sections should be overwritten with data from the image or retained from the factory settings.

The new option, DEVLINK_FLASH_OVERWRITE_FROM_FACTORY_SETTINGS, is intended to be used alongside DEVLINK_FLASH_OVERWRITE_IDENTIFIERS and/or DEVLINK_FLASH_OVERWRITE_SETTINGS.

This combination allows restoration of data such as MAC addresses set by the OEM manufacturer, rather than using those found in the image.

---
 Documentation/networking/devlink/devlink-flash.rst | 3 +++
 include/uapi/linux/devlink.h                       | 2 ++
 2 files changed, 5 insertions(+)
Documentation/networking/devlink/devlink-flash.rst +3 -0
index 603e732f00cc..7b04fcb95279 100644
@@ -36,6 +36,9 @@ This mask indicates the set of sections which are allowed to be overwritten.
        components being updated with the identifiers found in the provided
        image. This includes MAC addresses, serial IDs, and similar device
        identifiers.
+   * - ``DEVLINK_FLASH_OVERWRITE_FROM_FACTORY_SETTINGS``
+     - Indicates that device shall overwrite settings and identifiers from
+       factory settings section instead of provided image.
 
 Multiple overwrite bits may be combined and requested together. If no bits
 are provided, it is expected that the device only update firmware binaries
include/uapi/linux/devlink.h +2 -0
index a5ee0f13740a..b7c4b367df64 100644
@@ -270,6 +270,7 @@ enum {
 enum devlink_flash_overwrite {
 	DEVLINK_FLASH_OVERWRITE_SETTINGS_BIT,
 	DEVLINK_FLASH_OVERWRITE_IDENTIFIERS_BIT,
+	DEVLINK_FLASH_OVERWRITE_FROM_FACTORY_SETTINGS_BIT,
 
 	__DEVLINK_FLASH_OVERWRITE_MAX_BIT,
 	DEVLINK_FLASH_OVERWRITE_MAX_BIT = __DEVLINK_FLASH_OVERWRITE_MAX_BIT - 1
@@ -277,6 +278,7 @@ enum devlink_flash_overwrite {
 
 #define DEVLINK_FLASH_OVERWRITE_SETTINGS _BITUL(DEVLINK_FLASH_OVERWRITE_SETTINGS_BIT)
 #define DEVLINK_FLASH_OVERWRITE_IDENTIFIERS _BITUL(DEVLINK_FLASH_OVERWRITE_IDENTIFIERS_BIT)
+#define DEVLINK_FLASH_OVERWRITE_FROM_FACTORY_SETTINGS _BITUL(DEVLINK_FLASH_OVERWRITE_FROM_FACTORY_SETTINGS_BIT)
 
 #define DEVLINK_SUPPORTED_FLASH_OVERWRITE_SECTIONS \
 	(_BITUL(__DEVLINK_FLASH_OVERWRITE_MAX_BIT) - 1)
Signature · 1 line
2.38.1
#2 lore raw

PATCH 2/3 ice: add overwrite mask from factory settings

In reply to Konrad Knitter

Support for restoring settings and identifiers from factory settings instead of using those found in the image.

Restoring data from factory settings requires restoring both settings and identifiers simultaneously. Other combinations are not supported.

---
 Documentation/networking/devlink/ice.rst       | 6 ++++++
 drivers/net/ethernet/intel/ice/ice_fw_update.c | 4 ++++
 2 files changed, 10 insertions(+)
Documentation/networking/devlink/ice.rst +6 -0
index 792e9f8c846a..c11c7bc1362c 100644
@@ -222,6 +222,12 @@ combined flash image that contains the ``fw.mgmt``, ``fw.undi``, and
        identifying fields such as the MAC address, VPD area, and device
        serial number. It is expected that this combination be used with an
        image customized for the specific device.
+   * - ``DEVLINK_FLASH_OVERWRITE_SETTINGS``, ``DEVLINK_FLASH_OVERWRITE_IDENTIFIERS``
+       and ``DEVLINK_FLASH_OVERWRITE_FROM_FACTORY_SETTINGS``
+     - Do not preserve either settings or identifiers. Overwrite everything
+       in the flash with contents of the factory settings section instead of
+       provided image.
+
 
 The ice hardware does not support overwriting only identifiers while
 preserving settings, and thus ``DEVLINK_FLASH_OVERWRITE_IDENTIFIERS`` on its
drivers/net/ethernet/intel/ice/ice_fw_update.c +4 -0
index d86db081579f..f869648939bf 100644
@@ -1008,6 +1008,10 @@ int ice_devlink_flash_update(struct devlink *devlink,
 					      DEVLINK_FLASH_OVERWRITE_IDENTIFIERS)) {
 		/* overwrite both settings and identifiers, preserve nothing */
 		preservation = ICE_AQC_NVM_NO_PRESERVATION;
+	} else if (params->overwrite_mask == (DEVLINK_FLASH_OVERWRITE_SETTINGS |
+					      DEVLINK_FLASH_OVERWRITE_IDENTIFIERS |
+					      DEVLINK_FLASH_OVERWRITE_FROM_FACTORY_SETTINGS)) {
+		preservation = ICE_AQC_NVM_FACTORY_DEFAULT;
 	} else {
 		NL_SET_ERR_MSG_MOD(extack, "Requested overwrite mask is not supported");
 		return -EOPNOTSUPP;
Signature · 1 line
2.38.1
#3 lore raw

PATCH 3/3 ixgbe: add overwrite mask from factory settings

In reply to Konrad Knitter

Support for restoring settings and identifiers from factory settings instead of using those found in the image.

Restoring data from factory settings requires restoring both settings and identifiers simultaneously. Other combinations are not supported.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_fw_update.c | 6 ++++++
 drivers/net/ethernet/intel/ixgbe/ixgbe_type_e610.h | 1 +
 2 files changed, 7 insertions(+)
drivers/net/ethernet/intel/ixgbe/ixgbe_fw_update.c +6 -0
index e5479fc07a07..6b46da369934 100644
@@ -654,6 +654,12 @@ int ixgbe_flash_pldm_image(struct devlink *devlink,
 		/* overwrite both settings and identifiers, preserve nothing */
 		preservation = IXGBE_ACI_NVM_NO_PRESERVATION;
 		break;
+	case (DEVLINK_FLASH_OVERWRITE_SETTINGS |
+	     DEVLINK_FLASH_OVERWRITE_IDENTIFIERS |
+	     DEVLINK_FLASH_OVERWRITE_FROM_FACTORY_SETTINGS):
+		/* overwrite both settings and identifiers, from factory settings */
+		preservation = IXGBE_ACI_NVM_FACTORY_DEFAULT;
+		break;
 	default:
 		NL_SET_ERR_MSG_MOD(extack,
 				   "Requested overwrite mask is not supported");
drivers/net/ethernet/intel/ixgbe/ixgbe_type_e610.h +1 -0
index d76334b8fbad..426bb2424620 100644
@@ -691,6 +691,7 @@ struct ixgbe_aci_cmd_nvm {
 #define IXGBE_ACI_NVM_LAST_CMD		BIT(0)
 #define IXGBE_ACI_NVM_PCIR_REQ		BIT(0) /* Used by NVM Write reply */
 #define IXGBE_ACI_NVM_PRESERVE_ALL	BIT(1)
+#define IXGBE_ACI_NVM_FACTORY_DEFAULT	BIT(2)
 #define IXGBE_ACI_NVM_ACTIV_SEL_NVM	BIT(3) /* Write Activate/SR Dump only */
 #define IXGBE_ACI_NVM_ACTIV_SEL_OROM	BIT(4)
 #define IXGBE_ACI_NVM_ACTIV_SEL_NETLIST	BIT(5)
Signature · 1 line
2.38.1