Retry the full device init on fatal link loss
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest2 patches 0 repliesNew
- v22 patches 1 replySuperseded
- v11 patch 2 repliesSuperseded
Changes in v3 from the cover letter
- Stop the controller before draining the error handler and clearing the error state, so that no interrupt can re-latch errors or schedule the error handler during the cleanup(sashiko)
- Remove the hwmon device and reset the exception event masks between retries, since the device reset wipes their state on the device side; also remove the hwmon device on the init failure path(sashiko)
- Only restore the MCQ mode after the controller re-enable and let the next attempt configure the queues(sashiko)
- Take the address of the by-value host_lock for spin_lock_irqsave()(sashiko)
Patches in v3 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | scsi: ufs: core: Move the device initialization sequence into a new functiondrivers/ | +50 | 0 replies | |
| 2/2 | scsi: ufs: core: Retry the full device init on fatal link lossdrivers/ | +59 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.
Cover letter [PATCH v3 0/2] Retry the full device init on fatal link loss
On an RK3572 board the UFS device is sometimes reported dead during the initialization at boot: DEVICE_FATAL_ERROR | UIC_LINK_LOST is latched and the following UIC query fails with -EIO, leaving the device unusable.
[ 2.784068][ C0] ufshcd-rockchip 2a2d0000.ufs: ufshcd_check_errors: saved_err 0x880 saved_uic_err 0x0 [ 2.784112][ C0] host_regs: 00000000: 0187011f 00000000 00000200 00000000 [ 2.784125][ C0] host_regs: 00000010: 00000000 000005e6 00000000 00000000 [ 2.784137][ C0] host_regs: 00000020: 00000000 00031ef5 00000000 00000000 [ 2.784148][ C0] host_regs: 00000030: 00000008 00000001 00000000 00000000 [ 2.784159][ C0] host_regs: 00000040: 00000000 00000000 00000000 00000000 [ 2.784170][ C0] host_regs: 00000050: 02dd3000 00000001 00000000 00000000 [ 2.784182][ C0] host_regs: 00000060: 00000000 00000000 00000000 00000000 [ 2.784193][ C0] host_regs: 00000070: 02dd4000 00000001 00000000 00000000 [ 2.784204][ C0] host_regs: 00000080: 00000000 00000000 00000000 00000000 [ 2.784215][ C0] host_regs: 00000090: 00000016 00000000 00000000 00000000 [ 2.784266][ T13] ufshcd-rockchip 2a2d0000.ufs: ufshcd_err_handler started; HBA state eh_fatal; powered 1; shutting down 0; saved_err = 2176; saved_uic_err = 0; force_reset = 0 [ 2.784334][ T168] ufshcd-rockchip 2a2d0000.ufs: ufshcd_query_flag: Sending flag query for idn 1 failed, err = 5
Recover by resetting the device and the controller and redoing the whole initialization sequence, up to three times with a 100 ms settle delay in between. Patch 1/2 moves the initialization sequence into a new function so that it can be retried as a unit, and patch 2/2 adds the retry loop around its call site in ufshcd_init().
Changes in v3:
- Stop the controller before draining the error handler and clearing the error state, so that no interrupt can re-latch errors or schedule the error handler during the cleanup(sashiko)
- Remove the hwmon device and reset the exception event masks between retries, since the device reset wipes their state on the device side; also remove the hwmon device on the init failure path(sashiko)
- Only restore the MCQ mode after the controller re-enable and let the next attempt configure the queues(sashiko)
- Take the address of the by-value host_lock for spin_lock_irqsave()(sashiko)
Changes in v2:
- Move the initialization sequence into a new function and retry by looping over its call site instead of adding more gotos to ufshcd_init()(Bart)
- Stop a pending error handler and clear the error state latched by the failed attempt, so that the retry starts from a clean state(sashiko)
- Reconfigure and re-enable MCQ after the controller re-enable, since the HCE toggle clears the MCQ mode setting(sashiko)
Shawn Lin (2):
scsi: ufs: core: Move the device initialization sequence into a new
function
scsi: ufs: core: Retry the full device init on fatal link loss
drivers/ufs/core/ufshcd.c | 124 ++++++++++++++++++++++++++++++-------- 1 file changed, 99 insertions(+), 25 deletions(-)
Signature · 1 line
2.25.1