[PATCH v1 01/10] ufs: host: mediatek: Fix runtime suspend error deadlock

Bart Van Assche bvanassche at acm.org
Mon Sep 22 11:27:55 PDT 2025


On 9/22/25 1:37 AM, Peter Wang (王信友) wrote:
> Okay, you prefer to check pm_op_in_progress before getting
> runtime PM, like below patch?
> If yes, I will remove this patch and check this in ufs core.
> 
> @@ -6625,6 +6625,11 @@ static void ufshcd_err_handler(struct
> work_struct *work)
>          }
>          spin_unlock_irqrestore(hba->host->host_lock, flags);
> 
> +       if (hba->pm_op_in_progress) {
> +               ufshcd_link_recovery(hba);
> +               return;
> +       }
> +
>          ufshcd_err_handling_prepare(hba);

Yes, the above change is what I prefer. Please note that I haven't
tested this change myself.
>>>> The UFSHCD_EH_IN_PROGRESS definition and also the
>>>> ufshcd_set_eh_in_progress() and ufshcd_clear_eh_in_progress()
>>>> definitions must remain in the UFS core private code. Please do
>>>> not
>>>> move
>>>> these definitions into the include/ufs/ufshcd.h header file.
>>>
>>> Do you think we should check ufshcd_eh_in_progress in
>>> __ufshcd_wl_suspend? I'm not sure, because we don't see this
>>> error on all UFS hosts — the vendor suspend operations
>>> (ufshcd_vops_suspend) could be different.
>>
>> Why is auto-hibernation disabled during suspend? As far as I know the
>> UFSHCI standard allows to keep auto-hibernation enabled during
>> suspend.
> 
> This is a limitation of MediaTek’s SoC.
> If auto-hibernate is triggered concurrently with manual
> hibernate, it may cause errors. Therefore, we disable
> auto-hibernate before issuing a manual hibernate command.

How about adding a comment that explains this?

Thanks,

Bart.



More information about the Linux-mediatek mailing list