* [PATCH] scsi: ufs: Check for bkops in runtime suspend
@ 2021-04-18 7:21 Avri Altman
2021-04-18 17:51 ` Adrian Hunter
0 siblings, 1 reply; 3+ messages in thread
From: Avri Altman @ 2021-04-18 7:21 UTC (permalink / raw)
To: James E . J . Bottomley, Martin K . Petersen, linux-scsi,
Adrian Hunter
Cc: linux-kernel, Avri Altman, Alex Lemberg
The UFS driver allowed BKOPS and WB Flush operations to be completed on
Runtime suspend. Adding the DeepSleep support, this is no longer true:
the driver will ignore BKOPS and WB Flush states, and force a link state
transition to UIC_LINK_OFF_STATE.
Do not ignore BKOPS and WB Flush on runtme suspend flow.
fixes: fe1d4c2ebcae (scsi: ufs: Add DeepSleep feature)
Suggested-by: Alex Lemberg <alex.lemberg@wdc.com>
Signed-off-by: Avri Altman <avri.altman@wdc.com>
---
drivers/scsi/ufs/ufshcd.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 58d7f264c664..1a0cac670aba 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -8755,7 +8755,8 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
* In the case of DeepSleep, the device is expected to remain powered
* with the link off, so do not check for bkops.
*/
- check_for_bkops = !ufshcd_is_ufs_dev_deepsleep(hba);
+ check_for_bkops = !ufshcd_is_ufs_dev_deepsleep(hba) ||
+ hba->dev_info.b_rpm_dev_flush_capable;
ret = ufshcd_link_state_transition(hba, req_link_state, check_for_bkops);
if (ret)
goto set_dev_active;
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] scsi: ufs: Check for bkops in runtime suspend
2021-04-18 7:21 [PATCH] scsi: ufs: Check for bkops in runtime suspend Avri Altman
@ 2021-04-18 17:51 ` Adrian Hunter
2021-04-18 18:25 ` Avri Altman
0 siblings, 1 reply; 3+ messages in thread
From: Adrian Hunter @ 2021-04-18 17:51 UTC (permalink / raw)
To: Avri Altman, James E . J . Bottomley, Martin K . Petersen,
linux-scsi
Cc: linux-kernel, Alex Lemberg
On 18/04/21 10:21 am, Avri Altman wrote:
> The UFS driver allowed BKOPS and WB Flush operations to be completed on
> Runtime suspend. Adding the DeepSleep support, this is no longer true:
> the driver will ignore BKOPS and WB Flush states, and force a link state
> transition to UIC_LINK_OFF_STATE.
>
> Do not ignore BKOPS and WB Flush on runtme suspend flow.
>
> fixes: fe1d4c2ebcae (scsi: ufs: Add DeepSleep feature)
>
> Suggested-by: Alex Lemberg <alex.lemberg@wdc.com>
> Signed-off-by: Avri Altman <avri.altman@wdc.com>
> ---
> drivers/scsi/ufs/ufshcd.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 58d7f264c664..1a0cac670aba 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -8755,7 +8755,8 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
> * In the case of DeepSleep, the device is expected to remain powered
> * with the link off, so do not check for bkops.
> */
> - check_for_bkops = !ufshcd_is_ufs_dev_deepsleep(hba);
> + check_for_bkops = !ufshcd_is_ufs_dev_deepsleep(hba) ||
> + hba->dev_info.b_rpm_dev_flush_capable;
Can you explain this some more? If hba->dev_info.b_rpm_dev_flush_capable
is true, then ufshcd_set_dev_pwr_mode() was not called, so
ufshcd_is_ufs_dev_deepsleep() is false i.e. the same result for the
condition above.
However, it is assumed DeepSleep has the link off so that a full reset
and restore is done upon resume, which is necessary to exit DeepSleep.
So if you wanted to have DeepSleep with the link on, then the resume
logic would also need changes.
> ret = ufshcd_link_state_transition(hba, req_link_state, check_for_bkops);
> if (ret)
> goto set_dev_active;
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] scsi: ufs: Check for bkops in runtime suspend
2021-04-18 17:51 ` Adrian Hunter
@ 2021-04-18 18:25 ` Avri Altman
0 siblings, 0 replies; 3+ messages in thread
From: Avri Altman @ 2021-04-18 18:25 UTC (permalink / raw)
To: Adrian Hunter, James E . J . Bottomley, Martin K . Petersen,
linux-scsi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Alex Lemberg
> On 18/04/21 10:21 am, Avri Altman wrote:
> > The UFS driver allowed BKOPS and WB Flush operations to be completed on
> > Runtime suspend. Adding the DeepSleep support, this is no longer true:
> > the driver will ignore BKOPS and WB Flush states, and force a link state
> > transition to UIC_LINK_OFF_STATE.
> >
> > Do not ignore BKOPS and WB Flush on runtme suspend flow.
> >
> > fixes: fe1d4c2ebcae (scsi: ufs: Add DeepSleep feature)
> >
> > Suggested-by: Alex Lemberg <alex.lemberg@wdc.com>
> > Signed-off-by: Avri Altman <avri.altman@wdc.com>
> > ---
> > drivers/scsi/ufs/ufshcd.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> > index 58d7f264c664..1a0cac670aba 100644
> > --- a/drivers/scsi/ufs/ufshcd.c
> > +++ b/drivers/scsi/ufs/ufshcd.c
> > @@ -8755,7 +8755,8 @@ static int ufshcd_suspend(struct ufs_hba *hba,
> enum ufs_pm_op pm_op)
> > * In the case of DeepSleep, the device is expected to remain powered
> > * with the link off, so do not check for bkops.
> > */
> > - check_for_bkops = !ufshcd_is_ufs_dev_deepsleep(hba);
> > + check_for_bkops = !ufshcd_is_ufs_dev_deepsleep(hba) ||
> > + hba->dev_info.b_rpm_dev_flush_capable;
>
> Can you explain this some more? If hba->dev_info.b_rpm_dev_flush_capable
> is true, then ufshcd_set_dev_pwr_mode() was not called, so
> ufshcd_is_ufs_dev_deepsleep() is false i.e. the same result for the
> condition above.
You are correct. Sorry for the confusion.
>
> However, it is assumed DeepSleep has the link off so that a full reset
> and restore is done upon resume, which is necessary to exit DeepSleep.
> So if you wanted to have DeepSleep with the link on, then the resume
> logic would also need changes.
No need. We just wanted to verify that on runtime suspend, if bkops is allowed and required,
The device will get the extra idle time it needs.
As this is the case, no change is needed and I will just drop it.
Again, sorry for the confusion.
Thanks,
Avri
>
> > ret = ufshcd_link_state_transition(hba, req_link_state, check_for_bkops);
> > if (ret)
> > goto set_dev_active;
> >
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-04-18 18:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-18 7:21 [PATCH] scsi: ufs: Check for bkops in runtime suspend Avri Altman
2021-04-18 17:51 ` Adrian Hunter
2021-04-18 18:25 ` Avri Altman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox