Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3064576pxj; Mon, 17 May 2021 16:52:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdZX2LMC1FNj4Dd+179mO/92MgsORKyL/zdM0gRXxTO8zH2OAatFoEDWxAT3YNDRJ2B9la X-Received: by 2002:aa7:d491:: with SMTP id b17mr3380761edr.376.1621295536051; Mon, 17 May 2021 16:52:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621295536; cv=none; d=google.com; s=arc-20160816; b=ckMSCcbslxZD7MF6fR6LypaylP27fphiQKuMbPornt+YiucJM3xaTwcLmYnSC7/g+c vAtHCPrd1urSbqeJr+TXLDSRCvjNon8FM8ZfPIO4ZspkU4uXHoB1ykN4WX9nzSP4W8DA T/C0wqcFZXQdePtxuKf+Cu32tkoSwaiNFjKF3cYkHbTsPNuB16kP3hEJ0h1k9JOPvmMa JtO30cO+LZVoEHnqERp9dgOa03Ta8HK9ferCEa7ZSU/JNjUQrTgxLiaXYZJV/i2l5U5I 9hj6zLUsfPAjPcY+yoCvtXZANltFwqMU2MH8chFLzXLKHD6mXEuLMdLhLRFB+cru05bu 1WVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0oeROxDbACdOZtR1mYQ2826DXA+LGidPjV/j5rSNcPE=; b=dn4vUUsPSTJ9q1e+K6JimPz2nrovgRWVG1bjifvEtbc+ZCvAHwWKxzOCBGPZKYzMWH K4UNJsfxxAhoh1CxhsKOjagr40ChN53LzGcd1KGf6OUvQBXOPTm8imVqFZrLY3Xpq61S f6g5cm3Jijw1bxDAgj1VGdaEjBEfOfJBXivKq4uvYpgGm8JODrbRUF8LYKaG06bRloF+ O2IB1XO1oWhTEdO37upMG5OeVVIGQfJoRimgGMmxZ8WmVinQ5MMYo+4ubRCj0W4VXk9O N3VaCxcrUYaxADHosk+xZJICBdU9hjwmr8J+A+PX3uqE99YO34iuGdahxs2o4TfofJke JaLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kQnwoL1F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g16si16151860ejm.224.2021.05.17.16.51.30; Mon, 17 May 2021 16:52:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kQnwoL1F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238017AbhEQOXs (ORCPT + 99 others); Mon, 17 May 2021 10:23:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:35958 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239495AbhEQOUY (ORCPT ); Mon, 17 May 2021 10:20:24 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B7B9E6143F; Mon, 17 May 2021 14:11:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621260671; bh=q+NDYdM015FzMXxKuIKBHYMq0mKyVVw0IJE+QUekTBI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kQnwoL1FMhRdrjjrTILC8PbNplQoFRM6Nxzm5OgSLK8gQ5jG2eNp1cBdWQkABdL9u gaYjiTaDAapXF7helnKmTyqMstYHDCbfLIdxqimeZxyvefx2LSMmPnDY4l9oKg/zfZ /5KT3OUGeO55jDHgwiosSiKX6wMCGMCUANSP8Kr0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daejun Park , Can Guo , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.12 188/363] scsi: ufs: core: Do not put UFS power into LPM if link is broken Date: Mon, 17 May 2021 16:00:54 +0200 Message-Id: <20210517140308.952776134@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Can Guo [ Upstream commit 23043dd87b153d02eaf676e752d32429be5e5126 ] During resume, if link is broken due to AH8 failure, make sure ufshcd_resume() does not put UFS power back into LPM. Link: https://lore.kernel.org/r/1619408921-30426-2-git-send-email-cang@codeaurora.org Fixes: 4db7a2360597 ("scsi: ufs: Fix concurrency of error handler and other error recovery paths") Reviewed-by: Daejun Park Signed-off-by: Can Guo Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- 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 d3d05e997c13..fed32517d7d1 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -8599,7 +8599,7 @@ static void ufshcd_vreg_set_lpm(struct ufs_hba *hba) } else if (!ufshcd_is_ufs_dev_active(hba)) { ufshcd_toggle_vreg(hba->dev, hba->vreg_info.vcc, false); vcc_off = true; - if (!ufshcd_is_link_active(hba)) { + if (ufshcd_is_link_hibern8(hba) || ufshcd_is_link_off(hba)) { ufshcd_config_vreg_lpm(hba, hba->vreg_info.vccq); ufshcd_config_vreg_lpm(hba, hba->vreg_info.vccq2); } @@ -8621,7 +8621,7 @@ static int ufshcd_vreg_set_hpm(struct ufs_hba *hba) !hba->dev_info.is_lu_power_on_wp) { ret = ufshcd_setup_vreg(hba, true); } else if (!ufshcd_is_ufs_dev_active(hba)) { - if (!ret && !ufshcd_is_link_active(hba)) { + if (!ufshcd_is_link_active(hba)) { ret = ufshcd_config_vreg_hpm(hba, hba->vreg_info.vccq); if (ret) goto vcc_disable; -- 2.30.2