Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BAF61606A320 for ; Tue, 1 Dec 2026 15:20:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=xlz6oS4z; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=mFKN+oM9 Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 91D97607E2; Tue, 1 Dec 2026 15:20:24 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id RL_gvNV-r6nP; Tue, 1 Dec 2026 15:20:23 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp3.osuosl.org 5D364608FC Authentication-Results: smtp3.osuosl.org; arc=none smtp.remote-ip=140.211.166.142 ARC-Seal: i=1; d=osuosl.org; s=arc; a=rsa-sha256; cv=none; t=1796138423; b=J9+w101x2Quc27ejMSWQLXRivywLyhVa35SgOSzliL3oEgF70Rh9IJexNZCsRR/YT23n /vT+448EOq+IRM8H4ed6f+vz6/Pp2SNNTDPRqvUSd/NWjjojaw01TIQUByWYJtmLej78J xK4uor32xXMeSuLzIXR+U8r837G3WPFudPPN4SNOxC/YNtIb0CuApjyllNdlZc+2mwheQ N1JIkwp2KEbKnVKTv665T3e6vMUf8EYM0g/0Io/1Epe1Kw8hhAZ2siBH1d7sKIPLMfxv5 aebrENqt/GNxSvL2v7WmxjTJY9TygiJTGhGd0zmQr5KYgMiotme5v+bxAKb+NrQY3OA== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1796138423; h=X-Comment:DKIM-Signature:X-Original-To:Delivered-To:Received: Received:X-Virus-Scanned:X-Spam-Flag:X-Spam-Score:X-Spam-Level: X-Spam-Status:Received:ARC-Filter:Received-SPF:Received: DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID:X-IronPort-AV: X-IronPort-AV:Received:X-CSE-ConnectionGUID:X-CSE-MsgGUID:X-ExtLoop1: X-IronPort-AV:Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding: X-BeenThere:X-Mailman-Version:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:Errors-To; bh=igMH45/YMp9rEGsgTA6o0urGiidp99mBBzzwgOKTmAc=; b=qKCfSlfDfiuZLRPl+n/vIISLfSKA1yqBZlaxDrJX+gFvzFkATopHqfHW7b3lcNykQBpZ Ut1Fto2/7FdUAghqMgzXsXLOylxsfYAv4/W9bkjWdCpcA0y7OyxVmm07t06TIb+B78izn UHlsk1abumYFIzIvHYYlLf41/3xv9oGLRSoWybKv7UlSn5ln0g+HJZ0x85JqOdZzspc79 4SvasrSsaIZ9u4VF0MjDe7MnaD4DsVB922IrWu0XRwYqSbmr51aq0HP6M/imCS8MScjC1 Wr8Wd57PA/XkFK23szVq6yHyAbu51oqpUmyp76mcL/speNTRv2E3Jbkpe7ZBNS4NXlA== ARC-Authentication-Results: i=1; smtp3.osuosl.org; arc=none smtp.remote-ip=140.211.166.142 X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1796138423; bh=igMH45/YMp9rEGsgTA6o0urGiidp99mBBzzwgOKTmAc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=xlz6oS4zOnVtgeMJzjQAsCOWkrCjuWc0pIJIPnes2s7huhxnwjfsoqca9GzhoAXr9 DdCnge/p3gXc26zgCyfUUtaoSvNZxWGagwxQhFYe/7b69msWwZr4WqiNthnHOdSeKM Ow6N+4BmYINQai1h+QcTp7H3VQcgXWqCDJUCe+O4o58XBEthcwqs/1PRTV7Ff+mkdb 9cg/YzfdplPwJ3dXip4F8de6UKRx/44KTLCIMGmkaxWZeBIfo0yaYDKtBjh+5gvcTg GfHGgdtVIVHlWsBxmUtcbj6RKq2EWnWD7BVFowiMFYN9Fc+ymLccDYUZWNmOMz2PMV 8c7NG1DKNFs+w== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id 5D364608FC; Tue, 1 Dec 2026 15:20:23 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists1.osuosl.org (Postfix) with ESMTP id 8F02DA0F for ; Tue, 1 Dec 2026 15:20:19 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 8CB0380F7B for ; Tue, 1 Dec 2026 15:20:19 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id l3SshdiGaV3Y for ; Tue, 1 Dec 2026 15:20:18 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp1.osuosl.org 3711D80F7D Authentication-Results: smtp1.osuosl.org; arc=none smtp.remote-ip=198.175.65.19 Received-SPF: None (mailfrom) identity=mailfrom; client-ip=198.175.65.19; helo=mgamail.intel.com; envelope-from=aleksandr.loktionov@intel.com; receiver= Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=mFKN+oM9 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) by smtp1.osuosl.org (Postfix) with ESMTPS id 3711D80F7D for ; Tue, 1 Dec 2026 15:20:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796138419; x=1827674419; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=igMH45/YMp9rEGsgTA6o0urGiidp99mBBzzwgOKTmAc=; b=mFKN+oM9cxWsQjS8M2zKv9dsQv7pNqa+t7kbgS1KPiwCoWMRJkH11Rln Yt9U/xKhhzhM3wIg5rVN3xPb72+rkR70Y29xi8HD+AjSY4KRGm6VKizjd M5Gdexjf2FsmAucSLayoTYf0B8CVy2wzUBTOB9sPRbjKGhlZAviXTjmT9 0P1QtxEanQfpOdM/4E6oX8vGWI9rUV17DbwrccZwjSzOSXKHNJWKwVwoq JU+/LLmPZhl2bwnU0L7tVfS16kzc1TwlbAYuinlORfXHD+8ART2MsE1Xl HrFqwNjbjhT0sUbc5fbbr4SjKQRVibgBypAHHdsiMtCBAOwMy5iZ6raF0 Q==; X-CSE-ConnectionGUID: P1XWYozuQAeDMw1m1X2gGw== X-CSE-MsgGUID: GUMMnEWdSQmNAt2QjZjttw== X-IronPort-AV: E=McAfee;i="6800,10657,11983"; a="5093143" X-IronPort-AV: E=Sophos;i="6.27,245,1787036400"; d="scan'208";a="5093143" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2026 07:20:08 -0800 X-CSE-ConnectionGUID: MChtBoopQEKECd9esXcafQ== X-CSE-MsgGUID: lhYnn8S/RP2+yhixDW6V2g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,245,1787036400"; d="scan'208";a="13112571" Received: from amlin-019-225.igk.intel.com ([10.102.19.225]) by orviesa004.jf.intel.com with ESMTP; 01 Dec 2026 07:20:06 -0800 From: Aleksandr Loktionov To: intel-wired-lan@lists.osuosl.org, anthony.l.nguyen@intel.com, aleksandr.loktionov@intel.com Cc: Przemek Kitszel , Tomasz Lichwala Subject: [PATCH iwl-next v4 2/2] ice: reject partial NVM update on eRoT adapters Date: Tue, 1 Dec 2026 16:20:02 +0100 Message-ID: <20261201152002.52045-3-aleksandr.loktionov@intel.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261201152002.52045-1-aleksandr.loktionov@intel.com> References: <20261201152002.52045-1-aleksandr.loktionov@intel.com> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Archive: List-Post: List-Help: List-Subscribe: , X-Spam-Status: No, score=-18.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 An 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. Reviewed-by: Przemek Kitszel Reviewed-by: Tomasz Lichwala Signed-off-by: Aleksandr Loktionov --- 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(-) diff --git a/Documentation/networking/devlink/ice.rst b/Documentation/networking/devlink/ice.rst index 792e9f8..a8d8cb5 100644 --- a/Documentation/networking/devlink/ice.rst +++ b/Documentation/networking/devlink/ice.rst @@ -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 diff --git a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h index 848ac58..072cd0b 100644 --- a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h +++ b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h @@ -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 0x12 u8 comp_class_idx; #define FWU_COMP_CLASS_IDX_NOT_USE 0x0 diff --git a/drivers/net/ethernet/intel/ice/ice_fw_update.c b/drivers/net/ethernet/intel/ice/ice_fw_update.c index 3631461..8a1c083 100644 --- a/drivers/net/ethernet/intel/ice/ice_fw_update.c +++ b/drivers/net/ethernet/intel/ice/ice_fw_update.c @@ -9,6 +9,15 @@ #include "ice_lib.h" #include "ice_fw_update.h" +/* Bitmask values for ice_fwu_priv::seen_components */ +#define ICE_FWU_COMP_NVM BIT(0) +#define ICE_FWU_COMP_OROM BIT(1) +#define ICE_FWU_COMP_NETLIST BIT(2) +#define ICE_FWU_COMP_MANIFEST BIT(3) +/* Components an eRoT adapter requires in a single update */ +#define ICE_FWU_COMP_ALL_EROT (ICE_FWU_COMP_NVM | ICE_FWU_COMP_OROM | \ + ICE_FWU_COMP_NETLIST | ICE_FWU_COMP_MANIFEST) + struct ice_fwu_priv { struct pldmfw context; @@ -29,6 +38,10 @@ struct ice_fwu_priv { /* Track if EMP reset is available */ u8 emp_reset_available; + + /* Bitmask of components seen in this image (ICE_FWU_COMP_*) */ + u8 seen_components; + bool erot_present; }; /** @@ -108,6 +121,9 @@ ice_check_component_response(struct ice_pf *pf, u16 id, u8 response, u8 code, case NVM_COMP_ID_NETLIST: component = "fw.netlist"; break; + case NVM_COMP_ID_MANIFEST: + component = "fw.pqc_manifest"; + break; default: WARN(1, "Unexpected unknown component identifier 0x%02x", id); return -EINVAL; @@ -220,12 +236,26 @@ ice_send_component_table(struct pldmfw *context, struct pldmfw_component *compon struct ice_pf *pf = priv->pf; struct ice_hw *hw = &pf->hw; size_t length; + u8 comp_bit; int status; switch (component->identifier) { case NVM_COMP_ID_OROM: + comp_bit = ICE_FWU_COMP_OROM; + break; case NVM_COMP_ID_NVM: + comp_bit = ICE_FWU_COMP_NVM; + break; case NVM_COMP_ID_NETLIST: + comp_bit = ICE_FWU_COMP_NETLIST; + break; + case NVM_COMP_ID_MANIFEST: + if (!priv->erot_present) { + NL_SET_ERR_MSG_MOD(extack, + "Manifest component requires an eRoT capable adapter"); + return -EOPNOTSUPP; + } + comp_bit = ICE_FWU_COMP_MANIFEST; break; default: dev_err(dev, "Unable to update due to a firmware component with unknown ID %u\n", @@ -234,6 +264,19 @@ ice_send_component_table(struct pldmfw *context, struct pldmfw_component *compon return -EOPNOTSUPP; } + if (priv->erot_present) { + if (priv->seen_components & comp_bit) { + NL_SET_ERR_MSG_MOD(extack, "Duplicate component in PLDM image"); + return -EINVAL; + } + /* the PLDM parser accepts a component without any data */ + if (!component->component_size) { + NL_SET_ERR_MSG_MOD(extack, "Firmware component carries no data to flash"); + return -EINVAL; + } + priv->seen_components |= comp_bit; + } + length = struct_size(comp_tbl, cvs, component->version_len); comp_tbl = kzalloc(length, GFP_KERNEL); if (!comp_tbl) @@ -623,6 +666,25 @@ ice_switch_flash_banks(struct ice_pf *pf, u8 activate_flags, return 0; } +/** + * ice_fwu_check_erot - reject an eRoT update that misses a component + * @priv: PLDM firmware update private data + * + * An eRoT authenticates the complete NVM image, so all four components + * must be updated together. + * + * Returns: zero when the update may proceed, -EINVAL otherwise. + */ +static int ice_fwu_check_erot(struct ice_fwu_priv *priv) +{ + if (!priv->erot_present || priv->seen_components == ICE_FWU_COMP_ALL_EROT) + return 0; + + NL_SET_ERR_MSG_MOD(priv->extack, + "eRoT adapter requires fw.mgmt, fw.undi, fw.netlist and fw.pqc_manifest"); + return -EINVAL; +} + /** * ice_flash_component - Flash a component of the NVM * @context: PLDM fw update structure @@ -667,6 +729,13 @@ ice_flash_component(struct pldmfw *context, struct pldmfw_component *component) reset_level = NULL; name = "fw.netlist"; break; + case NVM_COMP_ID_MANIFEST: + module = ICE_SR_PQC_MANIFEST_BANK_PTR; + /* the activation select mask has no bit for the manifest */ + flag = 0; + reset_level = NULL; + name = "fw.pqc_manifest"; + break; default: /* This should not trigger, since we check the id before * sending the component table to firmware. @@ -676,6 +745,13 @@ ice_flash_component(struct pldmfw *context, struct pldmfw_component *component) return -EINVAL; } + /* every component table is sent before the first component is flashed, + * so all components of the image are already known here + */ + err = ice_fwu_check_erot(priv); + if (err) + return err; + /* Mark this component for activating at the end */ priv->activate_flags |= flag; @@ -706,6 +782,11 @@ static int ice_finalize_update(struct pldmfw *context) struct devlink *devlink; int err; + /* an image without any applicable component still reaches this point */ + err = ice_fwu_check_erot(priv); + if (err) + return err; + /* Finally, notify firmware to activate the written NVM banks */ err = ice_switch_flash_banks(pf, priv->activate_flags, &priv->emp_reset_available, extack); @@ -843,6 +924,39 @@ static const struct pldmfw_ops ice_fwu_ops_e822 = { .finalize_update = &ice_finalize_update, }; +/** + * ice_pending_updates_from_caps - Report the pending updates of a caps read + * @pf: the PF driver structure + * @pending: on return, bitmap of updates pending + * @dev_caps: device capabilities holding the pending flags + * + * Build the bitmap of flash components with an update pending, from an + * already read set of device capabilities. + */ +static void +ice_pending_updates_from_caps(struct ice_pf *pf, u8 *pending, + const struct ice_hw_dev_caps *dev_caps) +{ + struct device *dev = ice_pf_to_dev(pf); + + *pending = 0; + + if (dev_caps->common_cap.nvm_update_pending_nvm) { + dev_info(dev, "The fw.mgmt flash component has a pending update\n"); + *pending |= ICE_AQC_NVM_ACTIV_SEL_NVM; + } + + if (dev_caps->common_cap.nvm_update_pending_orom) { + dev_info(dev, "The fw.undi flash component has a pending update\n"); + *pending |= ICE_AQC_NVM_ACTIV_SEL_OROM; + } + + if (dev_caps->common_cap.nvm_update_pending_netlist) { + dev_info(dev, "The fw.netlist flash component has a pending update\n"); + *pending |= ICE_AQC_NVM_ACTIV_SEL_NETLIST; + } +} + /** * ice_get_pending_updates - Check if the component has a pending update * @pf: the PF driver structure @@ -857,7 +971,6 @@ static const struct pldmfw_ops ice_fwu_ops_e822 = { int ice_get_pending_updates(struct ice_pf *pf, u8 *pending, struct netlink_ext_ack *extack) { - struct device *dev = ice_pf_to_dev(pf); struct ice_hw_dev_caps *dev_caps; struct ice_hw *hw = &pf->hw; int err; @@ -878,22 +991,7 @@ int ice_get_pending_updates(struct ice_pf *pf, u8 *pending, return err; } - *pending = 0; - - if (dev_caps->common_cap.nvm_update_pending_nvm) { - dev_info(dev, "The fw.mgmt flash component has a pending update\n"); - *pending |= ICE_AQC_NVM_ACTIV_SEL_NVM; - } - - if (dev_caps->common_cap.nvm_update_pending_orom) { - dev_info(dev, "The fw.undi flash component has a pending update\n"); - *pending |= ICE_AQC_NVM_ACTIV_SEL_OROM; - } - - if (dev_caps->common_cap.nvm_update_pending_netlist) { - dev_info(dev, "The fw.netlist flash component has a pending update\n"); - *pending |= ICE_AQC_NVM_ACTIV_SEL_NETLIST; - } + ice_pending_updates_from_caps(pf, pending, dev_caps); kfree(dev_caps); @@ -904,6 +1002,7 @@ int ice_get_pending_updates(struct ice_pf *pf, u8 *pending, * ice_cancel_pending_update - Cancel any pending update for a component * @pf: the PF driver structure * @component: if not NULL, the name of the component being updated + * @dev_caps: device capabilities to read the pending updates from * @extack: Netlink extended ACK structure * * Cancel any pending update for the specified component. If component is @@ -913,6 +1012,7 @@ int ice_get_pending_updates(struct ice_pf *pf, u8 *pending, */ static int ice_cancel_pending_update(struct ice_pf *pf, const char *component, + const struct ice_hw_dev_caps *dev_caps, struct netlink_ext_ack *extack) { struct devlink *devlink = priv_to_devlink(pf); @@ -921,9 +1021,7 @@ ice_cancel_pending_update(struct ice_pf *pf, const char *component, u8 pending; int err; - err = ice_get_pending_updates(pf, &pending, extack); - if (err) - return err; + ice_pending_updates_from_caps(pf, &pending, dev_caps); /* If the flash_update request is for a specific component, ignore all * of the other components. @@ -981,9 +1079,10 @@ ice_cancel_pending_update(struct ice_pf *pf, const char *component, * formatted image that matches this device. * * Extract the device record Package Data and Component Tables and send them - * to the firmware. Extract and write the flash data for each of the three - * main flash components, "fw.mgmt", "fw.undi", and "fw.netlist". Notify - * firmware once the data is written to the inactive banks. + * to the firmware. Extract and write the flash data for each of the main + * flash components, "fw.mgmt", "fw.undi", and "fw.netlist", plus + * "fw.pqc_manifest" on eRoT adapters. Notify firmware once the data is + * written to the inactive banks. * * Returns: zero on success or a negative error code on failure. */ @@ -997,6 +1096,7 @@ int ice_devlink_flash_update(struct devlink *devlink, struct ice_fwu_priv priv; u8 preservation; int err; + struct ice_hw_dev_caps *dev_caps; if (!params->overwrite_mask) { /* preserve all settings and identifiers */ @@ -1013,18 +1113,51 @@ int ice_devlink_flash_update(struct devlink *devlink, return -EOPNOTSUPP; } - if (!hw->dev_caps.common_cap.nvm_unified_update && !ice_is_recovery_mode(hw)) { + dev_caps = kzalloc_obj(*dev_caps); + if (!dev_caps) + return -ENOMEM; + + /* Read the most recent device capabilities from firmware. Do not use + * the cached values in hw->dev_caps: a driver loaded while firmware + * was already in recovery mode never reads them, and a reset may be + * rebuilding them while this request runs. The same read serves the + * pending update check below, so this costs one AQ command per flash + * attempt, as it did before. + */ + err = ice_discover_dev_caps(hw, dev_caps); + if (err) { + NL_SET_ERR_MSG_MOD(extack, "Unable to read device capabilities"); + goto free_caps; + } + + if (dev_caps->common_cap.external_pqc_rot_invalid) { + NL_SET_ERR_MSG_MOD(extack, "Invalid eRoT capability reported by firmware"); + err = -EIO; + goto free_caps; + } + + if (!dev_caps->common_cap.nvm_unified_update && !ice_is_recovery_mode(hw)) { NL_SET_ERR_MSG_MOD(extack, "Current firmware does not support unified update"); - return -EOPNOTSUPP; + err = -EOPNOTSUPP; + goto free_caps; } memset(&priv, 0, sizeof(priv)); + priv.erot_present = dev_caps->common_cap.external_pqc_rot_present; + + if (params->component && priv.erot_present) { + NL_SET_ERR_MSG_MOD(extack, + "eRoT adapter does not support single component update"); + err = -EOPNOTSUPP; + goto free_caps; + } if (params->component && strcmp(params->component, "fw.mgmt") == 0) { priv.context.mode = PLDMFW_UPDATE_MODE_SINGLE_COMPONENT; priv.context.component_identifier = NVM_COMP_ID_NVM; } else if (params->component) { - return -EOPNOTSUPP; + err = -EOPNOTSUPP; + goto free_caps; } /* the E822 device needs a slightly different ops */ @@ -1039,7 +1172,8 @@ int ice_devlink_flash_update(struct devlink *devlink, devlink_flash_update_status_notify(devlink, "Preparing to flash", NULL, 0, 0); - err = ice_cancel_pending_update(pf, NULL, extack); + err = ice_cancel_pending_update(pf, NULL, dev_caps, extack); + kfree(dev_caps); if (err) return err; @@ -1066,4 +1200,8 @@ int ice_devlink_flash_update(struct devlink *devlink, ice_release_nvm(hw); return err; + +free_caps: + kfree(dev_caps); + return err; } diff --git a/drivers/net/ethernet/intel/ice/ice_type.h b/drivers/net/ethernet/intel/ice/ice_type.h index 1ff69f7..0fed29d 100644 --- a/drivers/net/ethernet/intel/ice/ice_type.h +++ b/drivers/net/ethernet/intel/ice/ice_type.h @@ -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 */ -- 2.56.0