diff mbox series

[v10,13/18] scsi: ufs: mediatek: Rework the code for disabling auto-hibernation

Message ID 20230818193546.2014874-14-bvanassche@acm.org (mailing list archive)
State New, archived
Headers show
Series Improve performance for zoned UFS devices | expand

Commit Message

Bart Van Assche Aug. 18, 2023, 7:34 p.m. UTC
Call ufshcd_auto_hibern8_update() instead of writing directly into the
auto-hibernation control register. This patch is part of an effort to
move all auto-hibernation register changes into the UFSHCI driver core.

Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: Can Guo <quic_cang@quicinc.com>
Cc: Avri Altman <avri.altman@wdc.com>
Cc: Bao D. Nguyen <quic_nguyenb@quicinc.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/ufs/host/ufs-mediatek.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bao D. Nguyen Aug. 18, 2023, 9:11 p.m. UTC | #1
On 8/18/2023 12:34 PM, Bart Van Assche wrote:
> Call ufshcd_auto_hibern8_update() instead of writing directly into the
> auto-hibernation control register. This patch is part of an effort to
> move all auto-hibernation register changes into the UFSHCI driver core.
> 

Reviewed-by: Bao D. Nguyen <quic_nguyenb@quicinc.com>
Peter Wang (王信友) Aug. 22, 2023, 9:20 a.m. UTC | #2
Hi Bart,

Cannot call ufshcd_auto_hibern8_update here.
ufshcd_auto_hibern8_update will get runtime pm.
but
ufs_mtk_auto_hibern8_disable only used in runtime suspend flow.
So, call ufshcd_auto_hibern8_update will get deadlock to wait runtime
resume.

Thanks.
Peter 



On Fri, 2023-08-18 at 12:34 -0700, Bart Van Assche wrote:
> Call ufshcd_auto_hibern8_update() instead of writing directly into
> the
> auto-hibernation control register. This patch is part of an effort to
> move all auto-hibernation register changes into the UFSHCI driver
> core.
> 
> Cc: Martin K. Petersen <martin.petersen@oracle.com>
> Cc: Can Guo <quic_cang@quicinc.com>
> Cc: Avri Altman <avri.altman@wdc.com>
> Cc: Bao D. Nguyen <quic_nguyenb@quicinc.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> Reviewed-by: Bao D. Nguyen <quic_nguyenb@quicinc.com>
> ---
>  drivers/ufs/host/ufs-mediatek.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-
> mediatek.c
> index e68b05976f9e..266898a877b0 100644
> --- a/drivers/ufs/host/ufs-mediatek.c
> +++ b/drivers/ufs/host/ufs-mediatek.c
> @@ -1252,7 +1252,7 @@ static void ufs_mtk_auto_hibern8_disable(struct
> ufs_hba *hba)
>  	int ret;
>  
>  	/* disable auto-hibern8 */
> -	ufshcd_writel(hba, 0, REG_AUTO_HIBERNATE_IDLE_TIMER);
> +	WARN_ON_ONCE(ufshcd_auto_hibern8_update(hba, 0) != 0);
>  
>  	/* wait host return to idle state when auto-hibern8 off */
>  	ufs_mtk_wait_idle_state(hba, 5);
Bart Van Assche Aug. 22, 2023, 3:54 p.m. UTC | #3
On 8/22/23 02:20, Peter Wang (王信友) wrote:
> Cannot call ufshcd_auto_hibern8_update here.
> ufshcd_auto_hibern8_update will get runtime pm.
> but
> ufs_mtk_auto_hibern8_disable only used in runtime suspend flow.
> So, call ufshcd_auto_hibern8_update will get deadlock to wait runtime
> resume.

Hi Peter,

Thanks for the feedback. I'm going to drop this patch and also ufs-hisi
patch. Although that will lead to suboptimal performance if the user
enables auto-hibernation, users can achieve full performance for small
zoned writes by disabling auto-hibernation through sysfs.

Thanks,

Bart.
diff mbox series

Patch

diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c
index e68b05976f9e..266898a877b0 100644
--- a/drivers/ufs/host/ufs-mediatek.c
+++ b/drivers/ufs/host/ufs-mediatek.c
@@ -1252,7 +1252,7 @@  static void ufs_mtk_auto_hibern8_disable(struct ufs_hba *hba)
 	int ret;
 
 	/* disable auto-hibern8 */
-	ufshcd_writel(hba, 0, REG_AUTO_HIBERNATE_IDLE_TIMER);
+	WARN_ON_ONCE(ufshcd_auto_hibern8_update(hba, 0) != 0);
 
 	/* wait host return to idle state when auto-hibern8 off */
 	ufs_mtk_wait_idle_state(hba, 5);