From 4246d242fa1b523d7ca8901b7fe0404d1583e078 Mon Sep 17 00:00:00 2001 From: Browse Zhang Date: Tue, 12 Dec 2023 10:06:39 +0800 Subject: [PATCH] ANDROID: scsi: ufs: add perf heuristic design Added vendor hook to consider ufs host/device perf heuristic according to different platform/design Vendor/Platform can take necessary action according to their design/implementation Added vendor hook before calling UFS command ops - trace_android_vh_ufs_perf_huristic_ctrl Added vendor hook after sending UFS command to host - trace_android_vh_ufs_send_command_post_change Added vendor hook for abort success case - trace_android_vh_ufs_abort_success_ctrl Bug: 312806167 Signed-off-by: Sanjeev Yadav Signed-off-by: Browse Zhang Change-Id: Ibd07480d1086ec82f2ba6a52e21da08750796221 --- drivers/scsi/ufs/ufshcd.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index c22a4602a834..36c6646873c5 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -2105,6 +2105,7 @@ void ufshcd_send_command(struct ufs_hba *hba, unsigned int task_tag) } /* Make sure that doorbell is committed immediately */ wmb(); + trace_android_vh_ufs_send_command_post_change(hba, lrbp); } /** @@ -2770,7 +2771,9 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) } /* Make sure descriptors are ready before ringing the doorbell */ wmb(); - + trace_android_vh_ufs_perf_huristic_ctrl(hba, lrbp, &err); + if (err) + goto out; ufshcd_send_command(hba, tag); out: up_read(&hba->clk_scaling_lock); @@ -7049,8 +7052,10 @@ static int ufshcd_abort(struct scsi_cmnd *cmd) outstanding = __test_and_clear_bit(tag, &hba->outstanding_reqs); spin_unlock_irqrestore(host->host_lock, flags); - if (outstanding) + if (outstanding) { ufshcd_release_scsi_cmd(hba, lrbp); + trace_android_vh_ufs_abort_success_ctrl(hba, lrbp); + } err = SUCCESS;