Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
"Small ufs fixes and a core change to clear the command private area on
every retry (which fixes a reported bug in virtio_scsi)"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
scsi: ufs: core: bsg: Fix crash when arpmb command fails
scsi: ufs: core: Set default runtime/system PM levels before ufshcd_hba_init()
scsi: core: Clear driver private data when retrying request
scsi: ufs: core: Fix ufshcd_is_ufs_dev_busy() and ufshcd_eh_timed_out()

+30 -28
+7 -7
drivers/scsi/scsi_lib.c
··· 1669 1669 if (in_flight) 1670 1670 __set_bit(SCMD_STATE_INFLIGHT, &cmd->state); 1671 1671 1672 - /* 1673 - * Only clear the driver-private command data if the LLD does not supply 1674 - * a function to initialize that data. 1675 - */ 1676 - if (!shost->hostt->init_cmd_priv) 1677 - memset(cmd + 1, 0, shost->hostt->cmd_size); 1678 - 1679 1672 cmd->prot_op = SCSI_PROT_NORMAL; 1680 1673 if (blk_rq_bytes(req)) 1681 1674 cmd->sc_data_direction = rq_dma_dir(req); ··· 1834 1841 } 1835 1842 if (!scsi_host_queue_ready(q, shost, sdev, cmd)) 1836 1843 goto out_dec_target_busy; 1844 + 1845 + /* 1846 + * Only clear the driver-private command data if the LLD does not supply 1847 + * a function to initialize that data. 1848 + */ 1849 + if (shost->hostt->cmd_size && !shost->hostt->init_cmd_priv) 1850 + memset(cmd + 1, 0, shost->hostt->cmd_size); 1837 1851 1838 1852 if (!(req->rq_flags & RQF_DONTPREP)) { 1839 1853 ret = scsi_prepare_cmd(req);
+4 -2
drivers/ufs/core/ufs_bsg.c
··· 194 194 ufshcd_rpm_put_sync(hba); 195 195 kfree(buff); 196 196 bsg_reply->result = ret; 197 - job->reply_len = !rpmb ? sizeof(struct ufs_bsg_reply) : sizeof(struct ufs_rpmb_reply); 198 197 /* complete the job here only if no error */ 199 - if (ret == 0) 198 + if (ret == 0) { 199 + job->reply_len = rpmb ? sizeof(struct ufs_rpmb_reply) : 200 + sizeof(struct ufs_bsg_reply); 200 201 bsg_job_done(job, ret, bsg_reply->reply_payload_rcv_len); 202 + } 201 203 202 204 return ret; 203 205 }
+19 -19
drivers/ufs/core/ufshcd.c
··· 266 266 267 267 static bool ufshcd_is_ufs_dev_busy(struct ufs_hba *hba) 268 268 { 269 - return hba->outstanding_reqs || ufshcd_has_pending_tasks(hba); 269 + return scsi_host_busy(hba->host) || ufshcd_has_pending_tasks(hba); 270 270 } 271 271 272 272 static const struct ufs_dev_quirk ufs_fixups[] = { ··· 628 628 const struct scsi_device *sdev_ufs = hba->ufs_device_wlun; 629 629 630 630 dev_err(hba->dev, "UFS Host state=%d\n", hba->ufshcd_state); 631 - dev_err(hba->dev, "outstanding reqs=0x%lx tasks=0x%lx\n", 632 - hba->outstanding_reqs, hba->outstanding_tasks); 631 + dev_err(hba->dev, "%d outstanding reqs, tasks=0x%lx\n", 632 + scsi_host_busy(hba->host), hba->outstanding_tasks); 633 633 dev_err(hba->dev, "saved_err=0x%x, saved_uic_err=0x%x\n", 634 634 hba->saved_err, hba->saved_uic_err); 635 635 dev_err(hba->dev, "Device power mode=%d, UIC link state=%d\n", ··· 8882 8882 dev_info(hba->dev, "%s() finished; outstanding_tasks = %#lx.\n", 8883 8883 __func__, hba->outstanding_tasks); 8884 8884 8885 - return hba->outstanding_reqs ? SCSI_EH_RESET_TIMER : SCSI_EH_DONE; 8885 + return scsi_host_busy(hba->host) ? SCSI_EH_RESET_TIMER : SCSI_EH_DONE; 8886 8886 } 8887 8887 8888 8888 static const struct attribute_group *ufshcd_driver_groups[] = { ··· 10431 10431 */ 10432 10432 spin_lock_init(&hba->clk_gating.lock); 10433 10433 10434 + /* 10435 + * Set the default power management level for runtime and system PM. 10436 + * Host controller drivers can override them in their 10437 + * 'ufs_hba_variant_ops::init' callback. 10438 + * 10439 + * Default power saving mode is to keep UFS link in Hibern8 state 10440 + * and UFS device in sleep state. 10441 + */ 10442 + hba->rpm_lvl = ufs_get_desired_pm_lvl_for_dev_link_state( 10443 + UFS_SLEEP_PWR_MODE, 10444 + UIC_LINK_HIBERN8_STATE); 10445 + hba->spm_lvl = ufs_get_desired_pm_lvl_for_dev_link_state( 10446 + UFS_SLEEP_PWR_MODE, 10447 + UIC_LINK_HIBERN8_STATE); 10448 + 10434 10449 err = ufshcd_hba_init(hba); 10435 10450 if (err) 10436 10451 goto out_error; ··· 10558 10543 ufshcd_print_host_state(hba); 10559 10544 goto out_disable; 10560 10545 } 10561 - 10562 - /* 10563 - * Set the default power management level for runtime and system PM if 10564 - * not set by the host controller drivers. 10565 - * Default power saving mode is to keep UFS link in Hibern8 state 10566 - * and UFS device in sleep state. 10567 - */ 10568 - if (!hba->rpm_lvl) 10569 - hba->rpm_lvl = ufs_get_desired_pm_lvl_for_dev_link_state( 10570 - UFS_SLEEP_PWR_MODE, 10571 - UIC_LINK_HIBERN8_STATE); 10572 - if (!hba->spm_lvl) 10573 - hba->spm_lvl = ufs_get_desired_pm_lvl_for_dev_link_state( 10574 - UFS_SLEEP_PWR_MODE, 10575 - UIC_LINK_HIBERN8_STATE); 10576 10546 10577 10547 INIT_DELAYED_WORK(&hba->rpm_dev_flush_recheck_work, ufshcd_rpm_dev_flush_recheck_work); 10578 10548 INIT_DELAYED_WORK(&hba->ufs_rtc_update_work, ufshcd_rtc_work);