Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp59850pxu; Thu, 3 Dec 2020 19:30:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJzS1C9KkLp7OSoL7Mu4kSs+qf+jSGk+B3TPWvFPpow/0cC6cEwHAzNCztYXklURpPFUJBND X-Received: by 2002:a05:6402:149a:: with SMTP id e26mr5699057edv.232.1607052603184; Thu, 03 Dec 2020 19:30:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607052603; cv=none; d=google.com; s=arc-20160816; b=VG/yOhNh9D8zJUo6mMHnPjfbbfFwq83xSze4JQiLI6V51zh8PzMPlTV/rzG2eLEv4t HrL3DXp9aSWmz09EjDoyn6omBIOnBebl8oj37rE/InXe2zG2HnqkH1icR2xfbjy8Fnp0 LK6CoJ55soVVah4Uk8v18tGfA1UbIUXzdFddGhcCpaSzeYkQ8tJLoCSsMrJeMo6UqEln J0he9jvswePhMzSB2YibRCteQzuWF1v9MYWbwXvXyfBoipw3MGKcHu64t+A0JeExZKIq r00Cld+gK0md3T3EL4F52bI7X8HXsJRLpc198PCQsKXWSrltlWC+jPu85Yu9GHD/1foh smxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:message-id:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version :sender:dkim-signature; bh=aiTONYRNd6Usbi2ahCG39HakveG8khxqD02yr5/luQs=; b=xTuY3xHmZ7iwZGqRv3ejqS8QLZyKvoYia5H/+hG7Z9gvYtO82I2VnsJFgMwpiJCd1T AEVjoA42elWU7fMnsOCu/dVcJpsKFZjvZ867GLCrBG+jw1xGxx+Y0bhmBBPy5QSnqyc2 d1nqJl1IL3Fa5sSGTnI0wWv3718xrc+L50TZyO0VckBoHoUlIJ0lALBePJAKnr/b/WTl +5JY57f5Y1SHLmQwwG8SIQjF3Wt9NbFw/G44Sq9uakukjBeO2j3raLbyFGwz2ueqULVv CDR+u98ucdakSQc8cQBLpiZWEnOAuO6mmdTW8QlxTSNg7z0Kbp+ai/TzbqGjo7DJlnBE 3vKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=FvJOtQE1; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m26si2453016edp.318.2020.12.03.19.29.40; Thu, 03 Dec 2020 19:30:03 -0800 (PST) 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=@mg.codeaurora.org header.s=smtp header.b=FvJOtQE1; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727714AbgLDD1D (ORCPT + 99 others); Thu, 3 Dec 2020 22:27:03 -0500 Received: from m43-15.mailgun.net ([69.72.43.15]:45259 "EHLO m43-15.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727680AbgLDD1D (ORCPT ); Thu, 3 Dec 2020 22:27:03 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1607052404; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=aiTONYRNd6Usbi2ahCG39HakveG8khxqD02yr5/luQs=; b=FvJOtQE1+syXeBEyoKJdiUXk8R4Pxq10TP4H+zKFR+7OkLNRmtAcECzX+pB/dmc6ghHlhZvl 7EmriMrP+jZLiVghdQI8SNNXciBWRdxN6guLXjmMujR79W0iQdIHT9G8uMl+PvPgkgercA5X j15aGWKAlbAWJy/z58l/g9Geik4= X-Mailgun-Sending-Ip: 69.72.43.15 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n09.prod.us-east-1.postgun.com with SMTP id 5fc9ac5856444c64457f01d0 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Fri, 04 Dec 2020 03:26:16 GMT Sender: cang=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id CF459C43465; Fri, 4 Dec 2020 03:26:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: cang) by smtp.codeaurora.org (Postfix) with ESMTPSA id C9BA1C433CA; Fri, 4 Dec 2020 03:26:14 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 04 Dec 2020 11:26:14 +0800 From: Can Guo To: Bean Huo Cc: alim.akhtar@samsung.com, avri.altman@wdc.com, asutoshd@codeaurora.org, jejb@linux.ibm.com, martin.petersen@oracle.com, stanley.chu@mediatek.com, beanhuo@micron.com, bvanassche@acm.org, tomas.winkler@intel.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/3] scsi: ufs: Keep device power on only fWriteBoosterBufferFlushDuringHibernate == 1 In-Reply-To: <20201130181143.5739-3-huobean@gmail.com> References: <20201130181143.5739-1-huobean@gmail.com> <20201130181143.5739-3-huobean@gmail.com> Message-ID: X-Sender: cang@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-12-01 02:11, Bean Huo wrote: > From: Bean Huo > > Keep device power mode as active power mode and VCC supply only if > fWriteBoosterBufferFlushDuringHibernate setting 1 is successful. > > Signed-off-by: Bean Huo > --- > drivers/scsi/ufs/ufs.h | 2 ++ > drivers/scsi/ufs/ufshcd.c | 11 ++++++++++- > 2 files changed, 12 insertions(+), 1 deletion(-) > > diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h > index d593edb48767..311d5f7a024d 100644 > --- a/drivers/scsi/ufs/ufs.h > +++ b/drivers/scsi/ufs/ufs.h > @@ -530,6 +530,8 @@ struct ufs_dev_info { > bool f_power_on_wp_en; > /* Keeps information if any of the LU is power on write protected */ > bool is_lu_power_on_wp; > + /* Indicates if flush WB buffer during hibern8 successfully enabled > */ > + bool is_hibern8_wb_flush; > /* Maximum number of general LU supported by the UFS device */ > u8 max_lu_supported; > u8 wb_dedicated_lu; > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c > index 639ba9d1ccbb..eb7a2534b072 100644 > --- a/drivers/scsi/ufs/ufshcd.c > +++ b/drivers/scsi/ufs/ufshcd.c > @@ -285,10 +285,16 @@ static inline void ufshcd_wb_config(struct > ufs_hba *hba) > dev_err(hba->dev, "%s: Enable WB failed: %d\n", __func__, ret); > else > dev_info(hba->dev, "%s: Write Booster Configured\n", __func__); > + > ret = ufshcd_wb_toggle_flush_during_h8(hba, true); > - if (ret) > + if (ret) { > dev_err(hba->dev, "%s: En WB flush during H8: failed: %d\n", > __func__, ret); > + hba->dev_info.is_hibern8_wb_flush = false; > + } else { > + hba->dev_info.is_hibern8_wb_flush = true; > + } > + > ufshcd_wb_toggle_flush(hba, true); > } > > @@ -5440,6 +5446,9 @@ static bool ufshcd_wb_need_flush(struct ufs_hba > *hba) > > if (!ufshcd_is_wb_allowed(hba)) > return false; > + > + if (!hba->dev_info.is_hibern8_wb_flush) > + return false; The check is in the wrong place - even if say fWriteBoosterBufferFlushDuringHibernate is failed to be enabled, ufshcd_wb_need_flush() still needs to reflect the fact that whether the wb buffer needs to be flushed or not - it should not be decided by the flag. Thanks, Can Guo. > /* > * The ufs device needs the vcc to be ON to flush. > * With user-space reduction enabled, it's enough to enable flush