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

Merge branch '5.11/scsi-fixes' into 5.12/scsi-queue

The UFS core has received a substantial rework this cycle. This in
turn has caused a merge conflict in linux-next. Merge 5.11/scsi-fixes
into 5.12/scsi-queue and resolve the conflict.

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

+92 -44
+22 -14
Documentation/ABI/testing/sysfs-driver-ufs
··· 916 916 Contact: Subhash Jadavani <subhashj@codeaurora.org> 917 917 Description: This entry could be used to set or show the UFS device 918 918 runtime power management level. The current driver 919 - implementation supports 6 levels with next target states: 919 + implementation supports 7 levels with next target states: 920 920 921 921 == ==================================================== 922 - 0 an UFS device will stay active, an UIC link will 922 + 0 UFS device will stay active, UIC link will 923 923 stay active 924 - 1 an UFS device will stay active, an UIC link will 924 + 1 UFS device will stay active, UIC link will 925 925 hibernate 926 - 2 an UFS device will moved to sleep, an UIC link will 926 + 2 UFS device will be moved to sleep, UIC link will 927 927 stay active 928 - 3 an UFS device will moved to sleep, an UIC link will 928 + 3 UFS device will be moved to sleep, UIC link will 929 929 hibernate 930 - 4 an UFS device will be powered off, an UIC link will 930 + 4 UFS device will be powered off, UIC link will 931 931 hibernate 932 - 5 an UFS device will be powered off, an UIC link will 932 + 5 UFS device will be powered off, UIC link will 933 933 be powered off 934 + 6 UFS device will be moved to deep sleep, UIC link 935 + will be powered off. Note, deep sleep might not be 936 + supported in which case this value will not be 937 + accepted 934 938 == ==================================================== 935 939 936 940 What: /sys/bus/platform/drivers/ufshcd/*/rpm_target_dev_state ··· 958 954 Contact: Subhash Jadavani <subhashj@codeaurora.org> 959 955 Description: This entry could be used to set or show the UFS device 960 956 system power management level. The current driver 961 - implementation supports 6 levels with next target states: 957 + implementation supports 7 levels with next target states: 962 958 963 959 == ==================================================== 964 - 0 an UFS device will stay active, an UIC link will 960 + 0 UFS device will stay active, UIC link will 965 961 stay active 966 - 1 an UFS device will stay active, an UIC link will 962 + 1 UFS device will stay active, UIC link will 967 963 hibernate 968 - 2 an UFS device will moved to sleep, an UIC link will 964 + 2 UFS device will be moved to sleep, UIC link will 969 965 stay active 970 - 3 an UFS device will moved to sleep, an UIC link will 966 + 3 UFS device will be moved to sleep, UIC link will 971 967 hibernate 972 - 4 an UFS device will be powered off, an UIC link will 968 + 4 UFS device will be powered off, UIC link will 973 969 hibernate 974 - 5 an UFS device will be powered off, an UIC link will 970 + 5 UFS device will be powered off, UIC link will 975 971 be powered off 972 + 6 UFS device will be moved to deep sleep, UIC link 973 + will be powered off. Note, deep sleep might not be 974 + supported in which case this value will not be 975 + accepted 976 976 == ==================================================== 977 977 978 978 What: /sys/bus/platform/drivers/ufshcd/*/spm_target_dev_state
+5 -3
drivers/scsi/fnic/vnic_dev.c
··· 444 444 fetch_index = ioread32(&vdev->devcmd2->wq.ctrl->fetch_index); 445 445 if (fetch_index == 0xFFFFFFFF) { /* check for hardware gone */ 446 446 pr_err("error in devcmd2 init"); 447 - return -ENODEV; 447 + err = -ENODEV; 448 + goto err_free_wq; 448 449 } 449 450 450 451 /* ··· 461 460 err = vnic_dev_alloc_desc_ring(vdev, &vdev->devcmd2->results_ring, 462 461 DEVCMD2_RING_SIZE, DEVCMD2_DESC_SIZE); 463 462 if (err) 464 - goto err_free_wq; 463 + goto err_disable_wq; 465 464 466 465 vdev->devcmd2->result = 467 466 (struct devcmd2_result *) vdev->devcmd2->results_ring.descs; ··· 482 481 483 482 err_free_desc_ring: 484 483 vnic_dev_free_desc_ring(vdev, &vdev->devcmd2->results_ring); 485 - err_free_wq: 484 + err_disable_wq: 486 485 vnic_wq_disable(&vdev->devcmd2->wq); 486 + err_free_wq: 487 487 vnic_wq_free(&vdev->devcmd2->wq); 488 488 err_free_devcmd2: 489 489 kfree(vdev->devcmd2);
+5 -3
drivers/scsi/ibmvscsi/ibmvfc.c
··· 1930 1930 iu->pri_task_attr = IBMVFC_SIMPLE_TASK; 1931 1931 } 1932 1932 1933 - vfc_cmd->correlation = cpu_to_be64(evt); 1933 + vfc_cmd->correlation = cpu_to_be64((u64)evt); 1934 1934 1935 1935 if (likely(!(rc = ibmvfc_map_sg_data(cmnd, evt, vfc_cmd, vhost->dev)))) 1936 1936 return ibmvfc_send_event(evt, vhost, 0); ··· 2707 2707 tmf->flags = cpu_to_be16((IBMVFC_NO_MEM_DESC | IBMVFC_TMF)); 2708 2708 evt->sync_iu = &rsp_iu; 2709 2709 2710 - tmf->correlation = cpu_to_be64(evt); 2710 + tmf->correlation = cpu_to_be64((u64)evt); 2711 2711 2712 2712 init_completion(&evt->comp); 2713 2713 rsp_rc = ibmvfc_send_event(evt, vhost, default_timeout); ··· 3296 3296 unsigned long flags = 0; 3297 3297 3298 3298 spin_lock_irqsave(shost->host_lock, flags); 3299 - if (sdev->type == TYPE_DISK) 3299 + if (sdev->type == TYPE_DISK) { 3300 3300 sdev->allow_restart = 1; 3301 + blk_queue_rq_timeout(sdev->request_queue, 120 * HZ); 3302 + } 3301 3303 spin_unlock_irqrestore(shost->host_lock, flags); 3302 3304 return 0; 3303 3305 }
+14 -2
drivers/scsi/libfc/fc_exch.c
··· 1623 1623 rc = fc_exch_done_locked(ep); 1624 1624 WARN_ON(fc_seq_exch(sp) != ep); 1625 1625 spin_unlock_bh(&ep->ex_lock); 1626 - if (!rc) 1626 + if (!rc) { 1627 1627 fc_exch_delete(ep); 1628 + } else { 1629 + FC_EXCH_DBG(ep, "ep is completed already," 1630 + "hence skip calling the resp\n"); 1631 + goto skip_resp; 1632 + } 1628 1633 } 1629 1634 1630 1635 /* ··· 1648 1643 if (!fc_invoke_resp(ep, sp, fp)) 1649 1644 fc_frame_free(fp); 1650 1645 1646 + skip_resp: 1651 1647 fc_exch_release(ep); 1652 1648 return; 1653 1649 rel: ··· 1905 1899 1906 1900 fc_exch_hold(ep); 1907 1901 1908 - if (!rc) 1902 + if (!rc) { 1909 1903 fc_exch_delete(ep); 1904 + } else { 1905 + FC_EXCH_DBG(ep, "ep is completed already," 1906 + "hence skip calling the resp\n"); 1907 + goto skip_resp; 1908 + } 1910 1909 1911 1910 fc_invoke_resp(ep, sp, ERR_PTR(-FC_EX_CLOSED)); 1911 + skip_resp: 1912 1912 fc_seq_set_resp(sp, NULL, ep->arg); 1913 1913 fc_exch_release(ep); 1914 1914 }
+2 -4
drivers/scsi/megaraid/megaraid_sas_base.c
··· 8244 8244 goto out; 8245 8245 } 8246 8246 8247 + /* always store 64 bits regardless of addressing */ 8247 8248 sense_ptr = (void *)cmd->frame + ioc->sense_off; 8248 - if (instance->consistent_mask_64bit) 8249 - put_unaligned_le64(sense_handle, sense_ptr); 8250 - else 8251 - put_unaligned_le32(sense_handle, sense_ptr); 8249 + put_unaligned_le64(sense_handle, sense_ptr); 8252 8250 } 8253 8251 8254 8252 /*
+1 -1
drivers/scsi/qla2xxx/qla_os.c
··· 42 42 int ql2xenforce_iocb_limit = 1; 43 43 module_param(ql2xenforce_iocb_limit, int, S_IRUGO | S_IWUSR); 44 44 MODULE_PARM_DESC(ql2xenforce_iocb_limit, 45 - "Enforce IOCB throttling, to avoid FW congestion. (default: 0)"); 45 + "Enforce IOCB throttling, to avoid FW congestion. (default: 1)"); 46 46 47 47 /* 48 48 * CT6 CTX allocation cache
+8 -1
drivers/scsi/scsi_transport_srp.c
··· 541 541 res = mutex_lock_interruptible(&rport->mutex); 542 542 if (res) 543 543 goto out; 544 - scsi_target_block(&shost->shost_gendev); 544 + if (rport->state != SRP_RPORT_FAIL_FAST) 545 + /* 546 + * sdev state must be SDEV_TRANSPORT_OFFLINE, transition 547 + * to SDEV_BLOCK is illegal. Calling scsi_target_unblock() 548 + * later is ok though, scsi_internal_device_unblock_nowait() 549 + * treats SDEV_TRANSPORT_OFFLINE like SDEV_BLOCK. 550 + */ 551 + scsi_target_block(&shost->shost_gendev); 545 552 res = rport->state != SRP_RPORT_LOST ? i->f->reconnect(rport) : -ENODEV; 546 553 pr_debug("%s (state %d): transport.reconnect() returned %d\n", 547 554 dev_name(&shost->shost_gendev), rport->state, res);
+1
drivers/scsi/ufs/Kconfig
··· 72 72 config SCSI_UFSHCD_PLATFORM 73 73 tristate "Platform bus based UFS Controller support" 74 74 depends on SCSI_UFSHCD 75 + depends on HAS_IOMEM 75 76 help 76 77 This selects the UFS host controller support. Select this if 77 78 you have an UFS controller on Platform bus.
+25 -12
drivers/scsi/ufs/ufshcd.c
··· 4030 4030 if (ret) 4031 4031 dev_err(hba->dev, "%s: link recovery failed, err %d", 4032 4032 __func__, ret); 4033 + else 4034 + ufshcd_clear_ua_wluns(hba); 4033 4035 4034 4036 return ret; 4035 4037 } ··· 5031 5029 break; 5032 5030 } /* end of switch */ 5033 5031 5034 - if ((host_byte(result) != DID_OK) && !hba->silence_err_logs) 5032 + if ((host_byte(result) != DID_OK) && 5033 + (host_byte(result) != DID_REQUEUE) && !hba->silence_err_logs) 5035 5034 ufshcd_print_trs(hba, 1 << lrbp->task_tag, true); 5036 5035 return result; 5037 5036 } ··· 6040 6037 ufshcd_scsi_unblock_requests(hba); 6041 6038 ufshcd_err_handling_unprepare(hba); 6042 6039 up(&hba->host_sem); 6040 + 6041 + if (!err && needs_reset) 6042 + ufshcd_clear_ua_wluns(hba); 6043 6043 } 6044 6044 6045 6045 /** ··· 6336 6330 intr_status = ufshcd_readl(hba, REG_INTERRUPT_STATUS); 6337 6331 } 6338 6332 6339 - if (enabled_intr_status && retval == IRQ_NONE) { 6340 - dev_err(hba->dev, "%s: Unhandled interrupt 0x%08x\n", 6341 - __func__, intr_status); 6333 + if (enabled_intr_status && retval == IRQ_NONE && 6334 + !ufshcd_eh_in_progress(hba)) { 6335 + dev_err(hba->dev, "%s: Unhandled interrupt 0x%08x (0x%08x, 0x%08x)\n", 6336 + __func__, 6337 + intr_status, 6338 + hba->ufs_stats.last_intr_status, 6339 + enabled_intr_status); 6342 6340 ufshcd_dump_regs(hba, 0, UFSHCI_REG_SPACE_SIZE, "host_regs: "); 6343 6341 } 6344 6342 ··· 6386 6376 * Even though we use wait_event() which sleeps indefinitely, 6387 6377 * the maximum wait time is bounded by %TM_CMD_TIMEOUT. 6388 6378 */ 6389 - req = blk_get_request(q, REQ_OP_DRV_OUT, BLK_MQ_REQ_RESERVED); 6379 + req = blk_get_request(q, REQ_OP_DRV_OUT, 0); 6380 + if (IS_ERR(req)) 6381 + return PTR_ERR(req); 6382 + 6390 6383 req->end_io_data = &wait; 6391 6384 free_slot = req->tag; 6392 6385 WARN_ON_ONCE(free_slot < 0 || free_slot >= hba->nutmrs); ··· 6986 6973 ufshcd_set_clk_freq(hba, true); 6987 6974 6988 6975 err = ufshcd_hba_enable(hba); 6989 - if (err) 6990 - goto out; 6991 6976 6992 6977 /* Establish the link again and restore the device */ 6993 - err = ufshcd_probe_hba(hba, false); 6994 6978 if (!err) 6995 - ufshcd_clear_ua_wluns(hba); 6996 - out: 6979 + err = ufshcd_probe_hba(hba, false); 6980 + 6997 6981 if (err) 6998 6982 dev_err(hba->dev, "%s: Host init failed %d\n", __func__, err); 6999 6983 ufshcd_update_evt_hist(hba, UFS_EVT_HOST_RESET, (u32)err); ··· 7757 7747 if (ret) 7758 7748 goto out; 7759 7749 7750 + ufshcd_clear_ua_wluns(hba); 7751 + 7760 7752 /* Initialize devfreq after UFS device is detected */ 7761 7753 if (ufshcd_is_clkscaling_supported(hba)) { 7762 7754 memcpy(&hba->clk_scaling.saved_pwr_info.info, ··· 7960 7948 if (ret) { 7961 7949 pm_runtime_put_sync(hba->dev); 7962 7950 ufshcd_hba_exit(hba); 7963 - } else { 7964 - ufshcd_clear_ua_wluns(hba); 7965 7951 } 7966 7952 } 7967 7953 ··· 8815 8805 8816 8806 hba->clk_gating.is_suspended = false; 8817 8807 hba->dev_info.b_rpm_dev_flush_capable = false; 8808 + ufshcd_clear_ua_wluns(hba); 8818 8809 ufshcd_release(hba); 8819 8810 out: 8820 8811 if (hba->dev_info.b_rpm_dev_flush_capable) { ··· 8925 8914 hba->dev_info.b_rpm_dev_flush_capable = false; 8926 8915 cancel_delayed_work(&hba->rpm_dev_flush_recheck_work); 8927 8916 } 8917 + 8918 + ufshcd_clear_ua_wluns(hba); 8928 8919 8929 8920 /* Schedule clock gating in case of no access to UFS device yet */ 8930 8921 ufshcd_release(hba);
+1 -1
drivers/target/iscsi/iscsi_target_login.c
··· 896 896 else 897 897 len = sizeof(struct sockaddr_in); 898 898 /* 899 - * Set SO_REUSEADDR, and disable Nagel Algorithm with TCP_NODELAY. 899 + * Set SO_REUSEADDR, and disable Nagle Algorithm with TCP_NODELAY. 900 900 */ 901 901 if (np->np_network_transport == ISCSI_TCP) 902 902 tcp_sock_set_nodelay(sock->sk);
+8 -3
drivers/target/target_core_user.c
··· 562 562 563 563 static inline void tcmu_free_cmd(struct tcmu_cmd *tcmu_cmd) 564 564 { 565 - if (tcmu_cmd->se_cmd) 566 - tcmu_cmd->se_cmd->priv = NULL; 567 565 kfree(tcmu_cmd->dbi); 568 566 kmem_cache_free(tcmu_cmd_cache, tcmu_cmd); 569 567 } ··· 1172 1174 return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; 1173 1175 1174 1176 mutex_lock(&udev->cmdr_lock); 1175 - se_cmd->priv = tcmu_cmd; 1176 1177 if (!(se_cmd->transport_state & CMD_T_ABORTED)) 1177 1178 ret = queue_cmd_ring(tcmu_cmd, &scsi_ret); 1178 1179 if (ret < 0) 1179 1180 tcmu_free_cmd(tcmu_cmd); 1181 + else 1182 + se_cmd->priv = tcmu_cmd; 1180 1183 mutex_unlock(&udev->cmdr_lock); 1181 1184 return scsi_ret; 1182 1185 } ··· 1240 1241 1241 1242 list_del_init(&cmd->queue_entry); 1242 1243 tcmu_free_cmd(cmd); 1244 + se_cmd->priv = NULL; 1243 1245 target_complete_cmd(se_cmd, SAM_STAT_TASK_ABORTED); 1244 1246 unqueued = true; 1245 1247 } ··· 1332 1332 } 1333 1333 1334 1334 done: 1335 + se_cmd->priv = NULL; 1335 1336 if (read_len_valid) { 1336 1337 pr_debug("read_len = %d\n", read_len); 1337 1338 target_complete_cmd_with_length(cmd->se_cmd, ··· 1479 1478 se_cmd = cmd->se_cmd; 1480 1479 tcmu_free_cmd(cmd); 1481 1480 1481 + se_cmd->priv = NULL; 1482 1482 target_complete_cmd(se_cmd, SAM_STAT_TASK_SET_FULL); 1483 1483 } 1484 1484 ··· 1594 1592 * removed then LIO core will do the right thing and 1595 1593 * fail the retry. 1596 1594 */ 1595 + tcmu_cmd->se_cmd->priv = NULL; 1597 1596 target_complete_cmd(tcmu_cmd->se_cmd, SAM_STAT_BUSY); 1598 1597 tcmu_free_cmd(tcmu_cmd); 1599 1598 continue; ··· 1608 1605 * Ignore scsi_ret for now. target_complete_cmd 1609 1606 * drops it. 1610 1607 */ 1608 + tcmu_cmd->se_cmd->priv = NULL; 1611 1609 target_complete_cmd(tcmu_cmd->se_cmd, 1612 1610 SAM_STAT_CHECK_CONDITION); 1613 1611 tcmu_free_cmd(tcmu_cmd); ··· 2216 2212 if (!test_bit(TCMU_CMD_BIT_EXPIRED, &cmd->flags)) { 2217 2213 WARN_ON(!cmd->se_cmd); 2218 2214 list_del_init(&cmd->queue_entry); 2215 + cmd->se_cmd->priv = NULL; 2219 2216 if (err_level == 1) { 2220 2217 /* 2221 2218 * Userspace was not able to start the