ice: eRoT adapter NVM update guard
Subsystems (6)
v4 cover ice: eRoT adapter NVM update guard
Parse the external Root of Trust capability and reject a PLDM capsule that does not carry every component an eRoT adapter authenticates, before any flash bank is erased.
Changes in this v4 respin:
- Apply the two nitpicks on 2/2 from Przemek's review: move the dev_caps declaration to the end of the declaration block, and use goto free_caps on the ice_discover_dev_caps() failure path.
- Add the Reviewed-by tags of Przemek Kitszel and Tomasz Lichwala, given on v3 and standing with the nitpicks fixed.
On the Manifest: the AQ activation select mask and the pending update capabilities have no Manifest entry, so the driver writes that bank and requests no activation for it. It can neither activate nor roll back the bank, and the devlink docs now say so. Two points still need an answer from the firmware side, and a Tested-by from a named adapter would carry the rest: whether shadow RAM word 0x4E and component ID 0x12 are the right values for the PQC Manifest, and whether the eRoT authenticates a Manifest against the active image, which decides whether writing it before the other banks are activated is safe.
Two defects next to this path are not part of this series because they predate it: an ice_aq_task left linked in pf->aq_wait_list when an AQ command submission fails, because ice_aq_prep_for_event() has no undo helper, and unchecked lengths in lib/pldmfw (a 32-bit size_t wrap in pldm_check_fw_space(), and a component bitmap whose length is never checked against the component count). Fixes go out separately; the new module type ID only widens the first one.
Aleksandr Loktionov (2):
ice: parse external Root of Trust capability
ice: reject partial NVM update on eRoT adapters
Documentation/networking/devlink/ice.rst | 24 +++ .../net/ethernet/intel/ice/ice_adminq_cmd.h | 1 + drivers/net/ethernet/intel/ice/ice_common.c | 7 + .../net/ethernet/intel/ice/ice_fw_update.c | 192 +++++++++++++++--- drivers/net/ethernet/intel/ice/ice_type.h | 4 + include/linux/net/intel/libie/adminq.h | 1 + 6 files changed, 202 insertions(+), 27 deletions(-)
Signature · 1 line
2.56.0
PATCH v4 1/2 ice: parse external Root of Trust capability
Reserve the external PQC Root of Trust capability ID in the shared libie capability list and parse its value into the device capabilities.
Firmware reports 1 when an external Root of Trust (eRoT) controller is present and 0 when it is not. Keep a separate bit for an explicit value other than 0 or 1, so the flash path can reject an unknown answer instead of reading it as absence: an image the eRoT turns down leaves an erased flash bank behind, so guessing is worse than not flashing. Set both bits with |=, so a duplicated capability entry cannot undo a verdict already taken from an earlier one: an invalid value always rejects the update, and a mix of 0 and 1 keeps the eRoT checks enabled.
--- drivers/net/ethernet/intel/ice/ice_common.c | 7 +++++++ drivers/net/ethernet/intel/ice/ice_type.h | 3 +++ include/linux/net/intel/libie/adminq.h | 1 + 3 files changed, 11 insertions(+)
drivers/net/ethernet/intel/ice/ice_common.c +7 -0
@@ -2503,6 +2503,13 @@ ice_parse_common_caps(struct ice_hw *hw, struct ice_hw_common_caps *caps,case LIBIE_AQC_CAPS_TX_SCHED_TOPO_COMP_MODE : caps->tx_sched_topo_comp_mode_en = (number ==1 );break ; +case LIBIE_AQC_CAPS_EXTERNAL_PQC_ROT_PRESENT : +/* sticky, so a duplicated entry cannot clear an earlier verdict */ + caps->external_pqc_rot_present |= (number ==1 ); + caps->external_pqc_rot_invalid |= (number !=0 && number !=1 ); +ice_debug (hw,ICE_DBG_INIT ,"%s: external_pqc_rot = %u\n" , + prefix, number); +break ;default :/* Not one of the recognized common capabilities */ found = false;
drivers/net/ethernet/intel/ice/ice_type.h +3 -0
@@ -311,6 +311,9 @@ struct ice_hw_common_caps {/* Post update reset restriction */ bool reset_restrict_support;bool tx_sched_topo_comp_mode_en; +/* External Root of Trust (eRoT) controller present */ +bool external_pqc_rot_present; +bool external_pqc_rot_invalid; };/* IEEE 1588 TIME_SYNC specific info */
include/linux/net/intel/libie/adminq.h +1 -0
@@ -175,6 +175,7 @@ LIBIE_CHECK_STRUCT_LEN(16, libie_aqc_list_caps);#define LIBIE_AQC_CAPS_PENDING_OROM_VER 0x004B#define LIBIE_AQC_CAPS_NET_VER 0x004C#define LIBIE_AQC_CAPS_PENDING_NET_VER 0x004D +#define LIBIE_AQC_CAPS_EXTERNAL_PQC_ROT_PRESENT 0x004E#define LIBIE_AQC_CAPS_RDMA 0x0051#define LIBIE_AQC_CAPS_LED 0x0061#define LIBIE_AQC_CAPS_SDP 0x0062
Signature · 1 line
2.56.0
PATCH v4 2/2 ice: reject partial NVM update on eRoT adapters
In reply to Aleksandr LoktionovAn eRoT authenticates the complete NVM image, so a PLDM capsule that carries only part of the components is not a valid update on such an adapter. Report that from the driver: it knows the components an eRoT adapter needs, so it can reject the image with a reason in the extended ACK before anything is written to the device.
Reject a repeated component and a component without data while the component tables are sent, and require all four components before the first bank is erased. Check the component set again before activation, because an image whose device record selects no component at all skips the flash path and still reaches that step. Reject a single component request up front, and accept the Manifest component only when firmware reports eRoT presence. Adapters whose firmware does not report eRoT keep their current handling.
Read the device capabilities once per flash attempt and act on that snapshot, then reuse it for the pending update check the attempt already makes, so an update still costs one List Device Capabilities round trip. The cached copy in hw->dev_caps cannot decide this: a driver loaded while firmware was already in recovery mode never reads it, and a reset re-parses it in place. An explicit capability value other than 0 or 1 rejects every update, because an answer the driver cannot interpret is not evidence that the image is complete.
No activation is requested for the Manifest: the AQ activation select mask and the pending update capabilities have no Manifest entry, so the driver writes the bank and leaves the activation flag zero. It can neither activate nor roll back that bank, which is documented along with the other eRoT update limits.
--- Documentation/networking/devlink/ice.rst | 24 +++ .../net/ethernet/intel/ice/ice_adminq_cmd.h | 1 + .../net/ethernet/intel/ice/ice_fw_update.c | 192 +++++++++++++++--- drivers/net/ethernet/intel/ice/ice_type.h | 1 + 4 files changed, 191 insertions(+), 27 deletions(-)
Documentation/networking/devlink/ice.rst +24 -0
@@ -205,6 +205,30 @@ The ``ice`` driver implements support for flash update using the combined flash image that contains the ``fw.mgmt``, ``fw.undi``, and ``fw.netlist`` components. +When firmware reports an external Root of Trust (eRoT), the image must +also contain the ``fw.pqc_manifest`` component and all four components +must be updated together. A single component request is rejected before +anything is written to the device. An image that misses one of the four +components, repeats one, or carries a component without data is +rejected before any flash bank is erased, but by then any previously +pending update has already been canceled. The driver queries the device +capabilities for every flash attempt, so these restrictions follow what +the firmware reports at that moment, including on a driver loaded while +the firmware was already in recovery mode. Adapters whose firmware does +not report the eRoT capability keep their previous handling, and a +``fw.pqc_manifest`` component always requires a reported eRoT +capability. A reported eRoT capability value other than 0 or 1 makes +every flash update fail with ``-EIO``; update such firmware out of band. + +These checks reject images the adapter cannot use. They do not +authenticate image contents and they do not make the update atomic. The +driver cannot activate or roll back the ``fw.pqc_manifest`` component: +the AQ activation select mask names only ``fw.mgmt``, ``fw.undi`` and +``fw.netlist``, and no pending update capability describes a Manifest. +If an update fails after the Manifest bank has been written, the state +of that bank is defined by the firmware, not by the driver, and +recovering the adapter then needs out-of-band tooling. + .. list-table:: List of supported overwrite modes :widths: 5 95
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +1 -0
@@ -1748,6 +1748,7 @@ struct ice_aqc_nvm_comp_tbl {#define NVM_COMP_ID_OROM 0x5#define NVM_COMP_ID_NVM 0x6#define NVM_COMP_ID_NETLIST 0x8 +#define NVM_COMP_ID_MANIFEST 0x12u8 comp_class_idx;#define FWU_COMP_CLASS_IDX_NOT_USE 0x0
drivers/net/ethernet/intel/ice/ice_fw_update.c +165 -27
325 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_type.h +1 -0
@@ -1152,6 +1152,7 @@ struct ice_aq_get_set_rss_lut_params {#define ICE_SR_OROM_BANK_SIZE 0x45#define ICE_SR_NETLIST_BANK_PTR 0x46#define ICE_SR_NETLIST_BANK_SIZE 0x47 +#define ICE_SR_PQC_MANIFEST_BANK_PTR 0x4E#define ICE_SR_SECTOR_SIZE_IN_WORDS 0x800/* CSS Header words */
Signature · 1 line
2.56.0