Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp477374pxj; Tue, 18 May 2021 07:36:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3tmZlG2QX+EltvNWvHim/IQ4oY44IdMFdLrnjDN685WmgE7rtX/DiJgKscqwnNJjkjwlZ X-Received: by 2002:a17:907:768c:: with SMTP id jv12mr6237895ejc.215.1621348577111; Tue, 18 May 2021 07:36:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621348577; cv=none; d=google.com; s=arc-20160816; b=QCGLpahPKd6ICKR7QevHwxY9xZRQ9auF5y61POEzzBkWnJdsS4XsKhYsISljPOa4Sm OiZXuUE0iSEWqWCFYawmsXGgWKnpTftqK3Hvgq9XOviqSpcxYorn6dqLYOwvJj2i6wdS kNF39GSVAbCYWB3TRYO2SD1sqZT9ezuS5NPcKZJ9i3oqpbMHrcf8epcebG339B6zKfVP joV+epU01oQM9p5UwkUUmV02uV7+g9G2iX40CctnuOghfYvr63KydJkhcJKMwgGVRNQ/ FlbpfVcQOYCxE5qoRo2W9DpHMubQ5YMpZWl46O5hrA9kKIxuuzDh8iPoGFlcRk8Dmnev AHPQ== 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=+49zIBZr9TnLj24s8Ktup69YY4SEh/yyAd0vUH9GFSs=; b=I6RgFG3zleAluNdDwcTeBOjrs3sAnYLVQLx58rLvmDjUEAxfVYumCYGeHm01GutPF8 hRKtet6Cz+J9ZqMP/CCutQFLZBRYtRHQLushFWKK+nZ/8cxLsZE5RiuawIP/NdzC5BCS YXtCRhVutVT+7ShSxIJXDFgj4U6T4+XFKPQ+YyfSBtu5KY/fge1lSu1bOFAG6LV+Yetb It3LK3hOccYg5ZLo01++wUXg1Z5AALCpEn8Y0gLOpTgYtSE/6nzd60mb21Vywu+MFpDi DOjI0i0Otl4VpbUzcYldyIrlDpFMZA/lYT2fgpj9C4op5QcP+9QczL/oF3Q869qFiiWD MALg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QOuNlq4v; 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 i2si20534145ejp.181.2021.05.18.07.35.30; Tue, 18 May 2021 07:36:17 -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=QOuNlq4v; 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 S1344793AbhEQPpk (ORCPT + 99 others); Mon, 17 May 2021 11:45:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:54786 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245632AbhEQPaJ (ORCPT ); Mon, 17 May 2021 11:30:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EBFE161CC1; Mon, 17 May 2021 14:37:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262269; bh=VrR76pLZ+PQN9Iov+6KaVPII1v04yjMZZctWDmDLF9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QOuNlq4vZv1o0UPBMCzs91ULrRaRXXT+PdWw7dnAD5nSN0HqW8JCdaFUsZ6XKopEQ 6Oy03hDTZRWdESYRj87xxpzsD0sNYFUIynCRKd5PihJiaU8eEhk7X5ffFxI4R7sGk8 foLpn3EqVpSEptzitAsCpM1VivSJHNWAmgaMXImk= 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.10 141/289] scsi: ufs: core: Do not put UFS power into LPM if link is broken Date: Mon, 17 May 2021 16:01:06 +0200 Message-Id: <20210517140309.896540260@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@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 4215d9a8e5de..d1900ea31b0d 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -8459,7 +8459,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); } @@ -8481,7 +8481,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