Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1253342/?format=api
{ "id": 1253342, "url": "http://patchwork.ozlabs.org/api/patches/1253342/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20200312015818.1007882-5-jacob.e.keller@intel.com/", "project": { "id": 46, "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api", "name": "Intel Wired Ethernet development", "link_name": "intel-wired-lan", "list_id": "intel-wired-lan.osuosl.org", "list_email": "intel-wired-lan@osuosl.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20200312015818.1007882-5-jacob.e.keller@intel.com>", "list_archive_url": null, "date": "2020-03-12T01:58:13", "name": "[v3,4/9] ice: discover and store size of available flash", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "8fc13d9b36eef6c727c3f2c5857d2915dfb8d16c", "submitter": { "id": 9784, "url": "http://patchwork.ozlabs.org/api/people/9784/?format=api", "name": "Jacob Keller", "email": "jacob.e.keller@intel.com" }, "delegate": { "id": 68, "url": "http://patchwork.ozlabs.org/api/users/68/?format=api", "username": "jtkirshe", "first_name": "Jeff", "last_name": "Kirsher", "email": "jeffrey.t.kirsher@intel.com" }, "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20200312015818.1007882-5-jacob.e.keller@intel.com/mbox/", "series": [ { "id": 163869, "url": "http://patchwork.ozlabs.org/api/series/163869/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=163869", "date": "2020-03-12T01:58:10", "name": "ice devlink support", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/163869/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1253342/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1253342/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<intel-wired-lan-bounces@osuosl.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Authentication-Results": [ "ozlabs.org; spf=pass (sender SPF authorized)\n\tsmtp.mailfrom=osuosl.org (client-ip=140.211.166.137;\n\thelo=fraxinus.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org;\n\tdmarc=fail (p=none dis=none) header.from=intel.com" ], "Received": [ "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 48dBnM4ZpMz9sQx\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 12 Mar 2020 12:58:31 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id D52EE86A40;\n\tThu, 12 Mar 2020 01:58:29 +0000 (UTC)", "from fraxinus.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id D-xGRB66gd3T; Thu, 12 Mar 2020 01:58:27 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id A6FCC8625E;\n\tThu, 12 Mar 2020 01:58:27 +0000 (UTC)", "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id C0C9C1BF9B9\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 12 Mar 2020 01:58:23 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id B49F08854C\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 12 Mar 2020 01:58:23 +0000 (UTC)", "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id m99pL2oh2xy7 for <intel-wired-lan@lists.osuosl.org>;\n\tThu, 12 Mar 2020 01:58:22 +0000 (UTC)", "from mga17.intel.com (mga17.intel.com [192.55.52.151])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id 8BEE488C19\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 12 Mar 2020 01:58:22 +0000 (UTC)", "from orsmga008.jf.intel.com ([10.7.209.65])\n\tby fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t11 Mar 2020 18:58:22 -0700", "from jekeller-desk.amr.corp.intel.com ([10.166.241.33])\n\tby orsmga008.jf.intel.com with ESMTP; 11 Mar 2020 18:58:21 -0700" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.70,543,1574150400\"; d=\"scan'208\";a=\"236656310\"", "From": "Jacob Keller <jacob.e.keller@intel.com>", "To": "Intel Wired LAN <intel-wired-lan@lists.osuosl.org>", "Date": "Wed, 11 Mar 2020 18:58:13 -0700", "Message-Id": "<20200312015818.1007882-5-jacob.e.keller@intel.com>", "X-Mailer": "git-send-email 2.24.1", "In-Reply-To": "<20200312015818.1007882-1-jacob.e.keller@intel.com>", "References": "<20200312015818.1007882-1-jacob.e.keller@intel.com>", "MIME-Version": "1.0", "Subject": "[Intel-wired-lan] [PATCH v3 4/9] ice: discover and store size of\n\tavailable flash", "X-BeenThere": "intel-wired-lan@osuosl.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.osuosl.org>", "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>", "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>", "List-Post": "<mailto:intel-wired-lan@osuosl.org>", "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>", "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>", "Cc": "Jakub Kicinski <kuba@kernel.org>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "intel-wired-lan-bounces@osuosl.org", "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>" }, "content": "When reading from the NVM using a flat address, it is useful to know the\nupper bound on the size of the flash contents. This value is not stored\nwithin the NVM.\n\nWe can determine the size by performing a bisection between upper and\nlower bounds. It is known that the size cannot exceed 16 MB (offset of\n0xFFFFFF).\n\nUse a while loop to bisect the upper and lower bounds by reading one\nbyte at a time. On a failed read, lower the maximum bound. On\na successful read, increase the lower bound.\n\nSave this as the flash_size in the ice_nvm_info structure that contains\ndata related to the NVM.\n\nThe size will be used in a future patch for implementing full NVM read\nvia ethtool's GEEPROM command.\n\nThe maximum possible size for the flash is bounded by the size limit for\nthe NVM AdminQ commands. Add a new macro, ICE_AQC_NVM_MAX_OFFSET, which\ncan be used to represent this upper bound.\n\nSigned-off-by: Jacob Keller <jacob.e.keller@intel.com>\nReviewed-by: Jesse Brandeburg <jesse.brandeburg@intel.com>\n---\n .../net/ethernet/intel/ice/ice_adminq_cmd.h | 2 +\n drivers/net/ethernet/intel/ice/ice_nvm.c | 62 ++++++++++++++++++-\n drivers/net/ethernet/intel/ice/ice_type.h | 1 +\n 3 files changed, 63 insertions(+), 2 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h\nindex f7d4befcf283..a1066c4bf40d 100644\n--- a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h\n+++ b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h\n@@ -1233,6 +1233,7 @@ struct ice_aqc_sff_eeprom {\n * NVM Update commands (indirect 0x0703)\n */\n struct ice_aqc_nvm {\n+#define ICE_AQC_NVM_MAX_OFFSET\t\t0xFFFFFF\n \t__le16 offset_low;\n \tu8 offset_high;\n \tu8 cmd_flags;\n@@ -1798,6 +1799,7 @@ enum ice_aq_err {\n \tICE_AQ_RC_ENOMEM\t= 9, /* Out of memory */\n \tICE_AQ_RC_EBUSY\t\t= 12, /* Device or resource busy */\n \tICE_AQ_RC_EEXIST\t= 13, /* Object already exists */\n+\tICE_AQ_RC_EINVAL\t= 14, /* Invalid argument */\n \tICE_AQ_RC_ENOSPC\t= 16, /* No space left or allocation failure */\n \tICE_AQ_RC_ENOSYS\t= 17, /* Function not implemented */\n \tICE_AQ_RC_ENOSEC\t= 24, /* Missing security manifest */\ndiff --git a/drivers/net/ethernet/intel/ice/ice_nvm.c b/drivers/net/ethernet/intel/ice/ice_nvm.c\nindex ef68fa989a57..4cdce0370963 100644\n--- a/drivers/net/ethernet/intel/ice/ice_nvm.c\n+++ b/drivers/net/ethernet/intel/ice/ice_nvm.c\n@@ -26,8 +26,7 @@ ice_aq_read_nvm(struct ice_hw *hw, u16 module_typeid, u32 offset, u16 length,\n \n \tcmd = &desc.params.nvm;\n \n-\t/* In offset the highest byte must be zeroed. */\n-\tif (offset & 0xFF000000)\n+\tif (offset > ICE_AQC_NVM_MAX_OFFSET)\n \t\treturn ICE_ERR_PARAM;\n \n \tice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_nvm_read);\n@@ -363,6 +362,58 @@ static enum ice_status ice_get_orom_ver_info(struct ice_hw *hw)\n \treturn 0;\n }\n \n+/**\n+ * ice_discover_flash_size - Discover the available flash size.\n+ * @hw: pointer to the HW struct\n+ *\n+ * The device flash could be up to 16MB in size. However, it is possible that\n+ * the actual size is smaller. Use bisection to determine the accessible size\n+ * of flash memory.\n+ */\n+static enum ice_status ice_discover_flash_size(struct ice_hw *hw)\n+{\n+\tu32 min_size = 0, max_size = ICE_AQC_NVM_MAX_OFFSET + 1;\n+\tenum ice_status status;\n+\n+\tstatus = ice_acquire_nvm(hw, ICE_RES_READ);\n+\tif (status)\n+\t\treturn status;\n+\n+\twhile ((max_size - min_size) > 1) {\n+\t\tu32 offset = (max_size + min_size) / 2;\n+\t\tu32 len = 1;\n+\t\tu8 data;\n+\n+\t\tstatus = ice_read_flat_nvm(hw, offset, &len, &data, false);\n+\t\tif (status == ICE_ERR_AQ_ERROR &&\n+\t\t hw->adminq.sq_last_status == ICE_AQ_RC_EINVAL) {\n+\t\t\tice_debug(hw, ICE_DBG_NVM,\n+\t\t\t\t \"%s: New upper bound of %u bytes\\n\",\n+\t\t\t\t __func__, offset);\n+\t\t\tstatus = 0;\n+\t\t\tmax_size = offset;\n+\t\t} else if (!status) {\n+\t\t\tice_debug(hw, ICE_DBG_NVM,\n+\t\t\t\t \"%s: New lower bound of %u bytes\\n\",\n+\t\t\t\t __func__, offset);\n+\t\t\tmin_size = offset;\n+\t\t} else {\n+\t\t\t/* an unexpected error occurred */\n+\t\t\tgoto err_read_flat_nvm;\n+\t\t}\n+\t}\n+\n+\tice_debug(hw, ICE_DBG_NVM,\n+\t\t \"Predicted flash size is %u bytes\\n\", max_size);\n+\n+\thw->nvm.flash_size = max_size;\n+\n+err_read_flat_nvm:\n+\tice_release_nvm(hw);\n+\n+\treturn status;\n+}\n+\n /**\n * ice_init_nvm - initializes NVM setting\n * @hw: pointer to the HW struct\n@@ -421,6 +472,13 @@ enum ice_status ice_init_nvm(struct ice_hw *hw)\n \n \tnvm->eetrack = (eetrack_hi << 16) | eetrack_lo;\n \n+\tstatus = ice_discover_flash_size(hw);\n+\tif (status) {\n+\t\tice_debug(hw, ICE_DBG_NVM,\n+\t\t\t \"NVM init error: failed to discover flash size.\\n\");\n+\t\treturn status;\n+\t}\n+\n \tswitch (hw->device_id) {\n \t/* the following devices do not have boot_cfg_tlv yet */\n \tcase ICE_DEV_ID_E823C_BACKPLANE:\ndiff --git a/drivers/net/ethernet/intel/ice/ice_type.h b/drivers/net/ethernet/intel/ice/ice_type.h\nindex 72591b4aca11..200aceae4323 100644\n--- a/drivers/net/ethernet/intel/ice/ice_type.h\n+++ b/drivers/net/ethernet/intel/ice/ice_type.h\n@@ -253,6 +253,7 @@ struct ice_nvm_info {\n \tstruct ice_orom_info orom;\t/* Option ROM version info */\n \tu32 eetrack;\t\t\t/* NVM data version */\n \tu16 sr_words;\t\t\t/* Shadow RAM size in words */\n+\tu32 flash_size;\t\t\t/* Size of available flash in bytes */\n \tu8 major_ver;\t\t\t/* major version of NVM package */\n \tu8 minor_ver;\t\t\t/* minor version of dev starter */\n \tu8 blank_nvm_mode; /* is NVM empty (no FW present) */\n", "prefixes": [ "v3", "4/9" ] }