Commit 1e8249cc authored by Jacob Keller's avatar Jacob Keller Committed by Jakub Kicinski

ice: add additional debug logging for firmware update

While debugging a recent failure to update the flash of an ice device,
I found it helpful to add additional logging which helped determine the
root cause of the problem being a timeout issue.

Add some extra dev_dbg() logging messages which can be enabled using the
dynamic debug facility, including one for ice_aq_wait_for_event that
will use jiffies to capture a rough estimate of how long we waited for
the completion of a firmware command.
Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
Tested-by: default avatarBrijesh Behera <brijeshx.behera@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 48d40025
...@@ -283,6 +283,8 @@ ice_devlink_flash_update(struct devlink *devlink, ...@@ -283,6 +283,8 @@ ice_devlink_flash_update(struct devlink *devlink,
return err; return err;
} }
dev_dbg(dev, "Beginning flash update with file '%s'\n", params->file_name);
devlink_flash_update_begin_notify(devlink); devlink_flash_update_begin_notify(devlink);
devlink_flash_update_status_notify(devlink, "Preparing to flash", NULL, 0, 0); devlink_flash_update_status_notify(devlink, "Preparing to flash", NULL, 0, 0);
err = ice_flash_pldm_image(pf, fw, preservation, extack); err = ice_flash_pldm_image(pf, fw, preservation, extack);
......
...@@ -43,6 +43,8 @@ ice_send_package_data(struct pldmfw *context, const u8 *data, u16 length) ...@@ -43,6 +43,8 @@ ice_send_package_data(struct pldmfw *context, const u8 *data, u16 length)
enum ice_status status; enum ice_status status;
u8 *package_data; u8 *package_data;
dev_dbg(dev, "Sending PLDM record package data to firmware\n");
package_data = kmemdup(data, length, GFP_KERNEL); package_data = kmemdup(data, length, GFP_KERNEL);
if (!package_data) if (!package_data)
return -ENOMEM; return -ENOMEM;
...@@ -229,6 +231,8 @@ ice_send_component_table(struct pldmfw *context, struct pldmfw_component *compon ...@@ -229,6 +231,8 @@ ice_send_component_table(struct pldmfw *context, struct pldmfw_component *compon
comp_tbl->cvs_len = component->version_len; comp_tbl->cvs_len = component->version_len;
memcpy(comp_tbl->cvs, component->version_string, component->version_len); memcpy(comp_tbl->cvs, component->version_string, component->version_len);
dev_dbg(dev, "Sending component table to firmware:\n");
status = ice_nvm_pass_component_tbl(hw, (u8 *)comp_tbl, length, status = ice_nvm_pass_component_tbl(hw, (u8 *)comp_tbl, length,
transfer_flag, &comp_response, transfer_flag, &comp_response,
&comp_response_code, NULL); &comp_response_code, NULL);
...@@ -279,11 +283,14 @@ ice_write_one_nvm_block(struct ice_pf *pf, u16 module, u32 offset, ...@@ -279,11 +283,14 @@ ice_write_one_nvm_block(struct ice_pf *pf, u16 module, u32 offset,
memset(&event, 0, sizeof(event)); memset(&event, 0, sizeof(event));
dev_dbg(dev, "Writing block of %u bytes for module 0x%02x at offset %u\n",
block_size, module, offset);
status = ice_aq_update_nvm(hw, module, offset, block_size, block, status = ice_aq_update_nvm(hw, module, offset, block_size, block,
last_cmd, 0, NULL); last_cmd, 0, NULL);
if (status) { if (status) {
dev_err(dev, "Failed to program flash module 0x%02x at offset %u, err %s aq_err %s\n", dev_err(dev, "Failed to flash module 0x%02x with block of size %u at offset %u, err %s aq_err %s\n",
module, offset, ice_stat_str(status), module, block_size, offset, ice_stat_str(status),
ice_aq_str(hw->adminq.sq_last_status)); ice_aq_str(hw->adminq.sq_last_status));
NL_SET_ERR_MSG_MOD(extack, "Failed to program flash module"); NL_SET_ERR_MSG_MOD(extack, "Failed to program flash module");
return -EIO; return -EIO;
...@@ -297,8 +304,8 @@ ice_write_one_nvm_block(struct ice_pf *pf, u16 module, u32 offset, ...@@ -297,8 +304,8 @@ ice_write_one_nvm_block(struct ice_pf *pf, u16 module, u32 offset,
*/ */
err = ice_aq_wait_for_event(pf, ice_aqc_opc_nvm_write, 15 * HZ, &event); err = ice_aq_wait_for_event(pf, ice_aqc_opc_nvm_write, 15 * HZ, &event);
if (err) { if (err) {
dev_err(dev, "Timed out waiting for firmware write completion for module 0x%02x, err %d\n", dev_err(dev, "Timed out while trying to flash module 0x%02x with block of size %u at offset %u, err %d\n",
module, err); module, block_size, offset, err);
NL_SET_ERR_MSG_MOD(extack, "Timed out waiting for firmware"); NL_SET_ERR_MSG_MOD(extack, "Timed out waiting for firmware");
return -EIO; return -EIO;
} }
...@@ -324,8 +331,8 @@ ice_write_one_nvm_block(struct ice_pf *pf, u16 module, u32 offset, ...@@ -324,8 +331,8 @@ ice_write_one_nvm_block(struct ice_pf *pf, u16 module, u32 offset,
} }
if (completion_retval) { if (completion_retval) {
dev_err(dev, "Firmware failed to program flash module 0x%02x at offset %u, completion err %s\n", dev_err(dev, "Firmware failed to flash module 0x%02x with block of size %u at offset %u, err %s\n",
module, offset, module, block_size, offset,
ice_aq_str((enum ice_aq_err)completion_retval)); ice_aq_str((enum ice_aq_err)completion_retval));
NL_SET_ERR_MSG_MOD(extack, "Firmware failed to program flash module"); NL_SET_ERR_MSG_MOD(extack, "Firmware failed to program flash module");
return -EIO; return -EIO;
...@@ -356,12 +363,15 @@ ice_write_nvm_module(struct ice_pf *pf, u16 module, const char *component, ...@@ -356,12 +363,15 @@ ice_write_nvm_module(struct ice_pf *pf, u16 module, const char *component,
const u8 *image, u32 length, const u8 *image, u32 length,
struct netlink_ext_ack *extack) struct netlink_ext_ack *extack)
{ {
struct device *dev = ice_pf_to_dev(pf);
struct devlink *devlink; struct devlink *devlink;
u32 offset = 0; u32 offset = 0;
bool last_cmd; bool last_cmd;
u8 *block; u8 *block;
int err; int err;
dev_dbg(dev, "Beginning write of flash component '%s', module 0x%02x\n", component, module);
devlink = priv_to_devlink(pf); devlink = priv_to_devlink(pf);
devlink_flash_update_status_notify(devlink, "Flashing", devlink_flash_update_status_notify(devlink, "Flashing",
...@@ -394,6 +404,8 @@ ice_write_nvm_module(struct ice_pf *pf, u16 module, const char *component, ...@@ -394,6 +404,8 @@ ice_write_nvm_module(struct ice_pf *pf, u16 module, const char *component,
component, offset, length); component, offset, length);
} while (!last_cmd); } while (!last_cmd);
dev_dbg(dev, "Completed write of flash component '%s', module 0x%02x\n", component, module);
if (err) if (err)
devlink_flash_update_status_notify(devlink, "Flashing failed", devlink_flash_update_status_notify(devlink, "Flashing failed",
component, length, length); component, length, length);
...@@ -431,6 +443,8 @@ ice_erase_nvm_module(struct ice_pf *pf, u16 module, const char *component, ...@@ -431,6 +443,8 @@ ice_erase_nvm_module(struct ice_pf *pf, u16 module, const char *component,
enum ice_status status; enum ice_status status;
int err; int err;
dev_dbg(dev, "Beginning erase of flash component '%s', module 0x%02x\n", component, module);
memset(&event, 0, sizeof(event)); memset(&event, 0, sizeof(event));
devlink = priv_to_devlink(pf); devlink = priv_to_devlink(pf);
...@@ -476,6 +490,8 @@ ice_erase_nvm_module(struct ice_pf *pf, u16 module, const char *component, ...@@ -476,6 +490,8 @@ ice_erase_nvm_module(struct ice_pf *pf, u16 module, const char *component,
goto out_notify_devlink; goto out_notify_devlink;
} }
dev_dbg(dev, "Completed erase of flash component '%s', module 0x%02x\n", component, module);
out_notify_devlink: out_notify_devlink:
if (err) if (err)
devlink_flash_update_status_notify(devlink, "Erasing failed", devlink_flash_update_status_notify(devlink, "Erasing failed",
......
...@@ -1056,7 +1056,9 @@ struct ice_aq_task { ...@@ -1056,7 +1056,9 @@ struct ice_aq_task {
int ice_aq_wait_for_event(struct ice_pf *pf, u16 opcode, unsigned long timeout, int ice_aq_wait_for_event(struct ice_pf *pf, u16 opcode, unsigned long timeout,
struct ice_rq_event_info *event) struct ice_rq_event_info *event)
{ {
struct device *dev = ice_pf_to_dev(pf);
struct ice_aq_task *task; struct ice_aq_task *task;
unsigned long start;
long ret; long ret;
int err; int err;
...@@ -1073,6 +1075,8 @@ int ice_aq_wait_for_event(struct ice_pf *pf, u16 opcode, unsigned long timeout, ...@@ -1073,6 +1075,8 @@ int ice_aq_wait_for_event(struct ice_pf *pf, u16 opcode, unsigned long timeout,
hlist_add_head(&task->entry, &pf->aq_wait_list); hlist_add_head(&task->entry, &pf->aq_wait_list);
spin_unlock_bh(&pf->aq_wait_lock); spin_unlock_bh(&pf->aq_wait_lock);
start = jiffies;
ret = wait_event_interruptible_timeout(pf->aq_wait_queue, task->state, ret = wait_event_interruptible_timeout(pf->aq_wait_queue, task->state,
timeout); timeout);
switch (task->state) { switch (task->state) {
...@@ -1091,6 +1095,11 @@ int ice_aq_wait_for_event(struct ice_pf *pf, u16 opcode, unsigned long timeout, ...@@ -1091,6 +1095,11 @@ int ice_aq_wait_for_event(struct ice_pf *pf, u16 opcode, unsigned long timeout,
break; break;
} }
dev_dbg(dev, "Waited %u msecs (max %u msecs) for firmware response to op 0x%04x\n",
jiffies_to_msecs(jiffies - start),
jiffies_to_msecs(timeout),
opcode);
spin_lock_bh(&pf->aq_wait_lock); spin_lock_bh(&pf->aq_wait_lock);
hlist_del(&task->entry); hlist_del(&task->entry);
spin_unlock_bh(&pf->aq_wait_lock); spin_unlock_bh(&pf->aq_wait_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment