From patchwork Tue Nov 1 14:24:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?UGV0ZXIgV2FuZyAo546L5L+h5Y+LKQ==?= X-Patchwork-Id: 13027030 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A129BC433FE for ; Tue, 1 Nov 2022 14:51:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=R2LH7u+VlcONlDiOGNmmbHJG1mefnxFcstqMk9vb3xQ=; b=utsb6kcYQM7aLzU0+z5/PKpMDI vfPeeuaERftqQ1CqIuiEa/jLiCmgI7Jpmw9KR7aeEoQIPSg0siso8ET4r7CGNw5tY/ApNp7Fnsc+F RhJhpQ99paWCQMqBe27bIzmSruWGDTALTA8XitKPzaMUfqqt4zh4ebKPz3Jqz88CAdjeImhpFlVw+ 79BCtDQggoDKBtE07pap0u+p+Rx3J7PKRpsQUAmZbBJk/AF9NBa6KFhabGofcTBfhXJsQsoNtvsJW zXKMxhG5ppKvsGPPZiscdo4Lhi/ZdT9mSAdtBAcATskhlG9VdAAiMFR8zh9+Dc8iSQJ6Ww32mmOgc 8JkabHTQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1opsbW-005csw-9G; Tue, 01 Nov 2022 14:51:02 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1opsVB-005Zhy-En for linux-mediatek@lists.infradead.org; Tue, 01 Nov 2022 14:44:31 +0000 X-UUID: f039952d394f42f8baa219a0159c18c6-20221101 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=R2LH7u+VlcONlDiOGNmmbHJG1mefnxFcstqMk9vb3xQ=; b=eL2PGgoa7cLL56nTdCnNGmkOv7VWLikyodiIC+utOVvioeqquXVVeDT5qB/g05Labc9bjjQFpv7CcsesfKwrutOzuu2blpqGCXHaR0EYCjT5TBXbSSUzDEVhrez287w3dxlMwCtyCzpqUSYCoFnDq/aNwPw/1DrKMI2nbWLP35A=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.12,REQID:f8e6e503-43ce-429c-9594-bf2e843713f2,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-5 X-CID-META: VersionHash:62cd327,CLOUDID:13604290-1a78-4832-bd08-74b1519dcfbf,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:11|1,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 X-UUID: f039952d394f42f8baa219a0159c18c6-20221101 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1499213929; Tue, 01 Nov 2022 07:44:15 -0700 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Tue, 1 Nov 2022 22:24:12 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Tue, 1 Nov 2022 22:24:11 +0800 From: To: , , , , , CC: , , , , , , , , , , , , , Subject: [PATCH v1] ufs: core: wlun suspend SSU fail recovery Date: Tue, 1 Nov 2022 22:24:10 +0800 Message-ID: <20221101142410.31463-1-peter.wang@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221101_074429_555357_991763DE X-CRM114-Status: GOOD ( 11.02 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Peter Wang When SSU fail in wlun suspend flow, trigger error handlder and return busy to break the suspend. If not, wlun runtime pm status become error and the consumer will stuck in runtime suspend status. Signed-off-by: Peter Wang --- drivers/ufs/core/ufshcd.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index b1f59a5fe632..2f2d3d5d8684 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -8970,6 +8970,7 @@ static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op) enum ufs_pm_level pm_lvl; enum ufs_dev_pwr_mode req_dev_pwr_mode; enum uic_link_state req_link_state; + unsigned long flags; hba->pm_op_in_progress = true; if (pm_op != UFS_SHUTDOWN_PM) { @@ -9049,8 +9050,21 @@ static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op) if (!hba->dev_info.b_rpm_dev_flush_capable) { ret = ufshcd_set_dev_pwr_mode(hba, req_dev_pwr_mode); - if (ret) + if (ret) { + /* + * If retrun err in suspend flow, IO will hang. + * Trigger error handler and break suspend for + * error recovery. + */ + spin_lock_irqsave(hba->host->host_lock, flags); + hba->force_reset = true; + ufshcd_schedule_eh_work(hba); + spin_unlock_irqrestore(hba->host->host_lock, + flags); + + ret = -EBUSY; goto enable_scaling; + } } }