From 08b32900ae52ff69b74c1e69641ece51304951f0 Mon Sep 17 00:00:00 2001 From: Can Guo Date: Thu, 18 Jun 2020 11:59:11 +0800 Subject: [PATCH] scsi: ufs: Record last intr status and its timestamp Record the status and timestamp of the last interrupt and print them along with host states, which is helpful for debugging purposes. Change-Id: I2f9946b07ec64fb68516e905f19800c71964536e Signed-off-by: Can Guo --- drivers/scsi/ufs/ufshcd.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index c1fa7bc43ce8..252e02270361 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -521,6 +521,11 @@ static void ufshcd_print_host_state(struct ufs_hba *hba) dev_err(hba->dev, "UFS Host state=%d\n", hba->ufshcd_state); dev_err(hba->dev, "lrb in use=0x%lx, outstanding reqs=0x%lx tasks=0x%lx\n", hba->lrb_in_use, hba->outstanding_reqs, hba->outstanding_tasks); +#if defined(CONFIG_SCSI_UFSHCD_QTI) + dev_err(hba->dev, "last intr ts=%lld, last intr status=0x%x\n", + ktime_to_us(hba->ufs_stats.last_intr_ts), + hba->ufs_stats.last_intr_status); +#endif dev_err(hba->dev, "saved_err=0x%x, saved_uic_err=0x%x\n", hba->saved_err, hba->saved_uic_err); dev_err(hba->dev, "Device power mode=%d, UIC link state=%d\n", @@ -6099,6 +6104,10 @@ static irqreturn_t ufshcd_intr(int irq, void *__hba) spin_lock(hba->host->host_lock); intr_status = ufshcd_readl(hba, REG_INTERRUPT_STATUS); +#if defined(CONFIG_SCSI_UFSHCD_QTI) + hba->ufs_stats.last_intr_status = intr_status; + hba->ufs_stats.last_intr_ts = ktime_get(); +#endif /* * There could be max of hba->nutrs reqs in flight and in worst case