···35753575 scmd->sc_data_direction);35763576 priv->meta_sg_valid = 1; /* To unmap meta sg DMA */35773577 } else {35783578+ /*35793579+ * Some firmware versions byte-swap the REPORT ZONES command35803580+ * reply from ATA-ZAC devices by directly accessing in the host35813581+ * buffer. This does not respect the default command DMA35823582+ * direction and causes IOMMU page faults on some architectures35833583+ * with an IOMMU enforcing write mappings (e.g. AMD hosts).35843584+ * Avoid such issue by making the REPORT ZONES buffer mapping35853585+ * bi-directional.35863586+ */35873587+ if (scmd->cmnd[0] == ZBC_IN && scmd->cmnd[1] == ZI_REPORT_ZONES)35883588+ scmd->sc_data_direction = DMA_BIDIRECTIONAL;35783589 sg_scmd = scsi_sglist(scmd);35793590 sges_left = scsi_dma_map(scmd);35803591 }
+18-2
drivers/scsi/mpt3sas/mpt3sas_base.c
···26712671 _base_add_sg_single_ieee(paddr, sgl_flags, 0, 0, -1);26722672}2673267326742674+static inline int _base_scsi_dma_map(struct scsi_cmnd *cmd)26752675+{26762676+ /*26772677+ * Some firmware versions byte-swap the REPORT ZONES command reply from26782678+ * ATA-ZAC devices by directly accessing in the host buffer. This does26792679+ * not respect the default command DMA direction and causes IOMMU page26802680+ * faults on some architectures with an IOMMU enforcing write mappings26812681+ * (e.g. AMD hosts). Avoid such issue by making the report zones buffer26822682+ * mapping bi-directional.26832683+ */26842684+ if (cmd->cmnd[0] == ZBC_IN && cmd->cmnd[1] == ZI_REPORT_ZONES)26852685+ cmd->sc_data_direction = DMA_BIDIRECTIONAL;26862686+26872687+ return scsi_dma_map(cmd);26882688+}26892689+26742690/**26752691 * _base_build_sg_scmd - main sg creation routine26762692 * pcie_device is unused here!···27332717 sgl_flags = sgl_flags << MPI2_SGE_FLAGS_SHIFT;2734271827352719 sg_scmd = scsi_sglist(scmd);27362736- sges_left = scsi_dma_map(scmd);27202720+ sges_left = _base_scsi_dma_map(scmd);27372721 if (sges_left < 0)27382722 return -ENOMEM;27392723···28772861 }2878286228792863 sg_scmd = scsi_sglist(scmd);28802880- sges_left = scsi_dma_map(scmd);28642864+ sges_left = _base_scsi_dma_map(scmd);28812865 if (sges_left < 0)28822866 return -ENOMEM;28832867
+3-2
drivers/scsi/sd.c
···42054205{42064206 struct scsi_disk *sdkp = dev_get_drvdata(dev);4207420742084208+ sd_printk(KERN_NOTICE, sdkp, "Starting disk\n");42094209+42084210 if (opal_unlock_from_suspend(sdkp->opal_dev)) {42094211 sd_printk(KERN_NOTICE, sdkp, "OPAL unlock failed\n");42104212 return -EIO;···42234221 if (!sdkp) /* E.g.: runtime resume at the start of sd_probe() */42244222 return 0;4225422342264226- sd_printk(KERN_NOTICE, sdkp, "Starting disk\n");42274227-42284224 if (!sd_do_start_stop(sdkp->device, runtime)) {42294225 sdkp->suspended = false;42304226 return 0;42314227 }4232422842294229+ sd_printk(KERN_NOTICE, sdkp, "Starting disk\n");42334230 ret = sd_start_stop_device(sdkp, 1);42344231 if (!ret) {42354232 sd_resume(dev);
+5
drivers/ufs/core/ufshcd-priv.h
···316316 return pm_runtime_get_sync(&hba->ufs_device_wlun->sdev_gendev);317317}318318319319+static inline int ufshcd_rpm_get_if_active(struct ufs_hba *hba)320320+{321321+ return pm_runtime_get_if_active(&hba->ufs_device_wlun->sdev_gendev);322322+}323323+319324static inline int ufshcd_rpm_put_sync(struct ufs_hba *hba)320325{321326 return pm_runtime_put_sync(&hba->ufs_device_wlun->sdev_gendev);
+22-5
drivers/ufs/core/ufshcd.c
···24162416 return err;24172417 }2418241824192419+ /*24202420+ * The UFSHCI 3.0 specification does not define MCQ_SUPPORT and24212421+ * LSDB_SUPPORT, but [31:29] as reserved bits with reset value 0s, which24222422+ * means we can simply read values regardless of version.24232423+ */24192424 hba->mcq_sup = FIELD_GET(MASK_MCQ_SUPPORT, hba->capabilities);24252425+ /*24262426+ * 0h: legacy single doorbell support is available24272427+ * 1h: indicate that legacy single doorbell support has been removed24282428+ */24292429+ hba->lsdb_sup = !FIELD_GET(MASK_LSDB_SUPPORT, hba->capabilities);24202430 if (!hba->mcq_sup)24212431 return 0;24222432···65636553 if (ufshcd_err_handling_should_stop(hba))65646554 goto skip_err_handling;6565655565666566- if (hba->dev_quirks & UFS_DEVICE_QUIRK_RECOVERY_FROM_DL_NAC_ERRORS) {65566556+ if ((hba->dev_quirks & UFS_DEVICE_QUIRK_RECOVERY_FROM_DL_NAC_ERRORS) &&65576557+ !hba->force_reset) {65676558 bool ret;6568655965696560 spin_unlock_irqrestore(hba->host->host_lock, flags);···82228211 */82238212 val = ts64.tv_sec - hba->dev_info.rtc_time_baseline;8224821382258225- ufshcd_rpm_get_sync(hba);82148214+ /* Skip update RTC if RPM state is not RPM_ACTIVE */82158215+ if (ufshcd_rpm_get_if_active(hba) <= 0)82168216+ return;82178217+82268218 err = ufshcd_query_attr(hba, UPIU_QUERY_OPCODE_WRITE_ATTR, QUERY_ATTR_IDN_SECONDS_PASSED,82278219 0, 0, &val);82288220 ufshcd_rpm_put_sync(hba);···1027910265 */1028010266 ufshcd_readl(hba, REG_UTP_TASK_REQ_LIST_BASE_H);10281102671028210282- /* Resuming from hibernate, assume that link was OFF */1028310283- ufshcd_set_link_off(hba);1028410284-1028510268 return 0;10286102691028710270}···1050710496 }10508104971050910498 if (!is_mcq_supported(hba)) {1049910499+ if (!hba->lsdb_sup) {1050010500+ dev_err(hba->dev, "%s: failed to initialize (legacy doorbell mode not supported)\n",1050110501+ __func__);1050210502+ err = -EINVAL;1050310503+ goto out_disable;1050410504+ }1051010505 err = scsi_add_host(host, hba->dev);1051110506 if (err) {1051210507 dev_err(hba->dev, "scsi_add_host failed\n");
+3
drivers/ufs/host/ufs-exynos.c
···12931293{12941294 struct arm_smccc_res res;1295129512961296+ if (!(hba->caps & UFSHCD_CAP_CRYPTO))12971297+ return;12981298+12961299 arm_smccc_smc(SMC_CMD_FMP_SECURITY, 0, SMU_EMBEDDED, CFG_DESCTYPE_3,12971300 0, 0, 0, 0, &res);12981301 if (res.a0)