public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: "Asutosh Das (asd)" <asutoshd@codeaurora.org>,
	"Martin K . Petersen" <martin.petersen@oracle.com>
Cc: "James E . J . Bottomley" <jejb@linux.ibm.com>,
	Bean Huo <huobean@gmail.com>, Avri Altman <avri.altman@wdc.com>,
	Can Guo <cang@codeaurora.org>,
	Bart Van Assche <bvanassche@acm.org>,
	linux-scsi@vger.kernel.org
Subject: Re: [PATCH 3/3] scsi: ufs: Let devices remain runtime suspended during system suspend
Date: Fri, 3 Sep 2021 12:55:24 +0300	[thread overview]
Message-ID: <0aef517c-d134-c0d7-8569-b45a9098336f@intel.com> (raw)
In-Reply-To: <0c162d36-6fb5-19e8-dce2-82156e83db4d@codeaurora.org>

On 2/09/21 8:07 pm, Asutosh Das (asd) wrote:
> On 9/2/2021 3:18 AM, Adrian Hunter wrote:
>> If the UFS Device WLUN is runtime suspended and is in the same power
>> mode, link state and b_rpm_dev_flush_capable (BKOP or WB buffer flush etc)
>> state, then it can remain runtime suspended instead of being runtime
>> resumed and then system suspended.
>>
>> The following patches have cleared the way for that to happen:
>>    scsi: ufs: Fix runtime PM dependencies getting broken
>>    scsi: ufs: Fix error handler clear ua deadlock
>>
>> So amend the logic accordingly.
>>
>> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
>> ---
>>   drivers/scsi/ufs/ufshcd.c | 45 ++++++++++++++++++++++++++++-----------
>>   drivers/scsi/ufs/ufshcd.h | 11 +++++++++-
>>   2 files changed, 43 insertions(+), 13 deletions(-)
>>
> Hi Adrian,
> Thanks for the change.
> 
>> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
>> index 57ed4b93b949..8e799e47e095 100644
>> --- a/drivers/scsi/ufs/ufshcd.c
>> +++ b/drivers/scsi/ufs/ufshcd.c
>> @@ -9722,13 +9722,29 @@ void ufshcd_resume_complete(struct device *dev)
>>           ufshcd_rpm_put(hba);
>>           hba->complete_put = false;
>>       }
>> -    if (hba->rpmb_complete_put) {
>> -        ufshcd_rpmb_rpm_put(hba);
>> -        hba->rpmb_complete_put = false;
>> -    }
>>   }
>>   EXPORT_SYMBOL_GPL(ufshcd_resume_complete);
>>   +static bool ufshcd_rpm_ok_for_spm(struct ufs_hba *hba)
>> +{
>> +    struct device *dev = &hba->sdev_ufs_device->sdev_gendev;
>> +    enum ufs_dev_pwr_mode dev_pwr_mode;
>> +    enum uic_link_state link_state;
>> +    unsigned long flags;
>> +    bool res;
>> +
> In the current ufshcd_suspend(), there's a ufshcd_vops_suspend().
> That's invoked for different pm_ops independent of the rpm_lvl and spm_lvl.
> I'm not sure if any vendor driver does different things for diff pm_op.
> Perhaps something to check.
> 

Good point.  The logic was that way before "scsi: ufs: core: Enable power
management for wlu" which was first in v5.14, so drivers should expect the
behaviour of this patch.  Checking shows only ufs-hisi does something
different but it sets different rpm_lvl and spm_lvl so wouldn't see any
change.  However I am sending a V2 patch that makes it explicit.

      reply	other threads:[~2021-09-03  9:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-23  5:01 [PATCH V2] scsi: ufs: Fix ufshcd_request_sense_async() for Samsung KLUFG8RHDA-B2D1 Adrian Hunter
2021-08-24  2:27 ` Bart Van Assche
2021-08-24  3:34 ` Martin K. Petersen
2021-08-24 11:34   ` Adrian Hunter
2021-08-24 11:41     ` [PATCH V3] " Adrian Hunter
2021-08-25  2:59       ` Martin K. Petersen
2021-08-28  2:31       ` Martin K. Petersen
2021-09-02 10:18     ` [PATCH 0/3] scsi: ufs: Let devices remain runtime suspended during system suspend Adrian Hunter
2021-09-02 10:18       ` [PATCH 1/3] scsi: ufs: Fix error handler clear ua deadlock Adrian Hunter
2021-09-02 16:53         ` Asutosh Das (asd)
2021-09-02 10:18       ` [PATCH 2/3] scsi: ufs: Fix runtime PM dependencies getting broken Adrian Hunter
2021-09-02 10:18       ` [PATCH 3/3] scsi: ufs: Let devices remain runtime suspended during system suspend Adrian Hunter
2021-09-02 17:07         ` Asutosh Das (asd)
2021-09-03  9:55           ` Adrian Hunter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0aef517c-d134-c0d7-8569-b45a9098336f@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=asutoshd@codeaurora.org \
    --cc=avri.altman@wdc.com \
    --cc=bvanassche@acm.org \
    --cc=cang@codeaurora.org \
    --cc=huobean@gmail.com \
    --cc=jejb@linux.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox