Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 08b32900 authored by Can Guo's avatar Can Guo
Browse files

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: default avatarCan Guo <cang@codeaurora.org>
parent 5df03724
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -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