RE: [PATCH v2] scsi: ufs: core: call hibern8 notify when hibern8 cmd failed
From: Fang Hongjie(方洪杰)
Date: Wed Apr 29 2026 - 22:42:57 EST
> From: Bart Van Assche [mailto:bvanassche@xxxxxxx]
> Sent: Thursday, April 30, 2026 12:23 AM
> To: Fang Hongjie <hongjiefang@xxxxxxxxxxxx>;
> alim.akhtar@xxxxxxxxxxx; avri.altman@xxxxxxx;
> James.Bottomley@xxxxxxxxxxxxxxxxxxxxx; martin.petersen@xxxxxxxxxx
> Cc: linux-scsi@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH v2] scsi: ufs: core: call hibern8 notify when hibern8 cmd
> failed
>
> On 4/29/26 4:23 AM, Hongjie Fang wrote:
> > diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
> > index 8563b6648976..c1cb30d8aa4a 100644
> > --- a/include/ufs/ufshcd.h
> > +++ b/include/ufs/ufshcd.h
> > @@ -355,7 +355,8 @@ struct ufs_hba_variant_ops {
> > bool is_scsi_cmd);
> > void (*setup_task_mgmt)(struct ufs_hba *, int, u8);
> > void (*hibern8_notify)(struct ufs_hba *, enum uic_cmd_dme,
> > - enum ufs_notify_change_status);
> > + enum ufs_notify_change_status,
> > + int cmd_ret);
> > int (*apply_dev_quirks)(struct ufs_hba *hba);
> > void (*fixup_dev_quirks)(struct ufs_hba *hba);
> > int (*suspend)(struct ufs_hba *, enum ufs_pm_op,
>
> Passing the full 'cmd_ret' value to the hibern8_notify vendor operation
> may make the UFS driver harder to maintain than necessary.
> Implementations of this vendor operation may test for specific values of
> 'cmd_ret'. Hence, when making any change in the code that calls
> .hibern8_notify() regarding the return value, all implementations of
> .hibern8_notify() would have to be reviewed.
>
> Has it been considered to add a third value in enum
> ufs_notify_change_status, e.g. ROLLBACK_CHANGE? That should be
> sufficient for hibern8_notify implementations, isn't it?
>
Adding a third enum value to handle this is the more reasonable approach.
This would not affect the existing vendor implementations,
and the change would be confined to internal functions within the ufs core.
Pass `ROLLBACK_CHANGE` when the hibern8 command returns a failure,
and use `POST_CHANGE` otherwise.
> Thanks,
>
> Bart.
Best.