From patchwork Sat Jul 11 06:57:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kiwoong Kim X-Patchwork-Id: 11657791 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 A96E917CA for ; Sat, 11 Jul 2020 07:05:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8CDE9207D4 for ; Sat, 11 Jul 2020 07:05:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="mC+m3R9d" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728109AbgGKHFt (ORCPT ); Sat, 11 Jul 2020 03:05:49 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:24785 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728034AbgGKHFs (ORCPT ); Sat, 11 Jul 2020 03:05:48 -0400 Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20200711070546epoutp032c162528175501a2bd5ea33b2211adc4~goN6sgJFb1583615836epoutp03W for ; Sat, 11 Jul 2020 07:05:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20200711070546epoutp032c162528175501a2bd5ea33b2211adc4~goN6sgJFb1583615836epoutp03W DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1594451146; bh=tx3CIR9u1gUiVssci1vg/SMB/POOVHhz/CdFyBPep6A=; h=From:To:Cc:Subject:Date:In-Reply-To:In-Reply-To:References:From; b=mC+m3R9dfHm9CNNA0weS48FKSGEQeGR4EICNzCwHldF2RJjWJpjRyhIPNp2xOd57O TlL/5b1iyzTiYR5nkU203fBg2IVpYB1VVo3sZIN3j5yVjcwXGqrEPOI+t1QULgTnzY o/AbnaGKmamRH5vft+GtOs8ZNm40t4K+uGMN4Ovo= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20200711070545epcas2p26b5f76ca063a9948681df4dee8a2e877~goN6KXMIb0916109161epcas2p2s; Sat, 11 Jul 2020 07:05:45 +0000 (GMT) Received: from epsmges2p3.samsung.com (unknown [182.195.40.191]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4B3gsz5nC7zMqYkZ; Sat, 11 Jul 2020 07:05:43 +0000 (GMT) Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id 11.85.27441.7C4690F5; Sat, 11 Jul 2020 16:05:43 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p2.samsung.com (KnoxPortal) with ESMTPA id 20200711070543epcas2p28a42f8386624ecaede5329e035e5e1a9~goN4D3B6V2091420914epcas2p2B; Sat, 11 Jul 2020 07:05:43 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200711070543epsmtrp1394760731ba748b19079386d25aa3872~goN4DJGXP0578505785epsmtrp1X; Sat, 11 Jul 2020 07:05:43 +0000 (GMT) X-AuditID: b6c32a47-fafff70000006b31-28-5f0964c706f5 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 40.79.08382.7C4690F5; Sat, 11 Jul 2020 16:05:43 +0900 (KST) Received: from ubuntu.dsn.sec.samsung.com (unknown [12.36.155.120]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200711070543epsmtip22df37e4f1895695676c0c57834fa071b~goN33f6iF2838728387epsmtip2K; Sat, 11 Jul 2020 07:05:43 +0000 (GMT) From: Kiwoong Kim To: linux-scsi@vger.kernel.org, alim.akhtar@samsung.com, avri.altman@wdc.com, jejb@linux.ibm.com, martin.petersen@oracle.com, beanhuo@micron.com, asutoshd@codeaurora.org, cang@codeaurora.org, bvanassche@acm.org, grant.jung@samsung.com, sc.suh@samsung.com, hy50.seo@samsung.com, sh425.lee@samsung.com Cc: Kiwoong Kim Subject: [RFC PATCH v5 1/3] ufs: introduce a callback to get info of command completion Date: Sat, 11 Jul 2020 15:57:43 +0900 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: In-Reply-To: X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprDJsWRmVeSWpSXmKPExsWy7bCmqe7xFM54g7U/dC0ezNvGZrG37QS7 xcufV9ksDj7sZLGY9uEns8Wn9ctYLX79Xc9usXrxAxaLRTe2MVnc3HKUxaL7+g42i+XH/zFZ dN29wWix9N9bFgc+j8tXvD0u9/UyeUxYdIDR4/v6DjaPj09vsXj0bVnF6PF5k5xH+4FupgCO qBybjNTElNQihdS85PyUzLx0WyXv4HjneFMzA0NdQ0sLcyWFvMTcVFslF58AXbfMHKC7lRTK EnNKgUIBicXFSvp2NkX5pSWpChn5xSW2SqkFKTkFhoYFesWJucWleel6yfm5VoYGBkamQJUJ ORntH+awFbwVqJiyZAZjA2MjXxcjJ4eEgInE02P/2boYuTiEBHYwSuzvOQzlfGKUuLpqCxOE 841R4ujjiawwLY27lrJDJPYySpy6+Y8RwvnBKHHwx3ZGkCo2AU2JpzengrWLCGxmkni14D4z SIJZQF1i14QTTCC2sECkxKrzK8HGsgioSiyeuo0NxOYViJZYd7qfEWKdnMTNc51gvZwClhJn n15gQWVzAdVM5ZB43/yZDaLBReLJLYhlEgLCEq+Ob2GHsKUkXva3Qdn1EvumNrBCNPcwSjzd 9w9qm7HErGftQDYH0KWaEut36YOYEgLKEkdusUDczyfRcfgvO0SYV6KjTQiiUVni16TJUEMk JWbevAO1yUPi0qKnrJAAAtr04cgr5gmM8rMQFixgZFzFKJZaUJybn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OJiVRHijRTnjhXhTEiurUovy44tKc1KLDzFKc7AoifPeKFwYJySQnliS mp2aWpBaBJNl4uCUamDSOHOJ++F2nmjfbJenJtO1Q9fa99e/O/pmWdee9/8m/419k5xgckxT 8+aP52KKR25mpNc959q8x+F3XGLZpyPmk75adz3a+Wb2/poJFTf6P8Vuijf/cfT7Bttygymq fk7nmhL/XJv74fM2JU3/XTNtld8p2RRc0+PzmX1JR9ar6VOR2cIHZ9/L5tY1K5+yS+52CdSy 9pq9PLHmFftPLvfdav5ntRhyOCrOqzntX6NoVv/i52RdgwKOEseUqLX2G77uYjdxK+A/12t+ NvCIDFucz+PvWofuOcdce3U9Zm2GmKnYdces5c/0TE69Ys1vPtzF2mslxcWzvu9o8Y8rsabr Gl2frz0aN0Ffd8e51UuVWIozEg21mIuKEwFKBfwk8gIAAA== X-CMS-MailID: 20200711070543epcas2p28a42f8386624ecaede5329e035e5e1a9 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20200711070543epcas2p28a42f8386624ecaede5329e035e5e1a9 References: Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Some SoC specific might need command history for various reasons, such as stacking command contexts in system memory to check for debugging in the future or scaling some DVFS knobs to boost IO throughput. What you would do with the information could be variant per SoC vendor. Signed-off-by: Kiwoong Kim Acked-by: Stanley Chu Reviewed-by: Avri Altman --- drivers/scsi/ufs/ufshcd.c | 1 + drivers/scsi/ufs/ufshcd.h | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 292af12..092480a 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -4884,6 +4884,7 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba *hba, lrbp = &hba->lrb[index]; lrbp->compl_time_stamp = ktime_get(); cmd = lrbp->cmd; + ufshcd_vops_compl_xfer_req(hba, index, (cmd) ? true : false); if (cmd) { ufshcd_add_command_trace(hba, index, "complete"); result = ufshcd_transfer_rsp_status(hba, lrbp); diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index c774012..e5353d6 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -294,6 +294,7 @@ struct ufs_hba_variant_ops { struct ufs_pa_layer_attr *, struct ufs_pa_layer_attr *); void (*setup_xfer_req)(struct ufs_hba *, int, bool); + void (*compl_xfer_req)(struct ufs_hba *hba, int tag, bool is_scsi); void (*setup_task_mgmt)(struct ufs_hba *, int, u8); void (*hibern8_notify)(struct ufs_hba *, enum uic_cmd_dme, enum ufs_notify_change_status); @@ -1070,6 +1071,13 @@ static inline void ufshcd_vops_setup_xfer_req(struct ufs_hba *hba, int tag, return hba->vops->setup_xfer_req(hba, tag, is_scsi_cmd); } +static inline void ufshcd_vops_compl_xfer_req(struct ufs_hba *hba, + int tag, bool is_scsi) +{ + if (hba->vops && hba->vops->compl_xfer_req) + hba->vops->compl_xfer_req(hba, tag, is_scsi); +} + static inline void ufshcd_vops_setup_task_mgmt(struct ufs_hba *hba, int tag, u8 tm_function) { From patchwork Sat Jul 11 06:57:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kiwoong Kim X-Patchwork-Id: 11657797 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 37A8A14B7 for ; Sat, 11 Jul 2020 07:05:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 12293207DD for ; Sat, 11 Jul 2020 07:05:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="O7KCWgz9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728052AbgGKHFw (ORCPT ); Sat, 11 Jul 2020 03:05:52 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:24494 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728055AbgGKHFv (ORCPT ); Sat, 11 Jul 2020 03:05:51 -0400 Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20200711070547epoutp013902c44d99905909316ec609c2ba660c~goN7__yHD2613326133epoutp017 for ; Sat, 11 Jul 2020 07:05:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20200711070547epoutp013902c44d99905909316ec609c2ba660c~goN7__yHD2613326133epoutp017 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1594451147; bh=Whgm6RINWS65SXZAMO5ucEpNPn93dfdn7XRNNtWL5oM=; h=From:To:Cc:Subject:Date:In-Reply-To:In-Reply-To:References:From; b=O7KCWgz9WQxnDzJ4KxRSceKH1cQNZS2M8DxWA5O59uIksp9JZ5Jf1iIjSSQtVCYeT HxGH5bJ+sTVo4goITRao91LqlYZ6SMRe0AOl7EB7cK91xujkyxjh3xNo6LbJr0ESc9 o+VnUm6z2Mow8OphkMrloAknD/3KKxgr9K0tb/Mg= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20200711070546epcas2p491760b1baf2e97948dfbad9cfa105a63~goN7IJ6J21758017580epcas2p4E; Sat, 11 Jul 2020 07:05:46 +0000 (GMT) Received: from epsmges2p1.samsung.com (unknown [182.195.40.184]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4B3gt05JJKzMqYlr; Sat, 11 Jul 2020 07:05:44 +0000 (GMT) Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 46.37.19322.8C4690F5; Sat, 11 Jul 2020 16:05:44 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p4.samsung.com (KnoxPortal) with ESMTPA id 20200711070544epcas2p4d3a75d2f56b8162c09efa0eeaf012fa2~goN4zcEJ-1759717597epcas2p47; Sat, 11 Jul 2020 07:05:44 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200711070544epsmtrp17e2cee293c08562dd3ee26d51a0ac8d8~goN4yjNgB0578505785epsmtrp1Y; Sat, 11 Jul 2020 07:05:44 +0000 (GMT) X-AuditID: b6c32a45-7adff70000004b7a-39-5f0964c80bb3 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id FE.CE.08303.8C4690F5; Sat, 11 Jul 2020 16:05:44 +0900 (KST) Received: from ubuntu.dsn.sec.samsung.com (unknown [12.36.155.120]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200711070543epsmtip221afc93586037f75d5a3c6dac59b6b7e~goN4crfaQ0073700737epsmtip2D; Sat, 11 Jul 2020 07:05:43 +0000 (GMT) From: Kiwoong Kim To: linux-scsi@vger.kernel.org, alim.akhtar@samsung.com, avri.altman@wdc.com, jejb@linux.ibm.com, martin.petersen@oracle.com, beanhuo@micron.com, asutoshd@codeaurora.org, cang@codeaurora.org, bvanassche@acm.org, grant.jung@samsung.com, sc.suh@samsung.com, hy50.seo@samsung.com, sh425.lee@samsung.com Cc: Kiwoong Kim Subject: [RFC PATCH v5 2/3] ufs: exynos: introduce command history Date: Sat, 11 Jul 2020 15:57:44 +0900 Message-Id: <71f2a8e3fdfcf9f60cc8b5e14acf3a57cf22d4f8.1594450408.git.kwmad.kim@samsung.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: In-Re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eXPfZD2vytfnr55F+bv/MG9IS5x6a8H5F4yb9wfvvO86s8FFrPhah79Q AuvaCRGzF3PU/N9n3lhZ9fJRllh3RPRG976DL3kEmzy7GrP/CPsKCNSf+qW4x//QsoqSZ9Pk Dsus51JozFUV/BZztFJAiaU4I9FQi7moOBEAlwaSXvACAAA= X-CMS-MailID: 20200711070544epcas2p4d3a75d2f56b8162c09efa0eeaf012fa2 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20200711070544epcas2p4d3a75d2f56b8162c09efa0eeaf012fa2 References: Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This includes functions to record contexts of incoming commands in a circular queue. ufshcd.c has already some function tracer calls to get command history but ftrace would be gone when system dies before you get the information, such as panic cases. This patch also implements callbacks compl_xfer_req to store IO contexts at completion times. When you turn on CONFIG_SCSI_UFS_EXYNOS_CMD_LOG, the driver collects the information from incoming commands in the circular queue. Signed-off-by: Kiwoong Kim --- drivers/scsi/ufs/Kconfig | 14 +++ drivers/scsi/ufs/Makefile | 1 + drivers/scsi/ufs/ufs-exynos-dbg.c | 199 ++++++++++++++++++++++++++++++++++++++ drivers/scsi/ufs/ufs-exynos-if.h | 17 ++++ drivers/scsi/ufs/ufs-exynos.c | 27 ++++++ drivers/scsi/ufs/ufs-exynos.h | 29 ++++++ 6 files changed, 287 insertions(+) create mode 100644 drivers/scsi/ufs/ufs-exynos-dbg.c create mode 100644 drivers/scsi/ufs/ufs-exynos-if.h diff --git a/drivers/scsi/ufs/Kconfig b/drivers/scsi/ufs/Kconfig index 8cd9026..c946d8f 100644 --- a/drivers/scsi/ufs/Kconfig +++ b/drivers/scsi/ufs/Kconfig @@ -172,3 +172,17 @@ config SCSI_UFS_EXYNOS Select this if you have UFS host controller on EXYNOS chipset. If unsure, say N. + +config SCSI_UFS_EXYNOS_DBG + bool "EXYNOS specific debug functions" + default n + depends on SCSI_UFS_EXYNOS + help + This selects EXYNOS specific functions to get and even print + some information to see what's happening at both command + issue time completion time. + The information may contain gerernal things as well as + EXYNOS specific, such as vendor specific hardware contexts. + + Select this if you want to get and print the information. + If unsure, say N. diff --git a/drivers/scsi/ufs/Makefile b/drivers/scsi/ufs/Makefile index f0c5b95..ee09961 100644 --- a/drivers/scsi/ufs/Makefile +++ b/drivers/scsi/ufs/Makefile @@ -5,6 +5,7 @@ obj-$(CONFIG_SCSI_UFS_DWC_TC_PLATFORM) += tc-dwc-g210-pltfrm.o ufshcd-dwc.o tc-d obj-$(CONFIG_SCSI_UFS_CDNS_PLATFORM) += cdns-pltfrm.o obj-$(CONFIG_SCSI_UFS_QCOM) += ufs-qcom.o obj-$(CONFIG_SCSI_UFS_EXYNOS) += ufs-exynos.o +obj-$(CONFIG_SCSI_UFS_EXYNOS_DBG) += ufs-exynos-dbg.o obj-$(CONFIG_SCSI_UFSHCD) += ufshcd-core.o ufshcd-core-y += ufshcd.o ufs-sysfs.o ufshcd-core-$(CONFIG_SCSI_UFS_BSG) += ufs_bsg.o diff --git a/drivers/scsi/ufs/ufs-exynos-dbg.c b/drivers/scsi/ufs/ufs-exynos-dbg.c new file mode 100644 index 0000000..a626b71 --- /dev/null +++ b/drivers/scsi/ufs/ufs-exynos-dbg.c @@ -0,0 +1,199 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * UFS Exynos debugging functions + * + * Copyright (C) 2020 Samsung Electronics Co., Ltd. + * Author: Kiwoong Kim + * + */ +#include +#include +#include "ufshcd.h" +#include "ufs-exynos-if.h" + +#define MAX_CMD_LOGS 32 + +struct cmd_data { + unsigned int tag; + u32 sct; + u64 lba; + u64 start_time; + u64 end_time; + u64 outstanding_reqs; + int retries; + u8 op; +}; + +struct ufs_cmd_info { + u32 total; + u32 last; + struct cmd_data data[MAX_CMD_LOGS]; + struct cmd_data *pdata[MAX_CMD_LOGS]; +}; + +/* + * This structure points out several contexts on debugging + * per one host instant. + * Now command history exists in here but later handle may + * contains some mmio base addresses including vendor specific + * regions to get hardware contexts. + */ +struct ufs_s_dbg_mgr { + struct ufs_exynos_handle *handle; + int active; + u64 first_time; + u64 time; + + /* cmd log */ + struct ufs_cmd_info cmd_info; + struct cmd_data cmd_log; /* temp buffer to put */ + spinlock_t cmd_lock; +}; + +static void ufs_s_print_cmd_log(struct ufs_s_dbg_mgr *mgr, struct device *dev) +{ + struct ufs_cmd_info *cmd_info = &mgr->cmd_info; + struct cmd_data *data; + u32 i, idx; + u32 last; + u32 max = MAX_CMD_LOGS; + unsigned long flags; + u32 total; + + spin_lock_irqsave(&mgr->cmd_lock, flags); + total = cmd_info->total; + if (cmd_info->total < max) + max = cmd_info->total; + last = (cmd_info->last + MAX_CMD_LOGS - 1) % MAX_CMD_LOGS; + spin_unlock_irqrestore(&mgr->cmd_lock, flags); + + dev_err(dev, ":---------------------------------------------------\n"); + dev_err(dev, ":\t\tSCSI CMD(%u)\n", total - 1); + dev_err(dev, ":---------------------------------------------------\n"); + dev_err(dev, ":OP, TAG, LBA, SCT, RETRIES, STIME, ETIME, REQS\n\n"); + + idx = (last == max - 1) ? 0 : last + 1; + for (i = 0 ; i < max ; i++, data = &cmd_info->data[idx]) { + dev_err(dev, ": 0x%02x, %02d, 0x%08llx, 0x%04x, %d, %llu, %llu, 0x%llx", + data->op, data->tag, data->lba, data->sct, data->retries, + data->start_time, data->end_time, data->outstanding_reqs); + idx = (idx == max - 1) ? 0 : idx + 1; + } +} + +static void ufs_s_put_cmd_log(struct ufs_s_dbg_mgr *mgr, + struct cmd_data *cmd_data) +{ + struct ufs_cmd_info *cmd_info = &mgr->cmd_info; + unsigned long flags; + struct cmd_data *pdata; + + spin_lock_irqsave(&mgr->cmd_lock, flags); + pdata = &cmd_info->data[cmd_info->last]; + ++cmd_info->total; + ++cmd_info->last; + cmd_info->last = cmd_info->last % MAX_CMD_LOGS; + spin_unlock_irqrestore(&mgr->cmd_lock, flags); + + pdata->op = cmd_data->op; + pdata->tag = cmd_data->tag; + pdata->lba = cmd_data->lba; + pdata->sct = cmd_data->sct; + pdata->retries = cmd_data->retries; + pdata->start_time = cmd_data->start_time; + pdata->end_time = 0; + pdata->outstanding_reqs = cmd_data->outstanding_reqs; + cmd_info->pdata[cmd_data->tag] = pdata; +} + +/* + * EXTERNAL FUNCTIONS + * + * There are two classes that are to initialize data structures for debug + * and to define actual behavior. + */ +void exynos_ufs_dump_info(struct ufs_exynos_handle *handle, struct device *dev) +{ + struct ufs_s_dbg_mgr *mgr = (struct ufs_s_dbg_mgr *)handle->private; + + if (mgr->active == 0) + goto out; + + mgr->time = cpu_clock(raw_smp_processor_id()); + +#ifdef CONFIG_SCSI_UFS_EXYNOS_CMD_LOG + ufs_s_print_cmd_log(mgr, dev); +#endif + + if (mgr->first_time == 0ULL) + mgr->first_time = mgr->time; +out: + return; +} + +void exynos_ufs_cmd_log_start(struct ufs_exynos_handle *handle, + struct ufs_hba *hba, int tag) +{ + struct ufs_s_dbg_mgr *mgr = (struct ufs_s_dbg_mgr *)handle->private; + struct scsi_cmnd *cmd = hba->lrb[tag].cmd; + int cpu = raw_smp_processor_id(); + struct cmd_data *cmd_log = &mgr->cmd_log; /* temp buffer to put */ + u64 lba = 0; + u32 sct = 0; + + if (mgr->active == 0) + return; + + cmd_log->start_time = cpu_clock(cpu); + cmd_log->op = cmd->cmnd[0]; + cmd_log->tag = tag; + + /* This function runtime is protected by spinlock from outside */ + cmd_log->outstanding_reqs = hba->outstanding_reqs; + + /* Now assume using WRITE_10 and READ_10 */ + put_unaligned(cpu_to_le32(*(u32 *)cmd->cmnd[2]), (u32 *)&lba); + put_unaligned(cpu_to_le16(*(u16 *)cmd->cmnd[7]), (u16 *)&sct); + if (cmd->cmnd[0] != UNMAP) + cmd_log->lba = lba; + + cmd_log->sct = sct; + cmd_log->retries = cmd->allowed; + + ufs_s_put_cmd_log(mgr, cmd_log); +} + +void exynos_ufs_cmd_log_end(struct ufs_exynos_handle *handle, + struct ufs_hba *hba, int tag) +{ + struct ufs_s_dbg_mgr *mgr = (struct ufs_s_dbg_mgr *)handle->private; + struct scsi_cmnd *cmd = hba->lrb[tag].cmd; + struct ufs_cmd_info *cmd_info = &mgr->cmd_info; + int cpu = raw_smp_processor_id(); + + if (mgr->active == 0) + return; + + cmd_info->pdata[tag]->end_time = cpu_clock(cpu); +} + +int exynos_ufs_init_dbg(struct ufs_exynos_handle *handle, struct device *dev) +{ + struct ufs_s_dbg_mgr *mgr; + + mgr = devm_kzalloc(dev, sizeof(struct ufs_s_dbg_mgr), GFP_KERNEL); + if (!mgr) + return -ENOMEM; + handle->private = (void *)mgr; + mgr->handle = handle; + mgr->active = 1; + + /* cmd log */ + spin_lock_init(&mgr->cmd_lock); + + return 0; +} +MODULE_AUTHOR("Kiwoong Kim "); +MODULE_DESCRIPTION("Exynos UFS debug information"); +MODULE_LICENSE("GPL"); +MODULE_VERSION("0.1"); diff --git a/drivers/scsi/ufs/ufs-exynos-if.h b/drivers/scsi/ufs/ufs-exynos-if.h new file mode 100644 index 0000000..c746f59 --- /dev/null +++ b/drivers/scsi/ufs/ufs-exynos-if.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * UFS Exynos debugging functions + * + * Copyright (C) 2020 Samsung Electronics Co., Ltd. + * Author: Kiwoong Kim + * + */ +#ifndef _UFS_EXYNOS_IF_H_ +#define _UFS_EXYNOS_IF_H_ + +/* more members would be added in the future */ +struct ufs_exynos_handle { + void *private; +}; + +#endif /* _UFS_EXYNOS_IF_H_ */ diff --git a/drivers/scsi/ufs/ufs-exynos.c b/drivers/scsi/ufs/ufs-exynos.c index 440f2af..53b9d6e 100644 --- a/drivers/scsi/ufs/ufs-exynos.c +++ b/drivers/scsi/ufs/ufs-exynos.c @@ -700,12 +700,26 @@ static int exynos_ufs_post_pwr_mode(struct ufs_hba *hba, return 0; } +static void exynos_ufs_cmd_log(struct ufs_hba *hba, int tag, int start) +{ + struct exynos_ufs *ufs = ufshcd_get_variant(hba); + struct ufs_exynos_handle *handle = &ufs->handle; + + if (start == 1) + exynos_ufs_cmd_log_start(handle, hba, tag); + else if (start == 2) + exynos_ufs_cmd_log_end(handle, hba, tag); +} + static void exynos_ufs_specify_nexus_t_xfer_req(struct ufs_hba *hba, int tag, bool op) { struct exynos_ufs *ufs = ufshcd_get_variant(hba); u32 type; + if (op) + exynos_ufs_cmd_log(hba, tag, 1); + type = hci_readl(ufs, HCI_UTRL_NEXUS_TYPE); if (op) @@ -714,6 +728,12 @@ static void exynos_ufs_specify_nexus_t_xfer_req(struct ufs_hba *hba, hci_writel(ufs, type & ~(1 << tag), HCI_UTRL_NEXUS_TYPE); } +static void exynos_ufs_compl_xfer_req(struct ufs_hba *hba, int tag, bool op) +{ + if (op) + exynos_ufs_cmd_log(hba, tag, 0); +} + static void exynos_ufs_specify_nexus_t_tm_req(struct ufs_hba *hba, int tag, u8 func) { @@ -1008,6 +1028,12 @@ static int exynos_ufs_init(struct ufs_hba *hba) goto out; exynos_ufs_specify_phy_time_attr(ufs); exynos_ufs_config_smu(ufs); + + /* init dbg */ + ret = exynos_ufs_init_dbg(&ufs->handle, dev); + if (ret) + return ret; + spin_lock_init(&ufs->dbg_lock); return 0; phy_off: @@ -1217,6 +1243,7 @@ static struct ufs_hba_variant_ops ufs_hba_exynos_ops = { .link_startup_notify = exynos_ufs_link_startup_notify, .pwr_change_notify = exynos_ufs_pwr_change_notify, .setup_xfer_req = exynos_ufs_specify_nexus_t_xfer_req, + .compl_xfer_req = exynos_ufs_compl_xfer_req, .setup_task_mgmt = exynos_ufs_specify_nexus_t_tm_req, .hibern8_notify = exynos_ufs_hibern8_notify, .suspend = exynos_ufs_suspend, diff --git a/drivers/scsi/ufs/ufs-exynos.h b/drivers/scsi/ufs/ufs-exynos.h index 76d6e39..b9cb517 100644 --- a/drivers/scsi/ufs/ufs-exynos.h +++ b/drivers/scsi/ufs/ufs-exynos.h @@ -8,6 +8,7 @@ #ifndef _UFS_EXYNOS_H_ #define _UFS_EXYNOS_H_ +#include "ufs-exynos-if.h" /* * UNIPRO registers @@ -212,6 +213,10 @@ struct exynos_ufs { #define EXYNOS_UFS_OPT_BROKEN_AUTO_CLK_CTRL BIT(2) #define EXYNOS_UFS_OPT_BROKEN_RX_SEL_IDX BIT(3) #define EXYNOS_UFS_OPT_USE_SW_HIBERN8_TIMER BIT(4) + + struct ufs_exynos_handle handle; + spinlock_t dbg_lock; + int under_dump; }; #define for_each_ufs_rx_lane(ufs, i) \ @@ -284,4 +289,28 @@ struct exynos_ufs_uic_attr exynos7_uic_attr = { .rx_hs_g3_prep_sync_len_cap = PREP_LEN(0xf), .pa_dbg_option_suite = 0x30103, }; + +/* public function declarations */ +#ifdef CONFIG_SCSI_UFS_EXYNOS_DBG +void exynos_ufs_cmd_log_start(struct ufs_exynos_handle *handle, + struct ufs_hba *hba, int tag); +void exynos_ufs_cmd_log_end(struct ufs_exynos_handle *handle, + struct ufs_hba *hba, int tag); +int exynos_ufs_init_dbg(struct ufs_exynos_handle *handle, struct device *dev); +#else +void exynos_ufs_cmd_log_start(struct ufs_exynos_handle *handle, + struct ufs_hba *hba, int tag) +{ +} + +void exynos_ufs_cmd_log_end(struct ufs_exynos_handle *handle, + struct ufs_hba *hba, int tag) +{ +} + +int exynos_ufs_init_dbg(struct ufs_exynos_handle *handle, struct device *dev) +{ + return 0; +} +#endif #endif /* _UFS_EXYNOS_H_ */ From patchwork Sat Jul 11 06:57:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kiwoong Kim X-Patchwork-Id: 11657793 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 80A72722 for ; Sat, 11 Jul 2020 07:05:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 61B4A206F4 for ; Sat, 11 Jul 2020 07:05:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="ZN59jpZG" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728034AbgGKHFw (ORCPT ); Sat, 11 Jul 2020 03:05:52 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:22371 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728012AbgGKHFv (ORCPT ); Sat, 11 Jul 2020 03:05:51 -0400 Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20200711070547epoutp049224baa9b027b49f626d6ac6d706a364~goN78NVHt2541925419epoutp04L for ; Sat, 11 Jul 2020 07:05:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20200711070547epoutp049224baa9b027b49f626d6ac6d706a364~goN78NVHt2541925419epoutp04L DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1594451147; bh=z0DyozeBUNupwNMnBRpmcus0h9qYbAMUrFqrwRE7uqc=; h=From:To:Cc:Subject:Date:In-Reply-To:In-Reply-To:References:From; b=ZN59jpZGAq4c2IcJZIA/7XhqX+rbcWjAkau68/0NVCaffNqGkhRtozPiubvfoL0fY XQgzk2bnHdL8GK9tpltVp3Bph5Q5OZ/sokdopSfYCPZmZN59JLNJae7TLaTYYRpBBe k7mXNYe3MFzbCkkUz651g66qTo5t+phiFfnL1EjM= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20200711070546epcas2p2a0f189e3d65ab513fec3f9361c2d6f36~goN7TRMe20916109161epcas2p2v; Sat, 11 Jul 2020 07:05:46 +0000 (GMT) Received: from epsmges2p3.samsung.com (unknown [182.195.40.185]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4B3gt06cjXzMqYls; Sat, 11 Jul 2020 07:05:44 +0000 (GMT) Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id E3.85.27441.8C4690F5; Sat, 11 Jul 2020 16:05:44 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p1.samsung.com (KnoxPortal) with ESMTPA id 20200711070544epcas2p10291ef069c92d54a7cb8a6b7e0eb09a1~goN5FdyI72183221832epcas2p1j; Sat, 11 Jul 2020 07:05:44 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200711070544epsmtrp197b3cc2a8cbc22222f9a761361e48e24~goN5Es1DC0578505785epsmtrp1Z; Sat, 11 Jul 2020 07:05:44 +0000 (GMT) X-AuditID: b6c32a47-fc5ff70000006b31-2b-5f0964c84a10 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 31.79.08382.8C4690F5; Sat, 11 Jul 2020 16:05:44 +0900 (KST) Received: from ubuntu.dsn.sec.samsung.com (unknown [12.36.155.120]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200711070544epsmtip28446a4954643d9a020b5072526fda6eb~goN451HJ60072700727epsmtip2E; Sat, 11 Jul 2020 07:05:44 +0000 (GMT) From: Kiwoong Kim To: linux-scsi@vger.kernel.org, alim.akhtar@samsung.com, avri.altman@wdc.com, jejb@linux.ibm.com, martin.petersen@oracle.com, beanhuo@micron.com, asutoshd@codeaurora.org, cang@codeaurora.org, bvanassche@acm.org, grant.jung@samsung.com, sc.suh@samsung.com, hy50.seo@samsung.com, sh425.lee@samsung.com Cc: Kiwoong Kim Subject: [RFC PATCH v5 3/3] ufs: exynos: implement dbg_register_dump Date: Sat, 11 Jul 2020 15:57:45 +0900 Message-Id: X-Mailer: git-send-email 2.7.4 In-Re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8EwK5g5M06qfZafveeal3beNs EUUHkfai2n8mX7Q2bqra36MaqGlpGqPdztTVvco6t2VzsbaPzudob8NshkXbW+7ZmzIfymmX mlRSllbP63d0hVRdkhJLcUaioRZzUXEiAOYXMZrvAgAA X-CMS-MailID: 20200711070544epcas2p10291ef069c92d54a7cb8a6b7e0eb09a1 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20200711070544epcas2p10291ef069c92d54a7cb8a6b7e0eb09a1 References: Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org At present, I just add command history print and you can add various vendor regions. Signed-off-by: Kiwoong Kim --- drivers/scsi/ufs/Kconfig | 2 +- drivers/scsi/ufs/ufs-exynos-dbg.c | 2 -- drivers/scsi/ufs/ufs-exynos.c | 14 +++++++++++++- drivers/scsi/ufs/ufs-exynos.h | 10 ++++++++-- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/ufs/Kconfig b/drivers/scsi/ufs/Kconfig index c946d8f..b906ff8 100644 --- a/drivers/scsi/ufs/Kconfig +++ b/drivers/scsi/ufs/Kconfig @@ -181,7 +181,7 @@ config SCSI_UFS_EXYNOS_DBG This selects EXYNOS specific functions to get and even print some information to see what's happening at both command issue time completion time. - The information may contain gerernal things as well as + The information may contain general things as well as EXYNOS specific, such as vendor specific hardware contexts. Select this if you want to get and print the information. diff --git a/drivers/scsi/ufs/ufs-exynos-dbg.c b/drivers/scsi/ufs/ufs-exynos-dbg.c index a626b71..7fd7308 100644 --- a/drivers/scsi/ufs/ufs-exynos-dbg.c +++ b/drivers/scsi/ufs/ufs-exynos-dbg.c @@ -121,9 +121,7 @@ void exynos_ufs_dump_info(struct ufs_exynos_handle *handle, struct device *dev) mgr->time = cpu_clock(raw_smp_processor_id()); -#ifdef CONFIG_SCSI_UFS_EXYNOS_CMD_LOG ufs_s_print_cmd_log(mgr, dev); -#endif if (mgr->first_time == 0ULL) mgr->first_time = mgr->time; diff --git a/drivers/scsi/ufs/ufs-exynos.c b/drivers/scsi/ufs/ufs-exynos.c index 53b9d6e..444aba1 100644 --- a/drivers/scsi/ufs/ufs-exynos.c +++ b/drivers/scsi/ufs/ufs-exynos.c @@ -1033,7 +1033,6 @@ static int exynos_ufs_init(struct ufs_hba *hba) ret = exynos_ufs_init_dbg(&ufs->handle, dev); if (ret) return ret; - spin_lock_init(&ufs->dbg_lock); return 0; phy_off: @@ -1236,6 +1235,18 @@ static int exynos_ufs_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op) return 0; } +static void exynos_ufs_dbg_register_dump(struct ufs_hba *hba) +{ + struct exynos_ufs *ufs = ufshcd_get_variant(hba); + + if (!test_and_set_bit(EXYNOS_UFS_DBG_DUMP_CXT, &ufs->dbg_flag)) { + exynos_ufs_dump_info(&ufs->handle, hba->dev); + clear_bit(EXYNOS_UFS_DBG_DUMP_CXT, &ufs->dbg_flag); + } +out: + return; +} + static struct ufs_hba_variant_ops ufs_hba_exynos_ops = { .name = "exynos_ufs", .init = exynos_ufs_init, @@ -1248,6 +1259,7 @@ static struct ufs_hba_variant_ops ufs_hba_exynos_ops = { .hibern8_notify = exynos_ufs_hibern8_notify, .suspend = exynos_ufs_suspend, .resume = exynos_ufs_resume, + .dbg_register_dump = exynos_ufs_dbg_register_dump, }; static int exynos_ufs_probe(struct platform_device *pdev) diff --git a/drivers/scsi/ufs/ufs-exynos.h b/drivers/scsi/ufs/ufs-exynos.h index b9cb517..3f242de 100644 --- a/drivers/scsi/ufs/ufs-exynos.h +++ b/drivers/scsi/ufs/ufs-exynos.h @@ -215,8 +215,8 @@ struct exynos_ufs { #define EXYNOS_UFS_OPT_USE_SW_HIBERN8_TIMER BIT(4) struct ufs_exynos_handle handle; - spinlock_t dbg_lock; - int under_dump; + unsigned long dbg_flag; +#define EXYNOS_UFS_DBG_DUMP_CXT BIT(0) }; #define for_each_ufs_rx_lane(ufs, i) \ @@ -297,6 +297,7 @@ void exynos_ufs_cmd_log_start(struct ufs_exynos_handle *handle, void exynos_ufs_cmd_log_end(struct ufs_exynos_handle *handle, struct ufs_hba *hba, int tag); int exynos_ufs_init_dbg(struct ufs_exynos_handle *handle, struct device *dev); +void exynos_ufs_dump_info(struct ufs_exynos_handle *handle, struct device *dev); #else void exynos_ufs_cmd_log_start(struct ufs_exynos_handle *handle, struct ufs_hba *hba, int tag) @@ -312,5 +313,10 @@ int exynos_ufs_init_dbg(struct ufs_exynos_handle *handle, struct device *dev) { return 0; } + +void exynos_ufs_dump_info(struct ufs_exynos_handle *handle, struct device *dev) +{ + return 0; +} #endif #endif /* _UFS_EXYNOS_H_ */