@@ -4030,6 +4030,8 @@ int ufshcd_link_recovery(struct ufs_hba *hba)
40304030 if (ret )
40314031 dev_err (hba -> dev , "%s: link recovery failed, err %d" ,
40324032 __func__ , ret );
4033+ else
4034+ ufshcd_clear_ua_wluns (hba );
40334035
40344036 return ret ;
40354037}
@@ -5029,7 +5031,8 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)
50295031 break ;
50305032 } /* end of switch */
50315033
5032- if ((host_byte (result ) != DID_OK ) && !hba -> silence_err_logs )
5034+ if ((host_byte (result ) != DID_OK ) &&
5035+ (host_byte (result ) != DID_REQUEUE ) && !hba -> silence_err_logs )
50335036 ufshcd_print_trs (hba , 1 << lrbp -> task_tag , true);
50345037 return result ;
50355038}
@@ -6037,6 +6040,9 @@ static void ufshcd_err_handler(struct work_struct *work)
60376040 ufshcd_scsi_unblock_requests (hba );
60386041 ufshcd_err_handling_unprepare (hba );
60396042 up (& hba -> host_sem );
6043+
6044+ if (!err && needs_reset )
6045+ ufshcd_clear_ua_wluns (hba );
60406046}
60416047
60426048/**
@@ -6330,9 +6336,13 @@ static irqreturn_t ufshcd_intr(int irq, void *__hba)
63306336 intr_status = ufshcd_readl (hba , REG_INTERRUPT_STATUS );
63316337 }
63326338
6333- if (enabled_intr_status && retval == IRQ_NONE ) {
6334- dev_err (hba -> dev , "%s: Unhandled interrupt 0x%08x\n" ,
6335- __func__ , intr_status );
6339+ if (enabled_intr_status && retval == IRQ_NONE &&
6340+ !ufshcd_eh_in_progress (hba )) {
6341+ dev_err (hba -> dev , "%s: Unhandled interrupt 0x%08x (0x%08x, 0x%08x)\n" ,
6342+ __func__ ,
6343+ intr_status ,
6344+ hba -> ufs_stats .last_intr_status ,
6345+ enabled_intr_status );
63366346 ufshcd_dump_regs (hba , 0 , UFSHCI_REG_SPACE_SIZE , "host_regs: " );
63376347 }
63386348
@@ -6376,7 +6386,10 @@ static int __ufshcd_issue_tm_cmd(struct ufs_hba *hba,
63766386 * Even though we use wait_event() which sleeps indefinitely,
63776387 * the maximum wait time is bounded by %TM_CMD_TIMEOUT.
63786388 */
6379- req = blk_get_request (q , REQ_OP_DRV_OUT , BLK_MQ_REQ_RESERVED );
6389+ req = blk_get_request (q , REQ_OP_DRV_OUT , 0 );
6390+ if (IS_ERR (req ))
6391+ return PTR_ERR (req );
6392+
63806393 req -> end_io_data = & wait ;
63816394 free_slot = req -> tag ;
63826395 WARN_ON_ONCE (free_slot < 0 || free_slot >= hba -> nutmrs );
@@ -6973,14 +6986,11 @@ static int ufshcd_host_reset_and_restore(struct ufs_hba *hba)
69736986 ufshcd_set_clk_freq (hba , true);
69746987
69756988 err = ufshcd_hba_enable (hba );
6976- if (err )
6977- goto out ;
69786989
69796990 /* Establish the link again and restore the device */
6980- err = ufshcd_probe_hba (hba , false);
69816991 if (!err )
6982- ufshcd_clear_ua_wluns (hba );
6983- out :
6992+ err = ufshcd_probe_hba (hba , false );
6993+
69846994 if (err )
69856995 dev_err (hba -> dev , "%s: Host init failed %d\n" , __func__ , err );
69866996 ufshcd_update_evt_hist (hba , UFS_EVT_HOST_RESET , (u32 )err );
@@ -7747,6 +7757,8 @@ static int ufshcd_add_lus(struct ufs_hba *hba)
77477757 if (ret )
77487758 goto out ;
77497759
7760+ ufshcd_clear_ua_wluns (hba );
7761+
77507762 /* Initialize devfreq after UFS device is detected */
77517763 if (ufshcd_is_clkscaling_supported (hba )) {
77527764 memcpy (& hba -> clk_scaling .saved_pwr_info .info ,
@@ -7948,8 +7960,6 @@ static void ufshcd_async_scan(void *data, async_cookie_t cookie)
79487960 if (ret ) {
79497961 pm_runtime_put_sync (hba -> dev );
79507962 ufshcd_hba_exit (hba );
7951- } else {
7952- ufshcd_clear_ua_wluns (hba );
79537963 }
79547964}
79557965
@@ -8805,6 +8815,7 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
88058815
88068816 hba -> clk_gating .is_suspended = false;
88078817 hba -> dev_info .b_rpm_dev_flush_capable = false;
8818+ ufshcd_clear_ua_wluns (hba );
88088819 ufshcd_release (hba );
88098820out :
88108821 if (hba -> dev_info .b_rpm_dev_flush_capable ) {
@@ -8915,6 +8926,8 @@ static int ufshcd_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)
89158926 cancel_delayed_work (& hba -> rpm_dev_flush_recheck_work );
89168927 }
89178928
8929+ ufshcd_clear_ua_wluns (hba );
8930+
89188931 /* Schedule clock gating in case of no access to UFS device yet */
89198932 ufshcd_release (hba );
89208933
0 commit comments