RE: [EXT] [PATCH v1 1/3] scsi: ufs: fix empty check of error history

From: Stanley Chu
Date: Mon Jan 13 2020 - 04:44:06 EST


Hi Bean,

On Mon, 2020-01-13 at 09:28 +0000, Bean Huo (beanhuo) wrote:
> Hi, Stanley
>
> >
> > Currently checking if an error history element is empty or not is by its "value". In
> > most cases, value is error code.
> >
> > However this checking is not correct because some errors or events do not
> > specify any values in error history so values remain as 0, and this will lead to
> > incorrect empty checking.
> >
> Do you think this is a bug of UFS host controller? According to the UFS host Spec,
> If there had error detected in each layer, at least bit31 in its error code register
> Should be set to 1.
>
> Why there was an error happening, but host didn't set this bit31?
>

Thanks so much for review.

Yes, the case bit[31] set is true for UIC errors.

However the users of UFS error history, i.e., users of
ufshcd_update_reg_hlist(), are not only UIC errors. Some other essential
events will update history too, for example, device reset events and
abort events.

Take "device reset events" as example: parameter "val" may be 0 while
invoking ufshcd_update_reg_hlist(). If this happens, the device reset
event will not be printed out because its err_hist->reg[p] is 0
according to the original logic in ufshcd_print_err_hist().

Feel free to correct above description if it is wrong.

Thanks,
Stanley