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

Merge branch '6.11/scsi-queue' into 6.11/scsi-fixes

Pull outstanding commits from 6.11 queue into fixes.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

+64 -9
+11
drivers/scsi/mpi3mr/mpi3mr_os.c
··· 3575 3575 scmd->sc_data_direction); 3576 3576 priv->meta_sg_valid = 1; /* To unmap meta sg DMA */ 3577 3577 } else { 3578 + /* 3579 + * Some firmware versions byte-swap the REPORT ZONES command 3580 + * reply from ATA-ZAC devices by directly accessing in the host 3581 + * buffer. This does not respect the default command DMA 3582 + * direction and causes IOMMU page faults on some architectures 3583 + * with an IOMMU enforcing write mappings (e.g. AMD hosts). 3584 + * Avoid such issue by making the REPORT ZONES buffer mapping 3585 + * bi-directional. 3586 + */ 3587 + if (scmd->cmnd[0] == ZBC_IN && scmd->cmnd[1] == ZI_REPORT_ZONES) 3588 + scmd->sc_data_direction = DMA_BIDIRECTIONAL; 3578 3589 sg_scmd = scsi_sglist(scmd); 3579 3590 sges_left = scsi_dma_map(scmd); 3580 3591 }
+18 -2
drivers/scsi/mpt3sas/mpt3sas_base.c
··· 2671 2671 _base_add_sg_single_ieee(paddr, sgl_flags, 0, 0, -1); 2672 2672 } 2673 2673 2674 + static inline int _base_scsi_dma_map(struct scsi_cmnd *cmd) 2675 + { 2676 + /* 2677 + * Some firmware versions byte-swap the REPORT ZONES command reply from 2678 + * ATA-ZAC devices by directly accessing in the host buffer. This does 2679 + * not respect the default command DMA direction and causes IOMMU page 2680 + * faults on some architectures with an IOMMU enforcing write mappings 2681 + * (e.g. AMD hosts). Avoid such issue by making the report zones buffer 2682 + * mapping bi-directional. 2683 + */ 2684 + if (cmd->cmnd[0] == ZBC_IN && cmd->cmnd[1] == ZI_REPORT_ZONES) 2685 + cmd->sc_data_direction = DMA_BIDIRECTIONAL; 2686 + 2687 + return scsi_dma_map(cmd); 2688 + } 2689 + 2674 2690 /** 2675 2691 * _base_build_sg_scmd - main sg creation routine 2676 2692 * pcie_device is unused here! ··· 2733 2717 sgl_flags = sgl_flags << MPI2_SGE_FLAGS_SHIFT; 2734 2718 2735 2719 sg_scmd = scsi_sglist(scmd); 2736 - sges_left = scsi_dma_map(scmd); 2720 + sges_left = _base_scsi_dma_map(scmd); 2737 2721 if (sges_left < 0) 2738 2722 return -ENOMEM; 2739 2723 ··· 2877 2861 } 2878 2862 2879 2863 sg_scmd = scsi_sglist(scmd); 2880 - sges_left = scsi_dma_map(scmd); 2864 + sges_left = _base_scsi_dma_map(scmd); 2881 2865 if (sges_left < 0) 2882 2866 return -ENOMEM; 2883 2867
+3 -2
drivers/scsi/sd.c
··· 4205 4205 { 4206 4206 struct scsi_disk *sdkp = dev_get_drvdata(dev); 4207 4207 4208 + sd_printk(KERN_NOTICE, sdkp, "Starting disk\n"); 4209 + 4208 4210 if (opal_unlock_from_suspend(sdkp->opal_dev)) { 4209 4211 sd_printk(KERN_NOTICE, sdkp, "OPAL unlock failed\n"); 4210 4212 return -EIO; ··· 4223 4221 if (!sdkp) /* E.g.: runtime resume at the start of sd_probe() */ 4224 4222 return 0; 4225 4223 4226 - sd_printk(KERN_NOTICE, sdkp, "Starting disk\n"); 4227 - 4228 4224 if (!sd_do_start_stop(sdkp->device, runtime)) { 4229 4225 sdkp->suspended = false; 4230 4226 return 0; 4231 4227 } 4232 4228 4229 + sd_printk(KERN_NOTICE, sdkp, "Starting disk\n"); 4233 4230 ret = sd_start_stop_device(sdkp, 1); 4234 4231 if (!ret) { 4235 4232 sd_resume(dev);
+5
drivers/ufs/core/ufshcd-priv.h
··· 316 316 return pm_runtime_get_sync(&hba->ufs_device_wlun->sdev_gendev); 317 317 } 318 318 319 + static inline int ufshcd_rpm_get_if_active(struct ufs_hba *hba) 320 + { 321 + return pm_runtime_get_if_active(&hba->ufs_device_wlun->sdev_gendev); 322 + } 323 + 319 324 static inline int ufshcd_rpm_put_sync(struct ufs_hba *hba) 320 325 { 321 326 return pm_runtime_put_sync(&hba->ufs_device_wlun->sdev_gendev);
+22 -5
drivers/ufs/core/ufshcd.c
··· 2416 2416 return err; 2417 2417 } 2418 2418 2419 + /* 2420 + * The UFSHCI 3.0 specification does not define MCQ_SUPPORT and 2421 + * LSDB_SUPPORT, but [31:29] as reserved bits with reset value 0s, which 2422 + * means we can simply read values regardless of version. 2423 + */ 2419 2424 hba->mcq_sup = FIELD_GET(MASK_MCQ_SUPPORT, hba->capabilities); 2425 + /* 2426 + * 0h: legacy single doorbell support is available 2427 + * 1h: indicate that legacy single doorbell support has been removed 2428 + */ 2429 + hba->lsdb_sup = !FIELD_GET(MASK_LSDB_SUPPORT, hba->capabilities); 2420 2430 if (!hba->mcq_sup) 2421 2431 return 0; 2422 2432 ··· 6563 6553 if (ufshcd_err_handling_should_stop(hba)) 6564 6554 goto skip_err_handling; 6565 6555 6566 - if (hba->dev_quirks & UFS_DEVICE_QUIRK_RECOVERY_FROM_DL_NAC_ERRORS) { 6556 + if ((hba->dev_quirks & UFS_DEVICE_QUIRK_RECOVERY_FROM_DL_NAC_ERRORS) && 6557 + !hba->force_reset) { 6567 6558 bool ret; 6568 6559 6569 6560 spin_unlock_irqrestore(hba->host->host_lock, flags); ··· 8222 8211 */ 8223 8212 val = ts64.tv_sec - hba->dev_info.rtc_time_baseline; 8224 8213 8225 - ufshcd_rpm_get_sync(hba); 8214 + /* Skip update RTC if RPM state is not RPM_ACTIVE */ 8215 + if (ufshcd_rpm_get_if_active(hba) <= 0) 8216 + return; 8217 + 8226 8218 err = ufshcd_query_attr(hba, UPIU_QUERY_OPCODE_WRITE_ATTR, QUERY_ATTR_IDN_SECONDS_PASSED, 8227 8219 0, 0, &val); 8228 8220 ufshcd_rpm_put_sync(hba); ··· 10279 10265 */ 10280 10266 ufshcd_readl(hba, REG_UTP_TASK_REQ_LIST_BASE_H); 10281 10267 10282 - /* Resuming from hibernate, assume that link was OFF */ 10283 - ufshcd_set_link_off(hba); 10284 - 10285 10268 return 0; 10286 10269 10287 10270 } ··· 10507 10496 } 10508 10497 10509 10498 if (!is_mcq_supported(hba)) { 10499 + if (!hba->lsdb_sup) { 10500 + dev_err(hba->dev, "%s: failed to initialize (legacy doorbell mode not supported)\n", 10501 + __func__); 10502 + err = -EINVAL; 10503 + goto out_disable; 10504 + } 10510 10505 err = scsi_add_host(host, hba->dev); 10511 10506 if (err) { 10512 10507 dev_err(hba->dev, "scsi_add_host failed\n");
+3
drivers/ufs/host/ufs-exynos.c
··· 1293 1293 { 1294 1294 struct arm_smccc_res res; 1295 1295 1296 + if (!(hba->caps & UFSHCD_CAP_CRYPTO)) 1297 + return; 1298 + 1296 1299 arm_smccc_smc(SMC_CMD_FMP_SECURITY, 0, SMU_EMBEDDED, CFG_DESCTYPE_3, 1297 1300 0, 0, 0, 0, &res); 1298 1301 if (res.a0)
+1
include/ufs/ufshcd.h
··· 1109 1109 bool ext_iid_sup; 1110 1110 bool scsi_host_added; 1111 1111 bool mcq_sup; 1112 + bool lsdb_sup; 1112 1113 bool mcq_enabled; 1113 1114 struct ufshcd_res_info res[RES_MAX]; 1114 1115 void __iomem *mcq_base;
+1
include/ufs/ufshci.h
··· 77 77 MASK_OUT_OF_ORDER_DATA_DELIVERY_SUPPORT = 0x02000000, 78 78 MASK_UIC_DME_TEST_MODE_SUPPORT = 0x04000000, 79 79 MASK_CRYPTO_SUPPORT = 0x10000000, 80 + MASK_LSDB_SUPPORT = 0x20000000, 80 81 MASK_MCQ_SUPPORT = 0x40000000, 81 82 }; 82 83