|
21 | 21 | #include <linux/interrupt.h>
|
22 | 22 | #include <linux/module.h>
|
23 | 23 | #include <linux/regulator/consumer.h>
|
| 24 | +#include <linux/sched/clock.h> |
24 | 25 | #include <scsi/scsi_cmnd.h>
|
25 | 26 | #include <scsi/scsi_dbg.h>
|
26 | 27 | #include <scsi/scsi_driver.h>
|
@@ -457,7 +458,7 @@ static void ufshcd_print_evt(struct ufs_hba *hba, u32 id,
|
457 | 458 | if (e->tstamp[p] == 0)
|
458 | 459 | continue;
|
459 | 460 | dev_err(hba->dev, "%s[%d] = 0x%x at %lld us\n", err_name, p,
|
460 |
| - e->val[p], ktime_to_us(e->tstamp[p])); |
| 461 | + e->val[p], div_u64(e->tstamp[p], 1000)); |
461 | 462 | found = true;
|
462 | 463 | }
|
463 | 464 |
|
@@ -502,9 +503,9 @@ void ufshcd_print_trs(struct ufs_hba *hba, unsigned long bitmap, bool pr_prdt)
|
502 | 503 | lrbp = &hba->lrb[tag];
|
503 | 504 |
|
504 | 505 | dev_err(hba->dev, "UPIU[%d] - issue time %lld us\n",
|
505 |
| - tag, ktime_to_us(lrbp->issue_time_stamp)); |
| 506 | + tag, div_u64(lrbp->issue_time_stamp_local_clock, 1000)); |
506 | 507 | dev_err(hba->dev, "UPIU[%d] - complete time %lld us\n",
|
507 |
| - tag, ktime_to_us(lrbp->compl_time_stamp)); |
| 508 | + tag, div_u64(lrbp->compl_time_stamp_local_clock, 1000)); |
508 | 509 | dev_err(hba->dev,
|
509 | 510 | "UPIU[%d] - Transfer Request Descriptor phys@0x%llx\n",
|
510 | 511 | tag, (u64)lrbp->utrd_dma_addr);
|
@@ -566,10 +567,10 @@ static void ufshcd_print_host_state(struct ufs_hba *hba)
|
566 | 567 | dev_err(hba->dev, "Clk gate=%d\n", hba->clk_gating.state);
|
567 | 568 | dev_err(hba->dev,
|
568 | 569 | "last_hibern8_exit_tstamp at %lld us, hibern8_exit_cnt=%d\n",
|
569 |
| - ktime_to_us(hba->ufs_stats.last_hibern8_exit_tstamp), |
| 570 | + div_u64(hba->ufs_stats.last_hibern8_exit_tstamp, 1000), |
570 | 571 | hba->ufs_stats.hibern8_exit_cnt);
|
571 | 572 | dev_err(hba->dev, "last intr at %lld us, last intr status=0x%x\n",
|
572 |
| - ktime_to_us(hba->ufs_stats.last_intr_ts), |
| 573 | + div_u64(hba->ufs_stats.last_intr_ts, 1000), |
573 | 574 | hba->ufs_stats.last_intr_status);
|
574 | 575 | dev_err(hba->dev, "error handling flags=0x%x, req. abort count=%d\n",
|
575 | 576 | hba->eh_flags, hba->req_abort_count);
|
@@ -2140,7 +2141,9 @@ void ufshcd_send_command(struct ufs_hba *hba, unsigned int task_tag)
|
2140 | 2141 | unsigned long flags;
|
2141 | 2142 |
|
2142 | 2143 | lrbp->issue_time_stamp = ktime_get();
|
| 2144 | + lrbp->issue_time_stamp_local_clock = local_clock(); |
2143 | 2145 | lrbp->compl_time_stamp = ktime_set(0, 0);
|
| 2146 | + lrbp->compl_time_stamp_local_clock = 0; |
2144 | 2147 | ufshcd_add_command_trace(hba, task_tag, UFS_CMD_SEND);
|
2145 | 2148 | ufshcd_clk_scaling_start_busy(hba);
|
2146 | 2149 | if (unlikely(ufshcd_should_inform_monitor(hba, lrbp)))
|
@@ -4222,7 +4225,7 @@ int ufshcd_uic_hibern8_exit(struct ufs_hba *hba)
|
4222 | 4225 | } else {
|
4223 | 4226 | ufshcd_vops_hibern8_notify(hba, UIC_CMD_DME_HIBER_EXIT,
|
4224 | 4227 | POST_CHANGE);
|
4225 |
| - hba->ufs_stats.last_hibern8_exit_tstamp = ktime_get(); |
| 4228 | + hba->ufs_stats.last_hibern8_exit_tstamp = local_clock(); |
4226 | 4229 | hba->ufs_stats.hibern8_exit_cnt++;
|
4227 | 4230 | }
|
4228 | 4231 |
|
@@ -4724,7 +4727,7 @@ void ufshcd_update_evt_hist(struct ufs_hba *hba, u32 id, u32 val)
|
4724 | 4727 |
|
4725 | 4728 | e = &hba->ufs_stats.event[id];
|
4726 | 4729 | e->val[e->pos] = val;
|
4727 |
| - e->tstamp[e->pos] = ktime_get(); |
| 4730 | + e->tstamp[e->pos] = local_clock(); |
4728 | 4731 | e->cnt += 1;
|
4729 | 4732 | e->pos = (e->pos + 1) % UFS_EVENT_HIST_LENGTH;
|
4730 | 4733 |
|
@@ -5357,6 +5360,7 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba *hba,
|
5357 | 5360 | for_each_set_bit(index, &completed_reqs, hba->nutrs) {
|
5358 | 5361 | lrbp = &hba->lrb[index];
|
5359 | 5362 | lrbp->compl_time_stamp = ktime_get();
|
| 5363 | + lrbp->compl_time_stamp_local_clock = local_clock(); |
5360 | 5364 | cmd = lrbp->cmd;
|
5361 | 5365 | if (cmd) {
|
5362 | 5366 | if (unlikely(ufshcd_should_inform_monitor(hba, lrbp)))
|
@@ -6645,7 +6649,7 @@ static irqreturn_t ufshcd_intr(int irq, void *__hba)
|
6645 | 6649 |
|
6646 | 6650 | intr_status = ufshcd_readl(hba, REG_INTERRUPT_STATUS);
|
6647 | 6651 | hba->ufs_stats.last_intr_status = intr_status;
|
6648 |
| - hba->ufs_stats.last_intr_ts = ktime_get(); |
| 6652 | + hba->ufs_stats.last_intr_ts = local_clock(); |
6649 | 6653 |
|
6650 | 6654 | /*
|
6651 | 6655 | * There could be max of hba->nutrs reqs in flight and in worst case
|
|
0 commit comments