From patchwork Wed Jul 8 02:23:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kiwoong Kim X-Patchwork-Id: 11650561 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 2D69C14E3 for ; Wed, 8 Jul 2020 02:32:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 105922078A for ; Wed, 8 Jul 2020 02:32:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="Wjv2BPl8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729014AbgGHCcC (ORCPT ); Tue, 7 Jul 2020 22:32:02 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:16348 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728792AbgGHCcC (ORCPT ); Tue, 7 Jul 2020 22:32:02 -0400 Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20200708023158epoutp0399f168c071cc761a82257b5d3567601c~fpi-35Po91210712107epoutp03X for ; Wed, 8 Jul 2020 02:31:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20200708023158epoutp0399f168c071cc761a82257b5d3567601c~fpi-35Po91210712107epoutp03X DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1594175518; bh=riS21KbjlfpteIdZH0R/LAgbQCa5vxQyYRDqz1ap0RA=; h=From:To:Cc:Subject:Date:In-Reply-To:In-Reply-To:References:From; b=Wjv2BPl8gnKu3aea5fDrOnimd17vnLXLN/up9KcEZLTIuup0jrcj84s+Mdhb0RT6+ 4DTvPloNhlDxeKlhvfPnpLroVcpWY7v6RvdUHHPBAmC0zU7RHib4rQIf2ht1z4h3Kv r0VHqi6JWvSrgfAy80br8dxOs2dLW5AdC1kl6cbc= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20200708023157epcas2p3d71c2d210d3bcce78a64246bc3b6f974~fpi-XSMP73009030090epcas2p3m; Wed, 8 Jul 2020 02:31:57 +0000 (GMT) Received: from epsmges2p3.samsung.com (unknown [182.195.40.190]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4B1jxR3TvwzMqYlx; Wed, 8 Jul 2020 02:31:55 +0000 (GMT) Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id 7D.ED.27441.B10350F5; Wed, 8 Jul 2020 11:31:55 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas2p3.samsung.com (KnoxPortal) with ESMTPA id 20200708023155epcas2p3ac30e4b0c24855e0a3466126bba9c612~fpi9EjT3-0881908819epcas2p3j; Wed, 8 Jul 2020 02:31:55 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200708023155epsmtrp265733bac2f81dcc47416c494c954ce0e~fpi9Ds2XG2368623686epsmtrp2u; Wed, 8 Jul 2020 02:31:55 +0000 (GMT) X-AuditID: b6c32a47-fc5ff70000006b31-16-5f05301bfb3d Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 46.82.08303.A10350F5; Wed, 8 Jul 2020 11:31:54 +0900 (KST) Received: from ubuntu.dsn.sec.samsung.com (unknown [12.36.155.120]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200708023154epsmtip2c78f5ee2f7883a409bd2120932074008~fpi80-WSR0606906069epsmtip2O; Wed, 8 Jul 2020 02:31:54 +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: [RESEND RFC PATCH v4 1/3] ufs: introduce a callback to get info of command completion Date: Wed, 8 Jul 2020 11:23:59 +0900 Message-Id: <89b90646c310fb0048701f219eb23c4b35ef7dcf.1594174981.git.kwmad.kim@samsung.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: In-Reply-To: X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprBJsWRmVeSWpSXmKPExsWy7bCmqa60AWu8wellohYP5m1js9jbdoLd 4uXPq2wWBx92slhM+/CT2eLT+mWsFr/+rme3WL34AYvFohvbmCxubjnKYtF9fQebxfLj/5gs uu7eYLRY+u8tiwOfx+Ur3h6X+3qZPCYsOsDo8X19B5vHx6e3WDz6tqxi9Pi8Sc6j/UA3UwBH VI5NRmpiSmqRQmpecn5KZl66rZJ3cLxzvKmZgaGuoaWFuZJCXmJuqq2Si0+ArltmDtDdSgpl iTmlQKGAxOJiJX07m6L80pJUhYz84hJbpdSClJwCQ8MCveLE3OLSvHS95PxcK0MDAyNToMqE nIxJ3TEFf4Qqpra/ZmxgvMjfxcjJISFgIrGu5Rh7FyMXh5DADkaJ39famCCcT4wSU1+2sYBU CQl8ZpR49cEKpuPM0S9QRbsYJf4t3s8G4fxglNhyYhc7SBWbgKbE05tTwapEBDYzSbxacJ8Z JMEsoC6xa8IJJhBbWCBB4viih2ANLAKqEpseH2MEsXkFoiUuH9jCArFOTuLmuU6wXk4BS4mX P7rY0dkSAlM5JJY8ioOwXSQuXuhmhLCFJV4d3wJVIyXx+d1eNgi7XmLf1AZWkOMkBHoYJZ7u +wfVYCwx61k7kM0BdKimxPpd+iCmhICyxJFbLBDn80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YYFRnmp5XrFibnFpXnpesn5uZsYwZGgpbWDcc+q D3qHGJk4GA8xSnAwK4nwGiiyxgvxpiRWVqUW5ccXleakFh9ilOZgURLn/TprYZyQQHpiSWp2 ampBahFMlomDU6qByWpO6pGT02TCum9sSzLNfDc1gze8aMXiVK4le35sT09u3sBrdtE6Y7Zy t0nLvrW3X6r7rrkTt3C38T7Z/nKf5Ld9AtGTlnmkzbhzZ+HGR4fuHF5y4cblR2XvTURfiB1e a8+2rnt7eXNcftvrWR9UXs7Yl/IhiVcgWW7Ot8eTFA7oPTywdW+Nkn3JRCU16y87ZBxZFjxM TVOz9am7UTbj1d+2zOXzf1ky8c//uat4H4Os5qynBxZ92pfLcZ4/Ply92W975r5a/+0TKySZ +R7Vbvvy+kLYr0SLsivZCnySzev+LEufxpygm3Y4+A6L1ePQvz9evlvhrV4gVSJydWPkCc9X AZuCA56a9ymt2MF6/Y8SS3FGoqEWc1FxIgDYPEse8wIAAA== X-CMS-MailID: 20200708023155epcas2p3ac30e4b0c24855e0a3466126bba9c612 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20200708023155epcas2p3ac30e4b0c24855e0a3466126bba9c612 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 | 2 ++ drivers/scsi/ufs/ufshcd.h | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 52abe82..3326236 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -4882,6 +4882,7 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba *hba, for_each_set_bit(index, &completed_reqs, hba->nutrs) { lrbp = &hba->lrb[index]; 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); @@ -4890,6 +4891,7 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba *hba, /* Mark completed command as NULL in LRB */ lrbp->cmd = NULL; lrbp->compl_time_stamp = ktime_get(); + /* Do not touch lrbp after scsi done */ cmd->scsi_done(cmd); __ufshcd_release(hba); 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) {