2020-12-22 07:31:36

by Stanley Chu

[permalink] [raw]
Subject: [PATCH v2 0/2] scsi: ufs: Fix power drain and hci quirk for WriteBooster

Hi,
This series fixes two WriteBooster issues,
1. Fix a corner case that device flush capability is not disabled during system suspend
2. Fix the checking of UFSHCI quirk UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL

Stanley Chu (2):
scsi: ufs: Fix possible power drain during system suspend
scsi: ufs: Relax the condition of
UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL

drivers/scsi/ufs/ufshcd.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

--
2.18.0


2020-12-22 07:32:20

by Stanley Chu

[permalink] [raw]
Subject: [PATCH v2 2/2] scsi: ufs: Relax the condition of UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL

UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL is aimed to skip enabling
fWriteBoosterBufferFlushEn while WriteBooster is initializing.
Therefore it is better to apply the checking during WriteBooster
initialization only.

Signed-off-by: Stanley Chu <[email protected]>
---
drivers/scsi/ufs/ufshcd.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 9d61dc3eb842..e50b19925236 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -289,7 +289,8 @@ static inline void ufshcd_wb_config(struct ufs_hba *hba)
if (ret)
dev_err(hba->dev, "%s: En WB flush during H8: failed: %d\n",
__func__, ret);
- ufshcd_wb_toggle_flush(hba, true);
+ if (!(hba->quirks & UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL))
+ ufshcd_wb_toggle_flush(hba, true);
}

static void ufshcd_scsi_unblock_requests(struct ufs_hba *hba)
@@ -5401,9 +5402,6 @@ static int ufshcd_wb_toggle_flush_during_h8(struct ufs_hba *hba, bool set)

static inline void ufshcd_wb_toggle_flush(struct ufs_hba *hba, bool enable)
{
- if (hba->quirks & UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL)
- return;
-
if (enable)
ufshcd_wb_buf_flush_enable(hba);
else
--
2.18.0

2020-12-22 11:36:44

by Can Guo

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] scsi: ufs: Relax the condition of UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL

On 2020-12-22 15:29, Stanley Chu wrote:
> UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL is aimed to skip enabling
> fWriteBoosterBufferFlushEn while WriteBooster is initializing.
> Therefore it is better to apply the checking during WriteBooster
> initialization only.
>
> Signed-off-by: Stanley Chu <[email protected]>
> ---
> drivers/scsi/ufs/ufshcd.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 9d61dc3eb842..e50b19925236 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -289,7 +289,8 @@ static inline void ufshcd_wb_config(struct ufs_hba
> *hba)
> if (ret)
> dev_err(hba->dev, "%s: En WB flush during H8: failed: %d\n",
> __func__, ret);
> - ufshcd_wb_toggle_flush(hba, true);
> + if (!(hba->quirks & UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL))
> + ufshcd_wb_toggle_flush(hba, true);
> }
>
> static void ufshcd_scsi_unblock_requests(struct ufs_hba *hba)
> @@ -5401,9 +5402,6 @@ static int
> ufshcd_wb_toggle_flush_during_h8(struct ufs_hba *hba, bool set)
>
> static inline void ufshcd_wb_toggle_flush(struct ufs_hba *hba, bool
> enable)
> {
> - if (hba->quirks & UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL)
> - return;
> -
> if (enable)
> ufshcd_wb_buf_flush_enable(hba);
> else

Thanks for the change, I was thinking about the same.

Reviewed-by: Can Guo <[email protected]>

2021-01-08 04:22:53

by Martin K. Petersen

[permalink] [raw]
Subject: Re: [PATCH v2 0/2] scsi: ufs: Fix power drain and hci quirk for WriteBooster

On Tue, 22 Dec 2020 15:29:03 +0800, Stanley Chu wrote:

> This series fixes two WriteBooster issues,
> 1. Fix a corner case that device flush capability is not disabled during system suspend
> 2. Fix the checking of UFSHCI quirk UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL
>
> Stanley Chu (2):
> scsi: ufs: Fix possible power drain during system suspend
> scsi: ufs: Relax the condition of
> UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL
>
> [...]

Applied to 5.11/scsi-fixes, thanks!

[1/2] scsi: ufs: Fix possible power drain during system suspend
https://git.kernel.org/mkp/scsi/c/1d53864c3617
[2/2] scsi: ufs: Relax the condition of UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL
https://git.kernel.org/mkp/scsi/c/21acf4601cc6

--
Martin K. Petersen Oracle Linux Engineering