From 4e98107b8cd5ca44fc2cb45a8ee564200bc8300f Mon Sep 17 00:00:00 2001 From: Jaegeuk Kim Date: Mon, 1 Mar 2021 17:21:30 -0800 Subject: [PATCH] ANDROID: scsi: ufs: add hooks to track ufs commands This adds some missing hooks for ufs commands, including request, query, uic, task manager commands, and interrupt events for vendor. Those can be used for vendor module to understand command history. Bug: 172305874 Bug: 176940922 Signed-off-by: Jaegeuk Kim Change-Id: Ie447860290f4fbc1e03ad8ae5f50bd02121756cb --- drivers/android/vendor_hooks.c | 3 +++ drivers/scsi/ufs/ufshcd.c | 6 ++++++ include/trace/hooks/ufshcd.h | 14 ++++++++++++++ 3 files changed, 23 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index ac5b8d8e7b7e..619aa17a3873 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -165,6 +165,9 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_prepare_command); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_update_sysfs); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_send_command); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_compl_command); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_send_uic_command); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_send_tm_command); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_check_int_errors); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_do_wake_up_sync); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_set_wake_flags); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_uclamp_eff_value); diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index ba595f606768..27748aeb87cf 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -326,6 +326,7 @@ static void ufshcd_add_tm_upiu_trace(struct ufs_hba *hba, unsigned int tag, int off = (int)tag - hba->nutrs; struct utp_task_req_desc *descp = &hba->utmrdl_base_addr[off]; + trace_android_vh_ufs_send_tm_command(hba, tag, str); trace_ufshcd_upiu(dev_name(hba->dev), str, &descp->req_header, &descp->input_param1); } @@ -336,6 +337,8 @@ static void ufshcd_add_uic_command_trace(struct ufs_hba *hba, { u32 cmd; + trace_android_vh_ufs_send_uic_command(hba, ucmd, str); + if (!trace_ufshcd_uic_command_enabled()) return; @@ -5044,6 +5047,7 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba *hba, } else if (lrbp->command_type == UTP_CMD_TYPE_DEV_MANAGE || lrbp->command_type == UTP_CMD_TYPE_UFS_STORAGE) { if (hba->dev_cmd.complete) { + trace_android_vh_ufs_compl_command(hba, lrbp); ufshcd_add_command_trace(hba, index, "dev_complete"); complete(hba->dev_cmd.complete); @@ -6132,6 +6136,8 @@ static irqreturn_t ufshcd_check_errors(struct ufs_hba *hba) queue_eh_work = true; } + trace_android_vh_ufs_check_int_errors(hba, queue_eh_work); + if (queue_eh_work) { /* * update the transfer error masks to sticky bits, let's do this diff --git a/include/trace/hooks/ufshcd.h b/include/trace/hooks/ufshcd.h index c22e5d37a962..e2b755271457 100644 --- a/include/trace/hooks/ufshcd.h +++ b/include/trace/hooks/ufshcd.h @@ -36,6 +36,20 @@ DECLARE_HOOK(android_vh_ufs_compl_command, TP_PROTO(struct ufs_hba *hba, struct ufshcd_lrb *lrbp), TP_ARGS(hba, lrbp)); +struct uic_command; +DECLARE_HOOK(android_vh_ufs_send_uic_command, + TP_PROTO(struct ufs_hba *hba, struct uic_command *ucmd, + const char *str), + TP_ARGS(hba, ucmd, str)); + +DECLARE_HOOK(android_vh_ufs_send_tm_command, + TP_PROTO(struct ufs_hba *hba, int tag, const char *str), + TP_ARGS(hba, tag, str)); + +DECLARE_HOOK(android_vh_ufs_check_int_errors, + TP_PROTO(struct ufs_hba *hba, bool queue_eh_work), + TP_ARGS(hba, queue_eh_work)); + #endif /* _TRACE_HOOK_UFSHCD_H */ /* This part must be outside protection */ #include