ANDROID: scsi: ufs: Add more logging

The logs attached to bug 196797012 show that the error handler has been
activated and also that a SECURITY PROTOCOL OUT command is being
retried but not why. Hence this patch that adds more logging.

Notes:
- The code that initializes the completion status to
  OCS_INVALID_COMMAND_STATUS was introduced by the initial UFS commit.
  See also 7a3e97b0dc ("[SCSI] ufshcd: UFS Host controller driver").
- The behavior to retry a command if the controller did not overwrite
  the completion status was introduced by commit e8e7f27139 ("scsi:
  ufs: Improve UFS fatal error handling") without explaining why. From
  that commit:

  +       case OCS_INVALID_COMMAND_STATUS:
  +               result |= DID_REQUEUE << 16;
  +               break;

Bug: 196797012
Change-Id: I86ce4149babde1daf07af94464b878e9e697b37b
Signed-off-by: Bart Van Assche <bvanassche@google.com>
This commit is contained in:
Bart Van Assche
2021-08-16 16:16:33 -07:00
parent 62a5f8e3ac
commit d0331b15e6

View File

@@ -4015,6 +4015,9 @@ out:
if (reenable_intr)
ufshcd_enable_intr(hba, UIC_COMMAND_COMPL);
if (ret) {
dev_err(hba->dev,
"%s: Changing link power status failed (%d). Scheduling error handler\n",
__func__, ret);
ufshcd_set_link_broken(hba);
ufshcd_schedule_eh_work(hba);
}
@@ -5098,6 +5101,10 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)
result |= DID_ABORT << 16;
break;
case OCS_INVALID_COMMAND_STATUS:
dev_err_ratelimited(hba->dev,
"Retrying request with tag %d / cdb %#02x because of invalid command status\n",
lrbp->task_tag, lrbp->cmd && lrbp->cmd->cmnd ?
lrbp->cmd->cmnd[0] : 0);
result |= DID_REQUEUE << 16;
break;
case OCS_INVALID_CMD_TABLE_ATTR:
@@ -6300,8 +6307,11 @@ static irqreturn_t ufshcd_check_errors(struct ufs_hba *hba, u32 intr_status)
if (hba->errors & UIC_ERROR) {
hba->uic_error = 0;
retval = ufshcd_update_uic_error(hba);
if (hba->uic_error)
if (hba->uic_error) {
dev_err(hba->dev,
"Scheduling error handler because of an UIC error\n");
queue_eh_work = true;
}
}
if (hba->errors & UFSHCD_UIC_HIBERN8_MASK) {