From patchwork Mon Oct 5 22:36:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaegeuk Kim X-Patchwork-Id: 11817829 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D8B076CB for ; Mon, 5 Oct 2020 22:36:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BF21320796 for ; Mon, 5 Oct 2020 22:36:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601937404; bh=TKL2MsscyE/vIAfUltMtJXP6uFHSkqzpM4DPoVgZ1Tw=; h=From:To:Cc:Subject:Date:List-ID:From; b=QIhurMufHodT57FjuvCsX+fmXbA9W1PBLisJSHPyPExcYkT5RlT9i0u+DY+Xh1+9O aWAJ9G3moAbc0dAYGTFtDpBJKjM4H7Fcb+hxEdxnkEl8TQFdsDJMl7J5FBIEW0cuXZ zaE+SkNITq9V33PKTfPyC227r0M4hpM6NROMOwns= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726604AbgJEWgh (ORCPT ); Mon, 5 Oct 2020 18:36:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:56780 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725917AbgJEWgh (ORCPT ); Mon, 5 Oct 2020 18:36:37 -0400 Received: from localhost (unknown [104.132.1.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2D02B2078A; Mon, 5 Oct 2020 22:36:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601937397; bh=TKL2MsscyE/vIAfUltMtJXP6uFHSkqzpM4DPoVgZ1Tw=; h=From:To:Cc:Subject:Date:From; b=zDlMHnRqW36LuoFxud7eaHvZumJlikFASkuU8WD3CCiGHGy2eNkDGzi9gV9xYQLVN BL0e8uFjmLNklLV5OkcXVhp6Gz6Cj6YSZbLzFldclDzBYe78vrrjjTzrxmIGBmlgsY 35XeRlJ84TbKfygbL7ovaaXZfSuiPnxmfHqHXagI= From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, kernel-team@android.com Cc: Jaegeuk Kim , Alim Akhtar , Avri Altman , Can Guo Subject: [PATCH 1/4] scsi: ufs: atomic update for clkgating_enable Date: Mon, 5 Oct 2020 15:36:32 -0700 Message-Id: <20201005223635.2922805-1-jaegeuk@kernel.org> X-Mailer: git-send-email 2.28.0.806.g8561365e88-goog MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Jaegeuk Kim When giving a stress test which enables/disables clkgating, we hit device timeout sometimes. This patch avoids subtle racy condition to address it. Cc: Alim Akhtar Cc: Avri Altman Cc: Can Guo Signed-off-by: Jaegeuk Kim --- drivers/scsi/ufs/ufshcd.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 1d157ff58d817..d929c3d1e58cc 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -1791,19 +1791,19 @@ static ssize_t ufshcd_clkgate_enable_store(struct device *dev, return -EINVAL; value = !!value; + + spin_lock_irqsave(hba->host->host_lock, flags); if (value == hba->clk_gating.is_enabled) goto out; - if (value) { - ufshcd_release(hba); - } else { - spin_lock_irqsave(hba->host->host_lock, flags); + if (value) + hba->clk_gating.active_reqs--; + else hba->clk_gating.active_reqs++; - spin_unlock_irqrestore(hba->host->host_lock, flags); - } hba->clk_gating.is_enabled = value; out: + spin_unlock_irqrestore(hba->host->host_lock, flags); return count; } From patchwork Mon Oct 5 22:36:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaegeuk Kim X-Patchwork-Id: 11817827 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 49B4E14F7 for ; Mon, 5 Oct 2020 22:36:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 22C882078A for ; Mon, 5 Oct 2020 22:36:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601937400; bh=wrNpq8pVgnumeZyDyaHsD4y/rLz7x2TT8jbfts6O5NU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Yq11LAb9Hp2R4U05NKR/+4bl360NuMgp7Lq+8OzHB8MD3Ef32010kWZl5FXfId8t1 Zt8x3N2tdtbj3EAbaknd14SLTg0j3tB15fMP9E0DUL3FmlOYw3hqiW38m6PGMcU3wW F6myT4irOjygANbvAP44GcVtVbTHogXyzrDT5yaA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727242AbgJEWgj (ORCPT ); Mon, 5 Oct 2020 18:36:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:56810 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725917AbgJEWgi (ORCPT ); Mon, 5 Oct 2020 18:36:38 -0400 Received: from localhost (unknown [104.132.1.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C2A2E2078D; Mon, 5 Oct 2020 22:36:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601937397; bh=wrNpq8pVgnumeZyDyaHsD4y/rLz7x2TT8jbfts6O5NU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OCu4SgVLxaexohyschbau50zhjLgV6fGFvgFYuJ2Dshn6cLZkept7nlVARZ3jQosE 36rca30UJRfJ79UccAwg9lnlhGzkilbrQLMmJ2kbZ90rCNoW4ROR2NTwF6we4w6s9r dzYe1OJYABMJJCUUs5tfGhaXuXc1hOV5dGIAv6/k= From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, kernel-team@android.com Cc: Jaegeuk Kim , Alim Akhtar , Avri Altman , Can Guo Subject: [PATCH 2/4] scsi: ufs: clear UAC for FFU and RPMB LUNs Date: Mon, 5 Oct 2020 15:36:33 -0700 Message-Id: <20201005223635.2922805-2-jaegeuk@kernel.org> X-Mailer: git-send-email 2.28.0.806.g8561365e88-goog In-Reply-To: <20201005223635.2922805-1-jaegeuk@kernel.org> References: <20201005223635.2922805-1-jaegeuk@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Jaegeuk Kim In order to conduct FFU or RPMB operations, UFS needs to clear UAC. This patch clears it explicitly, so that we could get no failure given early execution. Cc: Alim Akhtar Cc: Avri Altman Cc: Can Guo Signed-off-by: Jaegeuk Kim --- drivers/scsi/ufs/ufshcd.c | 70 +++++++++++++++++++++++++++++++++++---- drivers/scsi/ufs/ufshcd.h | 1 + 2 files changed, 65 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index d929c3d1e58cc..0bb07b50bd23e 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -6841,7 +6841,6 @@ static inline void ufshcd_blk_pm_runtime_init(struct scsi_device *sdev) static int ufshcd_scsi_add_wlus(struct ufs_hba *hba) { int ret = 0; - struct scsi_device *sdev_rpmb; struct scsi_device *sdev_boot; hba->sdev_ufs_device = __scsi_add_device(hba->host, 0, 0, @@ -6854,14 +6853,14 @@ static int ufshcd_scsi_add_wlus(struct ufs_hba *hba) ufshcd_blk_pm_runtime_init(hba->sdev_ufs_device); scsi_device_put(hba->sdev_ufs_device); - sdev_rpmb = __scsi_add_device(hba->host, 0, 0, + hba->sdev_rpmb = __scsi_add_device(hba->host, 0, 0, ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_RPMB_WLUN), NULL); - if (IS_ERR(sdev_rpmb)) { - ret = PTR_ERR(sdev_rpmb); + if (IS_ERR(hba->sdev_rpmb)) { + ret = PTR_ERR(hba->sdev_rpmb); goto remove_sdev_ufs_device; } - ufshcd_blk_pm_runtime_init(sdev_rpmb); - scsi_device_put(sdev_rpmb); + ufshcd_blk_pm_runtime_init(hba->sdev_rpmb); + scsi_device_put(hba->sdev_rpmb); sdev_boot = __scsi_add_device(hba->host, 0, 0, ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_BOOT_WLUN), NULL); @@ -7385,6 +7384,63 @@ static int ufshcd_add_lus(struct ufs_hba *hba) return ret; } +static int +ufshcd_send_request_sense(struct ufs_hba *hba, struct scsi_device *sdp); + +static int ufshcd_clear_ua_wlun(struct ufs_hba *hba, u8 wlun) +{ + struct scsi_device *sdp; + unsigned long flags; + int ret = 0; + + spin_lock_irqsave(hba->host->host_lock, flags); + if (wlun == UFS_UPIU_UFS_DEVICE_WLUN) + sdp = hba->sdev_ufs_device; + else if (wlun == UFS_UPIU_RPMB_WLUN) + sdp = hba->sdev_rpmb; + else + BUG_ON(1); + if (sdp) { + ret = scsi_device_get(sdp); + if (!ret && !scsi_device_online(sdp)) { + ret = -ENODEV; + scsi_device_put(sdp); + } + } else { + ret = -ENODEV; + } + spin_unlock_irqrestore(hba->host->host_lock, flags); + if (ret) + goto out_err; + + ret = ufshcd_send_request_sense(hba, sdp); + scsi_device_put(sdp); +out_err: + if (ret) + dev_err(hba->dev, "%s: UAC clear LU=%x ret = %d\n", + __func__, wlun, ret); + return ret; +} + +static int ufshcd_clear_ua_wluns(struct ufs_hba *hba) +{ + int ret = 0; + + if (!hba->wlun_dev_clr_ua) + goto out; + + ret = ufshcd_clear_ua_wlun(hba, UFS_UPIU_UFS_DEVICE_WLUN); + if (!ret) + ret = ufshcd_clear_ua_wlun(hba, UFS_UPIU_RPMB_WLUN); + if (!ret) + hba->wlun_dev_clr_ua = false; +out: + if (ret) + dev_err(hba->dev, "%s: Failed to clear UAC WLUNS ret = %d\n", + __func__, ret); + return ret; +} + /** * ufshcd_probe_hba - probe hba to detect device and initialize * @hba: per-adapter instance @@ -7500,6 +7556,8 @@ static void ufshcd_async_scan(void *data, async_cookie_t cookie) pm_runtime_put_sync(hba->dev); ufshcd_exit_clk_scaling(hba); ufshcd_hba_exit(hba); + } else { + ufshcd_clear_ua_wluns(hba); } } diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 363589c0bd370..8344d8cb36786 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -662,6 +662,7 @@ struct ufs_hba { * "UFS device" W-LU. */ struct scsi_device *sdev_ufs_device; + struct scsi_device *sdev_rpmb; enum ufs_dev_pwr_mode curr_dev_pwr_mode; enum uic_link_state uic_link_state; From patchwork Mon Oct 5 22:36:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaegeuk Kim X-Patchwork-Id: 11817831 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 865796CB for ; Mon, 5 Oct 2020 22:36:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 62F3E2078D for ; Mon, 5 Oct 2020 22:36:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601937412; bh=RhyUsFh8Oj9BZ0Tkwf+g+61O5+QJ5rAXX1sFTcNEPoI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=rKe9cajKQ1GPWanYOKK0d/OMDpf1qV47D6X6MBFGIyjv1t198fBmsF5Auw2KPIaKn FCKcJJBBcE313teIlWRS5YLfPYqiABXmY8NZvq+YAJ8/Xihb0ikwA+MeOL8f7kBaDh SAnV2WUF9gNyRH6szQmGCuPr3KzPBUlinQCGDywc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727267AbgJEWgr (ORCPT ); Mon, 5 Oct 2020 18:36:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:56836 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727229AbgJEWgi (ORCPT ); Mon, 5 Oct 2020 18:36:38 -0400 Received: from localhost (unknown [104.132.1.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 56D222078E; Mon, 5 Oct 2020 22:36:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601937398; bh=RhyUsFh8Oj9BZ0Tkwf+g+61O5+QJ5rAXX1sFTcNEPoI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JXLRaiau8dvduWBufMNInMtGOYX20vfAyVRI3y6828LZzejy07o5Asr8vxC5wFDsZ bKG+dJsOrCViSxvY+obWAbriDUbF/Mxdv6Vl2LvtN5IaARIeGTO7wCjLz9GROPc8hd 7LKWHR2c64LLsj497TCm4yuHIJ37WpeiXCpHB410= From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, kernel-team@android.com Cc: Jaegeuk Kim , Alim Akhtar , Avri Altman , Can Guo Subject: [PATCH 3/4] scsi: ufs: use WQ_HIGHPRI for gating work Date: Mon, 5 Oct 2020 15:36:34 -0700 Message-Id: <20201005223635.2922805-3-jaegeuk@kernel.org> X-Mailer: git-send-email 2.28.0.806.g8561365e88-goog In-Reply-To: <20201005223635.2922805-1-jaegeuk@kernel.org> References: <20201005223635.2922805-1-jaegeuk@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Jaegeuk Kim Must have WQ_MEM_RECLAIM ``WQ_MEM_RECLAIM`` All wq which might be used in the memory reclaim paths **MUST** have this flag set. The wq is guaranteed to have at least one execution context regardless of memory pressure. Cc: Alim Akhtar Cc: Avri Altman Cc: Can Guo Signed-off-by: Jaegeuk Kim --- drivers/scsi/ufs/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 0bb07b50bd23e..76e95963887be 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -1849,7 +1849,7 @@ static void ufshcd_init_clk_gating(struct ufs_hba *hba) snprintf(wq_name, ARRAY_SIZE(wq_name), "ufs_clk_gating_%d", hba->host->host_no); hba->clk_gating.clk_gating_workq = alloc_ordered_workqueue(wq_name, - WQ_MEM_RECLAIM); + WQ_MEM_RECLAIM | WQ_HIGHPRI); hba->clk_gating.is_enabled = true; From patchwork Mon Oct 5 22:36:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaegeuk Kim X-Patchwork-Id: 11817833 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8F0331580 for ; Mon, 5 Oct 2020 22:36:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 764372078A for ; Mon, 5 Oct 2020 22:36:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601937414; bh=ZRuyMjp9wz1iG6fGEuH6XzoocLRcpd168LySoq6lbao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=0YBE3WdOCtBQAjGQU5s/gULOxjB0HOTvdEwMUVslVygwxExoxwVEjn5GfzeIWcbu7 d9w1VTykPIhoueL9pa3p+pp++c5bsbQ1OkMppNgBgX8Kdt+oExerUWK9/EY7WMtu0b yfAjhn7uS6R0juRBKm0dQb7HntUt6mK8HVtdkpjg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727260AbgJEWgr (ORCPT ); Mon, 5 Oct 2020 18:36:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:56870 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727234AbgJEWgj (ORCPT ); Mon, 5 Oct 2020 18:36:39 -0400 Received: from localhost (unknown [104.132.1.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E148520791; Mon, 5 Oct 2020 22:36:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601937399; bh=ZRuyMjp9wz1iG6fGEuH6XzoocLRcpd168LySoq6lbao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PLAzJdsIuXh0Z5EjuriB0MGkhdzQZFakw20A1AT0uWZI9GV4LLBbyjmGcFZi+phuQ fxqqI6pbpprQUNwgMWVRwQBlDwfrLi/QdxR4WiFN0Ec8sxMZL2Nvz6LLP+jHEwSbRp 3NB+JK+qoB3EsWse/lCKj+XfHOY2p+YG3G5mCauI= From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, kernel-team@android.com Cc: Jaegeuk Kim , Alim Akhtar , Avri Altman , Can Guo Subject: [PATCH 4/4] scsi: add more contexts in the ufs tracepoints Date: Mon, 5 Oct 2020 15:36:35 -0700 Message-Id: <20201005223635.2922805-4-jaegeuk@kernel.org> X-Mailer: git-send-email 2.28.0.806.g8561365e88-goog In-Reply-To: <20201005223635.2922805-1-jaegeuk@kernel.org> References: <20201005223635.2922805-1-jaegeuk@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Jaegeuk Kim This adds user-friendly tracepoints with group id. Cc: Alim Akhtar Cc: Avri Altman Cc: Can Guo Signed-off-by: Jaegeuk Kim Reviewed-by: Can Guo --- drivers/scsi/ufs/ufshcd.c | 6 ++++-- include/trace/events/ufs.h | 21 +++++++++++++++++---- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 76e95963887be..a2db8182663da 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -336,7 +336,7 @@ static void ufshcd_add_command_trace(struct ufs_hba *hba, unsigned int tag, const char *str) { sector_t lba = -1; - u8 opcode = 0; + u8 opcode = 0, group_id = 0; u32 intr, doorbell; struct ufshcd_lrb *lrbp = &hba->lrb[tag]; struct scsi_cmnd *cmd = lrbp->cmd; @@ -362,13 +362,15 @@ static void ufshcd_add_command_trace(struct ufs_hba *hba, lba = cmd->request->bio->bi_iter.bi_sector; transfer_len = be32_to_cpu( lrbp->ucd_req_ptr->sc.exp_data_transfer_len); + if (opcode == WRITE_10) + group_id = lrbp->cmd->cmnd[6]; } } intr = ufshcd_readl(hba, REG_INTERRUPT_STATUS); doorbell = ufshcd_readl(hba, REG_UTP_TRANSFER_REQ_DOOR_BELL); trace_ufshcd_command(dev_name(hba->dev), str, tag, - doorbell, transfer_len, intr, lba, opcode); + doorbell, transfer_len, intr, lba, opcode, group_id); } static void ufshcd_print_clk_freqs(struct ufs_hba *hba) diff --git a/include/trace/events/ufs.h b/include/trace/events/ufs.h index 84841b3a7ffd5..50654f3526392 100644 --- a/include/trace/events/ufs.h +++ b/include/trace/events/ufs.h @@ -11,6 +11,15 @@ #include +#define str_opcode(opcode) \ + __print_symbolic(opcode, \ + { WRITE_16, "WRITE_16" }, \ + { WRITE_10, "WRITE_10" }, \ + { READ_16, "READ_16" }, \ + { READ_10, "READ_10" }, \ + { SYNCHRONIZE_CACHE, "SYNC" }, \ + { UNMAP, "UNMAP" }) + #define UFS_LINK_STATES \ EM(UIC_LINK_OFF_STATE) \ EM(UIC_LINK_ACTIVE_STATE) \ @@ -215,9 +224,10 @@ DEFINE_EVENT(ufshcd_template, ufshcd_init, TRACE_EVENT(ufshcd_command, TP_PROTO(const char *dev_name, const char *str, unsigned int tag, u32 doorbell, int transfer_len, u32 intr, u64 lba, - u8 opcode), + u8 opcode, u8 group_id), - TP_ARGS(dev_name, str, tag, doorbell, transfer_len, intr, lba, opcode), + TP_ARGS(dev_name, str, tag, doorbell, transfer_len, + intr, lba, opcode, group_id), TP_STRUCT__entry( __string(dev_name, dev_name) @@ -228,6 +238,7 @@ TRACE_EVENT(ufshcd_command, __field(u32, intr) __field(u64, lba) __field(u8, opcode) + __field(u8, group_id) ), TP_fast_assign( @@ -239,13 +250,15 @@ TRACE_EVENT(ufshcd_command, __entry->intr = intr; __entry->lba = lba; __entry->opcode = opcode; + __entry->group_id = group_id; ), TP_printk( - "%s: %s: tag: %u, DB: 0x%x, size: %d, IS: %u, LBA: %llu, opcode: 0x%x", + "%s: %s: tag: %u, DB: 0x%x, size: %d, IS: %u, LBA: %llu, opcode: 0x%x (%s), group_id: 0x%x", __get_str(str), __get_str(dev_name), __entry->tag, __entry->doorbell, __entry->transfer_len, - __entry->intr, __entry->lba, (u32)__entry->opcode + __entry->intr, __entry->lba, (u32)__entry->opcode, + str_opcode(__entry->opcode), (u32)__entry->group_id ) );