From patchwork Fri Nov 8 08:15:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Can Guo X-Patchwork-Id: 11234281 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 E3FCE139A for ; Fri, 8 Nov 2019 08:15:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C3675222C2 for ; Fri, 8 Nov 2019 08:15:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="bHhqIiqR"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="JUv2uRvR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729973AbfKHIPu (ORCPT ); Fri, 8 Nov 2019 03:15:50 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:49514 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725975AbfKHIPt (ORCPT ); Fri, 8 Nov 2019 03:15:49 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 0C9E260DA7; Fri, 8 Nov 2019 08:15:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1573200949; bh=ZIPu4gT4HYxGcpXO8G7/FKIaTnRGQoh2m4/H7iQslC4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bHhqIiqRU2gB+S/KidQwPZvOYunorKkq6j9LQq4xqCJsvl7yTUJpIcZ/7hrlNuK3x 6QHiyRDsM82klpRqi/G1WCmNAHK6cEbLiVoEyGynv4UY6V1v3WYXFAsNXSI6cveu5K SIf0KyX7ngqminC3ExW2yiNsivtuvCgAm0CyDrQU= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED,SPF_NONE autolearn=no autolearn_force=no version=3.4.0 Received: from pacamara-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: cang@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id BA0C560A0A; Fri, 8 Nov 2019 08:15:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1573200946; bh=ZIPu4gT4HYxGcpXO8G7/FKIaTnRGQoh2m4/H7iQslC4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JUv2uRvRKc5FS6dVBkxSkrUH90kACnHZN7jQdx824WUxLTyHDcbU/6uiOEA4qsPKv 39MpDZmTfEADpQvT2vpf3XyJ4Xd6EfXYic5yASfp6rMSfc/td7Mew1H5BLqv1mhNP4 Cv4Yg8Y8OXLuOzbY1o9cXGgPcqVCQXUaeVmqmB7Y= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org BA0C560A0A Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=cang@codeaurora.org From: Can Guo To: asutoshd@codeaurora.org, nguyenb@codeaurora.org, rnayak@codeaurora.org, linux-scsi@vger.kernel.org, kernel-team@android.com, saravanak@google.com, salyzyn@google.com, cang@codeaurora.org Cc: Alim Akhtar , Avri Altman , Pedro Sousa , "James E.J. Bottomley" , "Martin K. Petersen" , Stanley Chu , Bean Huo , Subhash Jadavani , Tomas Winkler , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v1 1/5] scsi: ufs: Recheck bkops level if bkops is disabled Date: Fri, 8 Nov 2019 00:15:27 -0800 Message-Id: <1573200932-384-2-git-send-email-cang@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1573200932-384-1-git-send-email-cang@codeaurora.org> References: <1573200932-384-1-git-send-email-cang@codeaurora.org> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Asutosh Das Bkops level should be rechecked upon receiving an exception. Currently the bkops level is being cached and never updated. Update the same each time the level is checked. Also do not use the cached bkops level value if it is disabled and then enabled. Signed-off-by: Asutosh Das Signed-off-by: Can Guo Reviewed-by: Bean Huo --- drivers/scsi/ufs/ufshcd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 3910c58..8e7c362 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -5099,6 +5099,7 @@ static int ufshcd_disable_auto_bkops(struct ufs_hba *hba) hba->auto_bkops_enabled = false; trace_ufshcd_auto_bkops_state(dev_name(hba->dev), "Disabled"); + hba->is_urgent_bkops_lvl_checked = false; out: return err; } @@ -5123,6 +5124,7 @@ static void ufshcd_force_reset_auto_bkops(struct ufs_hba *hba) hba->ee_ctrl_mask &= ~MASK_EE_URGENT_BKOPS; ufshcd_disable_auto_bkops(hba); } + hba->is_urgent_bkops_lvl_checked = false; } static inline int ufshcd_get_bkops_status(struct ufs_hba *hba, u32 *status) @@ -5169,6 +5171,7 @@ static int ufshcd_bkops_ctrl(struct ufs_hba *hba, err = ufshcd_enable_auto_bkops(hba); else err = ufshcd_disable_auto_bkops(hba); + hba->urgent_bkops_lvl = curr_status; out: return err; } From patchwork Fri Nov 8 08:15:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Can Guo X-Patchwork-Id: 11234283 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 B0380139A for ; Fri, 8 Nov 2019 08:15:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8D8E321D6C for ; Fri, 8 Nov 2019 08:15:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="TaJfk4Xu"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="dSP1hitI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730330AbfKHIPz (ORCPT ); Fri, 8 Nov 2019 03:15:55 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:49602 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730151AbfKHIPy (ORCPT ); Fri, 8 Nov 2019 03:15:54 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 0BD1D60EE1; Fri, 8 Nov 2019 08:15:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1573200954; bh=wXwwwvUINnj34SUr4o4/StB9CH2B0Z+nZ4KsWx3pSAA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TaJfk4Xu9q0nBJ66zU39SLjGYXqaLsUEQSfYqezYLpLLSnAfA/YykmeTA90/WLGZm +e0byz1wNFadSTKgVHknzUg08Xa/2vxXW4THnMIIMc8iIatkvX+bDsmBSCrRZ2mYea dQhXRW0MVc6tCMQnjL6o77FgjfUzF6/TNcba3QNs= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED,SPF_NONE autolearn=no autolearn_force=no version=3.4.0 Received: from pacamara-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: cang@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id D81FE60BFA; Fri, 8 Nov 2019 08:15:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1573200952; bh=wXwwwvUINnj34SUr4o4/StB9CH2B0Z+nZ4KsWx3pSAA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dSP1hitIrt90furCq7Xv0WAp/532rCkpGXugGqiYg3DwRRVJpSk6I+KFcwW6QzHXq bvRIaKVEk24WnRbomQA/MVZFfxO8FlStBUT7rScUZDNPGTHM5a1c9hnaxFC8v8HMfZ 4KpwnBbwsExWZgeKZdRYcjPVrEyn/I9VkChsXB8Y= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org D81FE60BFA Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=cang@codeaurora.org From: Can Guo To: asutoshd@codeaurora.org, nguyenb@codeaurora.org, rnayak@codeaurora.org, linux-scsi@vger.kernel.org, kernel-team@android.com, saravanak@google.com, salyzyn@google.com, cang@codeaurora.org Cc: Alim Akhtar , Avri Altman , Pedro Sousa , "James E.J. Bottomley" , "Martin K. Petersen" , Stanley Chu , Bean Huo , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v1 2/5] scsi: ufs: Add new bit field PA_INIT to UECDL register Date: Fri, 8 Nov 2019 00:15:28 -0800 Message-Id: <1573200932-384-3-git-send-email-cang@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1573200932-384-1-git-send-email-cang@codeaurora.org> References: <1573200932-384-1-git-send-email-cang@codeaurora.org> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Add new bit field (bit-15) PA_INIT to UECDL register, this will correctly handle any PA_INIT error. Signed-off-by: Can Guo --- drivers/scsi/ufs/ufshci.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshci.h b/drivers/scsi/ufs/ufshci.h index dbb75cd..c2961d3 100644 --- a/drivers/scsi/ufs/ufshci.h +++ b/drivers/scsi/ufs/ufshci.h @@ -195,7 +195,7 @@ enum { /* UECDL - Host UIC Error Code Data Link Layer 3Ch */ #define UIC_DATA_LINK_LAYER_ERROR 0x80000000 -#define UIC_DATA_LINK_LAYER_ERROR_CODE_MASK 0x7FFF +#define UIC_DATA_LINK_LAYER_ERROR_CODE_MASK 0xFFFF #define UIC_DATA_LINK_LAYER_ERROR_TCX_REP_TIMER_EXP 0x2 #define UIC_DATA_LINK_LAYER_ERROR_AFCX_REQ_TIMER_EXP 0x4 #define UIC_DATA_LINK_LAYER_ERROR_FCX_PRO_TIMER_EXP 0x8 From patchwork Fri Nov 8 08:15:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Can Guo X-Patchwork-Id: 11234285 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 91993139A for ; Fri, 8 Nov 2019 08:16:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6EAF72178F for ; Fri, 8 Nov 2019 08:16:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="W7tMygJM"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="mnOdZFe1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730553AbfKHIQI (ORCPT ); Fri, 8 Nov 2019 03:16:08 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:49870 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729873AbfKHIQH (ORCPT ); Fri, 8 Nov 2019 03:16:07 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 6E26F60F5E; Fri, 8 Nov 2019 08:16:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1573200967; bh=/6MGWDPZHo0XAVvtZ763ks6PHCdXkReKGAgOGLAcvVo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W7tMygJMSxI+mYlFb8QlTOSlwcytK10CthljljWsECEADlNBA5KqUq7hrchm4D9kK O1Xj3JdoarBecX00QfG73kTkeNYwd99P2pV1SrZwCq/lVjhl+lvZ8EYdTU6TxwwaTq VApY4XPfTgd6Ye/k01H2WfmDIk4LHC52b2IxXQQI= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED,SPF_NONE autolearn=no autolearn_force=no version=3.4.0 Received: from pacamara-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: cang@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 1C82660D46; Fri, 8 Nov 2019 08:16:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1573200964; bh=/6MGWDPZHo0XAVvtZ763ks6PHCdXkReKGAgOGLAcvVo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mnOdZFe1iNS8xeQlMW9hiMRc81lQZ9CDARqGa5Vt6kBpgF9ST0wlojIXGrZCIEuGh MhvUBlJqcZ3wYdOOd8q+mvGzXrDfCLhcKfJAoBwSacNXDNq02A9pAlDQaj+XMqj0I2 x6DdxE35BRlq3j/hy5TRrPvwFK4LRzm0+9PfQtPs= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 1C82660D46 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=cang@codeaurora.org From: Can Guo To: asutoshd@codeaurora.org, nguyenb@codeaurora.org, rnayak@codeaurora.org, linux-scsi@vger.kernel.org, kernel-team@android.com, saravanak@google.com, salyzyn@google.com, cang@codeaurora.org Cc: Alim Akhtar , Avri Altman , Pedro Sousa , "James E.J. Bottomley" , "Martin K. Petersen" , Tomas Winkler , Subhash Jadavani , Stanley Chu , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v1 3/5] scsi: ufs: Update VCCQ2 and VCCQ min voltage hard codes Date: Fri, 8 Nov 2019 00:15:29 -0800 Message-Id: <1573200932-384-4-git-send-email-cang@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1573200932-384-1-git-send-email-cang@codeaurora.org> References: <1573200932-384-1-git-send-email-cang@codeaurora.org> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Per UFS 3.0 JEDEC standard, the VCCQ2 min voltage is 1.7v and the VCCQ min voltage is 1.14v, update their hard codes accordingly. Signed-off-by: Can Guo --- drivers/scsi/ufs/ufs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h index 385bac8..9df4f4d 100644 --- a/drivers/scsi/ufs/ufs.h +++ b/drivers/scsi/ufs/ufs.h @@ -500,9 +500,9 @@ struct ufs_query_res { #define UFS_VREG_VCC_MAX_UV 3600000 /* uV */ #define UFS_VREG_VCC_1P8_MIN_UV 1700000 /* uV */ #define UFS_VREG_VCC_1P8_MAX_UV 1950000 /* uV */ -#define UFS_VREG_VCCQ_MIN_UV 1100000 /* uV */ +#define UFS_VREG_VCCQ_MIN_UV 1140000 /* uV */ #define UFS_VREG_VCCQ_MAX_UV 1300000 /* uV */ -#define UFS_VREG_VCCQ2_MIN_UV 1650000 /* uV */ +#define UFS_VREG_VCCQ2_MIN_UV 1700000 /* uV */ #define UFS_VREG_VCCQ2_MAX_UV 1950000 /* uV */ /* From patchwork Fri Nov 8 08:15:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Can Guo X-Patchwork-Id: 11234287 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 4F6431709 for ; Fri, 8 Nov 2019 08:16:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2D7D121D6C for ; Fri, 8 Nov 2019 08:16:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="XbB+AwP5"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="YOV1tpB3" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730668AbfKHIQO (ORCPT ); Fri, 8 Nov 2019 03:16:14 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:50070 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729873AbfKHIQO (ORCPT ); Fri, 8 Nov 2019 03:16:14 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 1C699601E7; Fri, 8 Nov 2019 08:16:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1573200973; bh=Khjp9idUetqKkgihK8iOQyiq9dNb53Oa0Bjyc3Bj4LY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XbB+AwP5o0IempQHaBSX/TprgB9tpSlCZdnC41QR0sfy5LyOaPoXx4E7g5SWIg3+y OyoUAeKhw+Wgv5xXA/iwDVmG9BYgZO3G2wjn9d/Ggym1taZrTm5u/NG+bYl+Thbha1 3xmFrucMEzLo9Qabkn7Aci6gtBeoJjxzIjSmGq2k= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED,SPF_NONE autolearn=no autolearn_force=no version=3.4.0 Received: from pacamara-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: cang@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 5798960386; Fri, 8 Nov 2019 08:16:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1573200970; bh=Khjp9idUetqKkgihK8iOQyiq9dNb53Oa0Bjyc3Bj4LY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YOV1tpB3+Tj7bME6Iyf1/nNDM0GdTjbewVBRTjH/TQw7SqXqCK83rIboTzT34vzph 3ezBsrcWSdJMjs62pt7frml5dZX6cQFJHA8xxHwxw16n7anidrX9NwC7E51ZBY230+ U325+nY776k5eNGDxxgRyXMy/lE/Uv5HHdxGXJdk= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 5798960386 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=cang@codeaurora.org From: Can Guo To: asutoshd@codeaurora.org, nguyenb@codeaurora.org, rnayak@codeaurora.org, linux-scsi@vger.kernel.org, kernel-team@android.com, saravanak@google.com, salyzyn@google.com, cang@codeaurora.org Cc: Alim Akhtar , Avri Altman , Pedro Sousa , "James E.J. Bottomley" , "Martin K. Petersen" , Stanley Chu , Bean Huo , Subhash Jadavani , Tomas Winkler , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v1 4/5] scsi: ufs: Avoid messing up the compl_time_stamp of lrbs Date: Fri, 8 Nov 2019 00:15:30 -0800 Message-Id: <1573200932-384-5-git-send-email-cang@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1573200932-384-1-git-send-email-cang@codeaurora.org> References: <1573200932-384-1-git-send-email-cang@codeaurora.org> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org To be on the safe side, do not touch one lrb after clear its slot in the lrb_in_use bitmap to avoid messing up the next task which would possibly occupy this lrb. Signed-off-by: Can Guo --- drivers/scsi/ufs/ufshcd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 8e7c362..5950a7c 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -4902,12 +4902,14 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba *hba, cmd->result = result; /* Mark completed command as NULL in LRB */ lrbp->cmd = NULL; + lrbp->compl_time_stamp = ktime_get(); clear_bit_unlock(index, &hba->lrb_in_use); /* Do not touch lrbp after scsi done */ cmd->scsi_done(cmd); __ufshcd_release(hba); } else if (lrbp->command_type == UTP_CMD_TYPE_DEV_MANAGE || lrbp->command_type == UTP_CMD_TYPE_UFS_STORAGE) { + lrbp->compl_time_stamp = ktime_get(); if (hba->dev_cmd.complete) { ufshcd_add_command_trace(hba, index, "dev_complete"); @@ -4916,8 +4918,6 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba *hba, } if (ufshcd_is_clkscaling_supported(hba)) hba->clk_scaling.active_reqs--; - - lrbp->compl_time_stamp = ktime_get(); } /* clear corresponding bits of completed commands */ From patchwork Fri Nov 8 08:15:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Can Guo X-Patchwork-Id: 11234289 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 EACC91709 for ; Fri, 8 Nov 2019 08:16:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C83DE21D6C for ; Fri, 8 Nov 2019 08:16:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="TjNxE5sl"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="mdJLYfvD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730720AbfKHIQX (ORCPT ); Fri, 8 Nov 2019 03:16:23 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:50282 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727573AbfKHIQX (ORCPT ); Fri, 8 Nov 2019 03:16:23 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 9F2D7608FF; Fri, 8 Nov 2019 08:16:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1573200982; bh=YE4mTfL1gCRFuKHoeeEuCd7jY1kBHK31oyr+tOEAPfQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TjNxE5sliFapWQiDw2tjpWK4diVD81tidrvLsZN04xBkXbyqQg245osh8j0WvyRFT obmkRzHZInO9aV54eEBuYua2WAhqMW5Hf0mYUygcwTrpPGxOZEt+Q3rfiAyMt7M4A0 1USSxCCVUCgjsZTNvXWj/AX9L2qK2GsFKd5vH4mU= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED,SPF_NONE autolearn=no autolearn_force=no version=3.4.0 Received: from pacamara-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: cang@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id BDCDB60117; Fri, 8 Nov 2019 08:16:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1573200977; bh=YE4mTfL1gCRFuKHoeeEuCd7jY1kBHK31oyr+tOEAPfQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mdJLYfvDzmqZJsbab5fIcgnplrHe06TgdDAckcjLofpkaj0rT7BUCOY9qoMMI5qhT VJpA5qEPyNv+CQ8G3/WjJYY10pzaNwQ46p4HVRX6xAVWByjc/QIqInTNq0Hf+xtu6T AA0hq2LO40+9TKfW4xeI7YCia+cE4gFEVGOd0KiA= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org BDCDB60117 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=cang@codeaurora.org From: Can Guo To: asutoshd@codeaurora.org, nguyenb@codeaurora.org, rnayak@codeaurora.org, linux-scsi@vger.kernel.org, kernel-team@android.com, saravanak@google.com, salyzyn@google.com, cang@codeaurora.org Cc: Alim Akhtar , Avri Altman , Pedro Sousa , "James E.J. Bottomley" , "Martin K. Petersen" , Stanley Chu , Bean Huo , Subhash Jadavani , Tomas Winkler , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v1 5/5] scsi: ufs: Complete pending requests in host reset and restore path Date: Fri, 8 Nov 2019 00:15:31 -0800 Message-Id: <1573200932-384-6-git-send-email-cang@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1573200932-384-1-git-send-email-cang@codeaurora.org> References: <1573200932-384-1-git-send-email-cang@codeaurora.org> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org In UFS host reset and restore path, before probe, we stop and start the host controller once. After host controller is stopped, the pending requests, if any, are cleared from the doorbell, but no completion IRQ would be raised due to the hba is stopped. These pending requests shall be completed along with the first NOP_OUT command(as it is the first command which can raise a transfer completion IRQ) sent during probe. Since the OCSs of these pending requests are not SUCCESS(because they are not yet literally finished), their UPIUs shall be dumped. When there are multiple pending requests, the UPIU dump can be overwhelming and may lead to stability issues because it is in atomic context. Therefore, before probe, complete these pending requests right after host controller is stopped. Signed-off-by: Can Guo Reviewed-by: Alim Akhtar Reviewed-by: Bean Huo Tested-by: Bean Huo --- drivers/scsi/ufs/ufshcd.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 5950a7c..4df4136 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -5404,8 +5404,8 @@ static void ufshcd_err_handler(struct work_struct *work) /* * if host reset is required then skip clearing the pending - * transfers forcefully because they will automatically get - * cleared after link startup. + * transfers forcefully because they will get cleared during + * host reset and restore */ if (needs_reset) goto skip_pending_xfer_clear; @@ -6333,9 +6333,13 @@ static int ufshcd_host_reset_and_restore(struct ufs_hba *hba) int err; unsigned long flags; - /* Reset the host controller */ + /* + * Stop the host controller and complete the requests + * cleared by h/w + */ spin_lock_irqsave(hba->host->host_lock, flags); ufshcd_hba_stop(hba, false); + ufshcd_complete_requests(hba); spin_unlock_irqrestore(hba->host->host_lock, flags); /* scale up clocks to max frequency before full reinitialization */ @@ -6369,7 +6373,6 @@ static int ufshcd_host_reset_and_restore(struct ufs_hba *hba) static int ufshcd_reset_and_restore(struct ufs_hba *hba) { int err = 0; - unsigned long flags; int retries = MAX_HOST_RESET_RETRIES; do { @@ -6379,15 +6382,6 @@ static int ufshcd_reset_and_restore(struct ufs_hba *hba) err = ufshcd_host_reset_and_restore(hba); } while (err && --retries); - /* - * After reset the door-bell might be cleared, complete - * outstanding requests in s/w here. - */ - spin_lock_irqsave(hba->host->host_lock, flags); - ufshcd_transfer_req_compl(hba); - ufshcd_tmc_handler(hba); - spin_unlock_irqrestore(hba->host->host_lock, flags); - return err; }