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-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI updates from James Bottomley:
"Smaller set of driver updates than usual (ufs, lpfc, mpi3mr).

The rest (including the core file changes) are doc updates and some
minor bug fixes"

* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (49 commits)
scsi: libiscsi: Initialize iscsi_conn->dd_data only if memory is allocated
scsi: scsi_transport_fc: Add comments to describe added 'rport' parameter
scsi: bfa: Double-free fix
scsi: isci: Fix dma_unmap_sg() nents value
scsi: mvsas: Fix dma_unmap_sg() nents value
scsi: elx: efct: Fix dma_unmap_sg() nents value
scsi: scsi_transport_fc: Change to use per-rport devloss_work_q
scsi: ufs: exynos: Fix programming of HCI_UTRL_NEXUS_TYPE
scsi: core: Fix kernel doc for scsi_track_queue_full()
scsi: ibmvscsi_tgt: Fix dma_unmap_sg() nents value
scsi: ibmvscsi_tgt: Fix typo in comment
scsi: mpi3mr: Update driver version to 8.14.0.5.50
scsi: mpi3mr: Serialize admin queue BAR writes on 32-bit systems
scsi: mpi3mr: Drop unnecessary volatile from __iomem pointers
scsi: mpi3mr: Fix race between config read submit and interrupt completion
scsi: ufs: ufs-qcom: Enable QUnipro Internal Clock Gating
scsi: ufs: core: Add ufshcd_dme_rmw() to modify DME attributes
scsi: ufs: ufs-qcom: Update esi_vec_mask for HW major version >= 6
scsi: core: Use scsi_cmd_priv() instead of open-coding it
scsi: qla2xxx: Remove firmware URL
...

+815 -254
+83
Documentation/ABI/testing/sysfs-driver-ufs
··· 1685 1685 ================ ======================================== 1686 1686 1687 1687 The file is read only. 1688 + 1689 + What: /sys/bus/platform/drivers/ufshcd/*/hid/analysis_trigger 1690 + What: /sys/bus/platform/devices/*.ufs/hid/analysis_trigger 1691 + Date: May 2025 1692 + Contact: Huan Tang <tanghuan@vivo.com> 1693 + Description: 1694 + The host can enable or disable HID analysis operation. 1695 + 1696 + ======= ========================================= 1697 + disable disable HID analysis operation 1698 + enable enable HID analysis operation 1699 + ======= ========================================= 1700 + 1701 + The file is write only. 1702 + 1703 + What: /sys/bus/platform/drivers/ufshcd/*/hid/defrag_trigger 1704 + What: /sys/bus/platform/devices/*.ufs/hid/defrag_trigger 1705 + Date: May 2025 1706 + Contact: Huan Tang <tanghuan@vivo.com> 1707 + Description: 1708 + The host can enable or disable HID defragmentation operation. 1709 + 1710 + ======= ========================================= 1711 + disable disable HID defragmentation operation 1712 + enable enable HID defragmentation operation 1713 + ======= ========================================= 1714 + 1715 + The attribute is write only. 1716 + 1717 + What: /sys/bus/platform/drivers/ufshcd/*/hid/fragmented_size 1718 + What: /sys/bus/platform/devices/*.ufs/hid/fragmented_size 1719 + Date: May 2025 1720 + Contact: Huan Tang <tanghuan@vivo.com> 1721 + Description: 1722 + The total fragmented size in the device is reported through 1723 + this attribute. 1724 + 1725 + The attribute is read only. 1726 + 1727 + What: /sys/bus/platform/drivers/ufshcd/*/hid/defrag_size 1728 + What: /sys/bus/platform/devices/*.ufs/hid/defrag_size 1729 + Date: May 2025 1730 + Contact: Huan Tang <tanghuan@vivo.com> 1731 + Description: 1732 + The host sets the size to be defragmented by an HID 1733 + defragmentation operation. 1734 + 1735 + The attribute is read/write. 1736 + 1737 + What: /sys/bus/platform/drivers/ufshcd/*/hid/progress_ratio 1738 + What: /sys/bus/platform/devices/*.ufs/hid/progress_ratio 1739 + Date: May 2025 1740 + Contact: Huan Tang <tanghuan@vivo.com> 1741 + Description: 1742 + Defragmentation progress is reported by this attribute, 1743 + indicates the ratio of the completed defragmentation size 1744 + over the requested defragmentation size. 1745 + 1746 + ==== ============================================ 1747 + 1 1% 1748 + ... 1749 + 100 100% 1750 + ==== ============================================ 1751 + 1752 + The attribute is read only. 1753 + 1754 + What: /sys/bus/platform/drivers/ufshcd/*/hid/state 1755 + What: /sys/bus/platform/devices/*.ufs/hid/state 1756 + Date: May 2025 1757 + Contact: Huan Tang <tanghuan@vivo.com> 1758 + Description: 1759 + The HID state is reported by this attribute. 1760 + 1761 + ==================== =========================== 1762 + idle Idle (analysis required) 1763 + analysis_in_progress Analysis in progress 1764 + defrag_required Defrag required 1765 + defrag_in_progress Defrag in progress 1766 + defrag_completed Defrag completed 1767 + defrag_not_required Defrag is not required 1768 + ==================== =========================== 1769 + 1770 + The attribute is read only.
+34 -1
Documentation/scsi/scsi_fc_transport.rst
··· 30 30 31 31 FC Remote Ports (rports) 32 32 ======================== 33 - << To Be Supplied >> 33 + 34 + In the Fibre Channel (FC) subsystem, a remote port (rport) refers to a 35 + remote Fibre Channel node that the local port can communicate with. 36 + These are typically storage targets (e.g., arrays, tapes) that respond 37 + to SCSI commands over FC transport. 38 + 39 + In Linux, rports are managed by the FC transport class and are 40 + represented in sysfs under: 41 + 42 + /sys/class/fc_remote_ports/ 43 + 44 + Each rport directory contains attributes describing the remote port, 45 + such as port ID, node name, port state, and link speed. 46 + 47 + rports are typically created by the FC transport when a new device is 48 + discovered during a fabric login or scan, and they persist until the 49 + device is removed or the link is lost. 50 + 51 + Common attributes: 52 + - node_name: World Wide Node Name (WWNN). 53 + - port_name: World Wide Port Name (WWPN). 54 + - port_id: FC address of the remote port. 55 + - roles: Indicates if the port is an initiator, target, or both. 56 + - port_state: Shows the current operational state. 57 + 58 + After discovering a remote port, the driver typically populates a 59 + fc_rport_identifiers structure and invokes fc_remote_port_add() to 60 + create and register the remote port with the SCSI subsystem via the 61 + Fibre Channel (FC) transport class. 62 + 63 + rports are also visible via sysfs as children of the FC host adapter. 64 + 65 + For developers: use fc_remote_port_add() and fc_remote_port_delete() when 66 + implementing a driver that interacts with the FC transport class. 34 67 35 68 36 69 FC Virtual Ports (vports)
+1
drivers/scsi/bfa/bfad_im.c
··· 706 706 707 707 if (bfad_thread_workq(bfad) != BFA_STATUS_OK) { 708 708 kfree(im); 709 + bfad->im = NULL; 709 710 return BFA_STATUS_FAILED; 710 711 } 711 712
+1 -1
drivers/scsi/elx/efct/efct_lio.c
··· 382 382 return; 383 383 384 384 dma_unmap_sg(&io->efct->pci->dev, cmd->t_data_sg, 385 - ocp->seg_map_cnt, cmd->data_direction); 385 + cmd->t_data_nents, cmd->data_direction); 386 386 ocp->seg_map_cnt = 0; 387 387 } 388 388
+1 -21
drivers/scsi/fcoe/fcoe.c
··· 1300 1300 } 1301 1301 1302 1302 /** 1303 - * fcoe_select_cpu() - Selects CPU to handle post-processing of incoming 1304 - * command. 1305 - * 1306 - * This routine selects next CPU based on cpumask to distribute 1307 - * incoming requests in round robin. 1308 - * 1309 - * Returns: int CPU number 1310 - */ 1311 - static inline unsigned int fcoe_select_cpu(void) 1312 - { 1313 - static unsigned int selected_cpu; 1314 - 1315 - selected_cpu = cpumask_next(selected_cpu, cpu_online_mask); 1316 - if (selected_cpu >= nr_cpu_ids) 1317 - selected_cpu = cpumask_first(cpu_online_mask); 1318 - 1319 - return selected_cpu; 1320 - } 1321 - 1322 - /** 1323 1303 * fcoe_rcv() - Receive packets from a net device 1324 1304 * @skb: The received packet 1325 1305 * @netdev: The net device that the packet was received on ··· 1385 1405 cpu = ntohs(fh->fh_ox_id) & fc_cpu_mask; 1386 1406 else { 1387 1407 if (ntohs(fh->fh_rx_id) == FC_XID_UNKNOWN) 1388 - cpu = fcoe_select_cpu(); 1408 + cpu = skb->alloc_cpu; 1389 1409 else 1390 1410 cpu = ntohs(fh->fh_rx_id) & fc_cpu_mask; 1391 1411 }
+3 -3
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
··· 2401 2401 slot_err_v2_hw(hisi_hba, task, slot, 2); 2402 2402 2403 2403 if (ts->stat != SAS_DATA_UNDERRUN) 2404 - dev_info(dev, "erroneous completion iptt=%d task=%pK dev id=%d CQ hdr: 0x%x 0x%x 0x%x 0x%x Error info: 0x%x 0x%x 0x%x 0x%x\n", 2404 + dev_info(dev, "erroneous completion iptt=%d task=%p dev id=%d CQ hdr: 0x%x 0x%x 0x%x 0x%x Error info: 0x%x 0x%x 0x%x 0x%x\n", 2405 2405 slot->idx, task, sas_dev->device_id, 2406 2406 complete_hdr->dw0, complete_hdr->dw1, 2407 2407 complete_hdr->act, complete_hdr->dw3, ··· 2467 2467 spin_lock_irqsave(&task->task_state_lock, flags); 2468 2468 if (task->task_state_flags & SAS_TASK_STATE_ABORTED) { 2469 2469 spin_unlock_irqrestore(&task->task_state_lock, flags); 2470 - dev_info(dev, "slot complete: task(%pK) aborted\n", task); 2470 + dev_info(dev, "slot complete: task(%p) aborted\n", task); 2471 2471 return; 2472 2472 } 2473 2473 task->task_state_flags |= SAS_TASK_STATE_DONE; ··· 2478 2478 spin_lock_irqsave(&device->done_lock, flags); 2479 2479 if (test_bit(SAS_HA_FROZEN, &ha->state)) { 2480 2480 spin_unlock_irqrestore(&device->done_lock, flags); 2481 - dev_info(dev, "slot complete: task(%pK) ignored\n", 2481 + dev_info(dev, "slot complete: task(%p) ignored\n", 2482 2482 task); 2483 2483 return; 2484 2484 }
+3 -3
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
··· 2409 2409 2410 2410 if (slot_err_v3_hw(hisi_hba, task, slot)) { 2411 2411 if (ts->stat != SAS_DATA_UNDERRUN) 2412 - dev_info(dev, "erroneous completion iptt=%d task=%pK dev id=%d addr=%016llx CQ hdr: 0x%x 0x%x 0x%x 0x%x Error info: 0x%x 0x%x 0x%x 0x%x\n", 2412 + dev_info(dev, "erroneous completion iptt=%d task=%p dev id=%d addr=%016llx CQ hdr: 0x%x 0x%x 0x%x 0x%x Error info: 0x%x 0x%x 0x%x 0x%x\n", 2413 2413 slot->idx, task, sas_dev->device_id, 2414 2414 SAS_ADDR(device->sas_addr), 2415 2415 dw0, dw1, complete_hdr->act, dw3, ··· 2470 2470 spin_lock_irqsave(&task->task_state_lock, flags); 2471 2471 if (task->task_state_flags & SAS_TASK_STATE_ABORTED) { 2472 2472 spin_unlock_irqrestore(&task->task_state_lock, flags); 2473 - dev_info(dev, "slot complete: task(%pK) aborted\n", task); 2473 + dev_info(dev, "slot complete: task(%p) aborted\n", task); 2474 2474 return; 2475 2475 } 2476 2476 task->task_state_flags |= SAS_TASK_STATE_DONE; ··· 2481 2481 spin_lock_irqsave(&device->done_lock, flags); 2482 2482 if (test_bit(SAS_HA_FROZEN, &ha->state)) { 2483 2483 spin_unlock_irqrestore(&device->done_lock, flags); 2484 - dev_info(dev, "slot complete: task(%pK) ignored\n", 2484 + dev_info(dev, "slot complete: task(%p) ignored\n", 2485 2485 task); 2486 2486 return; 2487 2487 }
+1 -1
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
··· 425 425 426 426 /* 427 427 * check which state we are in and see if we 428 - * should transitition to the new state 428 + * should transition to the new state 429 429 */ 430 430 switch (vscsi->state) { 431 431 /* Should never be called while in this state. */
+4 -2
drivers/scsi/ibmvscsi_tgt/libsrp.c
··· 184 184 err = rdma_io(cmd, sg, nsg, md, 1, dir, len); 185 185 186 186 if (dma_map) 187 - dma_unmap_sg(iue->target->dev, sg, nsg, DMA_BIDIRECTIONAL); 187 + dma_unmap_sg(iue->target->dev, sg, cmd->se_cmd.t_data_nents, 188 + DMA_BIDIRECTIONAL); 188 189 189 190 return err; 190 191 } ··· 257 256 err = rdma_io(cmd, sg, nsg, md, nmd, dir, len); 258 257 259 258 if (dma_map) 260 - dma_unmap_sg(iue->target->dev, sg, nsg, DMA_BIDIRECTIONAL); 259 + dma_unmap_sg(iue->target->dev, sg, cmd->se_cmd.t_data_nents, 260 + DMA_BIDIRECTIONAL); 261 261 262 262 free_mem: 263 263 if (token && dma_map) {
+1 -1
drivers/scsi/isci/request.c
··· 2904 2904 task->total_xfer_len, task->data_dir); 2905 2905 else /* unmap the sgl dma addresses */ 2906 2906 dma_unmap_sg(&ihost->pdev->dev, task->scatter, 2907 - request->num_sg_entries, task->data_dir); 2907 + task->num_scatter, task->data_dir); 2908 2908 break; 2909 2909 case SAS_PROTOCOL_SMP: { 2910 2910 struct scatterlist *sg = &task->smp_task.smp_req;
+2 -1
drivers/scsi/libiscsi.c
··· 3185 3185 return NULL; 3186 3186 conn = cls_conn->dd_data; 3187 3187 3188 - conn->dd_data = cls_conn->dd_data + sizeof(*conn); 3188 + if (dd_size) 3189 + conn->dd_data = cls_conn->dd_data + sizeof(*conn); 3189 3190 conn->session = session; 3190 3191 conn->cls_conn = cls_conn; 3191 3192 conn->c_stage = ISCSI_CONN_INITIAL_STAGE;
+8 -20
drivers/scsi/lpfc/lpfc_ct.c
··· 1 1 /******************************************************************* 2 2 * This file is part of the Emulex Linux Device Driver for * 3 3 * Fibre Channel Host Bus Adapters. * 4 - * Copyright (C) 2017-2024 Broadcom. All Rights Reserved. The term * 4 + * Copyright (C) 2017-2025 Broadcom. All Rights Reserved. The term * 5 5 * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * 6 6 * Copyright (C) 2004-2016 Emulex. All rights reserved. * 7 7 * EMULEX and SLI are trademarks of Emulex. * ··· 264 264 ct_free_mp: 265 265 kfree(mp); 266 266 ct_exit: 267 - lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, 268 - "6440 Unsol CT: Rsp err %d Data: x%lx\n", 269 - rc, vport->fc_flag); 267 + lpfc_vlog_msg(vport, KERN_WARNING, LOG_ELS, 268 + "6440 Unsol CT: Rsp err %d Data: x%lx\n", 269 + rc, vport->fc_flag); 270 270 } 271 271 272 272 /** ··· 313 313 314 314 mi_cmd = be16_to_cpu(ct_req->CommandResponse.bits.CmdRsp); 315 315 lpfc_vlog_msg(vport, KERN_WARNING, LOG_ELS, 316 - "6442 MI Cmd : x%x Not Supported\n", mi_cmd); 316 + "6442 MI Cmd: x%x Not Supported\n", mi_cmd); 317 317 lpfc_ct_reject_event(ndlp, ct_req, 318 318 bf_get(wqe_ctxt_tag, 319 319 &ctiocbq->wqe.xmit_els_rsp.wqe_com), ··· 2229 2229 /* Look for a retryable error */ 2230 2230 if (ulp_status == IOSTAT_LOCAL_REJECT) { 2231 2231 switch ((ulp_word4 & IOERR_PARAM_MASK)) { 2232 - case IOERR_SLI_ABORTED: 2233 - case IOERR_SLI_DOWN: 2234 - /* Driver aborted this IO. No retry as error 2235 - * is likely Offline->Online or some adapter 2236 - * error. Recovery will try again, but if port 2237 - * is not active there's no point to continue 2238 - * issuing follow up FDMI commands. 2239 - */ 2240 - if (!(phba->sli.sli_flag & LPFC_SLI_ACTIVE)) { 2241 - free_ndlp = cmdiocb->ndlp; 2242 - lpfc_ct_free_iocb(phba, cmdiocb); 2243 - lpfc_nlp_put(free_ndlp); 2244 - return; 2245 - } 2246 - break; 2247 2232 case IOERR_ABORT_IN_PROGRESS: 2248 2233 case IOERR_SEQUENCE_TIMEOUT: 2249 2234 case IOERR_ILLEGAL_FRAME: ··· 2253 2268 free_ndlp = cmdiocb->ndlp; 2254 2269 lpfc_ct_free_iocb(phba, cmdiocb); 2255 2270 lpfc_nlp_put(free_ndlp); 2271 + 2272 + if (ulp_status != IOSTAT_SUCCESS) 2273 + return; 2256 2274 2257 2275 ndlp = lpfc_findnode_did(vport, FDMI_DID); 2258 2276 if (!ndlp)
+10 -10
drivers/scsi/lpfc/lpfc_debugfs.c
··· 1 1 /******************************************************************* 2 2 * This file is part of the Emulex Linux Device Driver for * 3 3 * Fibre Channel Host Bus Adapters. * 4 - * Copyright (C) 2017-2024 Broadcom. All Rights Reserved. The term * 4 + * Copyright (C) 2017-2025 Broadcom. All Rights Reserved. The term * 5 5 * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * 6 6 * Copyright (C) 2007-2015 Emulex. All rights reserved. * 7 7 * EMULEX and SLI are trademarks of Emulex. * ··· 6218 6218 i++; 6219 6219 } 6220 6220 lpfc_debugfs_max_slow_ring_trc = (1 << i); 6221 - pr_err("lpfc_debugfs_max_disc_trc changed to " 6222 - "%d\n", lpfc_debugfs_max_disc_trc); 6221 + pr_info("lpfc_debugfs_max_slow_ring_trc " 6222 + "changed to %d\n", 6223 + lpfc_debugfs_max_slow_ring_trc); 6223 6224 } 6224 6225 } 6225 6226 ··· 6252 6251 atomic_set(&phba->nvmeio_trc_cnt, 0); 6253 6252 if (lpfc_debugfs_max_nvmeio_trc) { 6254 6253 num = lpfc_debugfs_max_nvmeio_trc - 1; 6255 - if (num & lpfc_debugfs_max_disc_trc) { 6254 + if (num & lpfc_debugfs_max_nvmeio_trc) { 6256 6255 /* Change to be a power of 2 */ 6257 6256 num = lpfc_debugfs_max_nvmeio_trc; 6258 6257 i = 0; ··· 6261 6260 i++; 6262 6261 } 6263 6262 lpfc_debugfs_max_nvmeio_trc = (1 << i); 6264 - lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 6265 - "0575 lpfc_debugfs_max_nvmeio_trc " 6266 - "changed to %d\n", 6267 - lpfc_debugfs_max_nvmeio_trc); 6263 + pr_info("lpfc_debugfs_max_nvmeio_trc changed " 6264 + "to %d\n", 6265 + lpfc_debugfs_max_nvmeio_trc); 6268 6266 } 6269 6267 phba->nvmeio_trc_size = lpfc_debugfs_max_nvmeio_trc; 6270 6268 ··· 6308 6308 i++; 6309 6309 } 6310 6310 lpfc_debugfs_max_disc_trc = (1 << i); 6311 - pr_err("lpfc_debugfs_max_disc_trc changed to %d\n", 6312 - lpfc_debugfs_max_disc_trc); 6311 + pr_info("lpfc_debugfs_max_disc_trc changed to %d\n", 6312 + lpfc_debugfs_max_disc_trc); 6313 6313 } 6314 6314 } 6315 6315
+9 -2
drivers/scsi/lpfc/lpfc_els.c
··· 7861 7861 7862 7862 /* Move all affected nodes by pending RSCNs to NPR state. */ 7863 7863 list_for_each_entry_safe(ndlp, n, &vport->fc_nodes, nlp_listp) { 7864 + if (test_bit(FC_UNLOADING, &vport->load_flag)) { 7865 + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, 7866 + "1000 %s Unloading set\n", 7867 + __func__); 7868 + return 0; 7869 + } 7870 + 7864 7871 if ((ndlp->nlp_state == NLP_STE_UNUSED_NODE) || 7865 7872 !lpfc_rscn_payload_check(vport, ndlp->nlp_DID)) 7866 7873 continue; ··· 8376 8369 clear_bit(FC_PUBLIC_LOOP, &vport->fc_flag); 8377 8370 lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, 8378 8371 "3311 Rcv Flogi PS x%x new PS x%x " 8379 - "fc_flag x%lx new fc_flag x%lx\n", 8372 + "fc_flag x%lx new fc_flag x%lx, hba_flag x%lx\n", 8380 8373 port_state, vport->port_state, 8381 - fc_flag, vport->fc_flag); 8374 + fc_flag, vport->fc_flag, phba->hba_flag); 8382 8375 8383 8376 /* 8384 8377 * We temporarily set fc_myDID to make it look like we are
+6 -5
drivers/scsi/lpfc/lpfc_hbadisc.c
··· 183 183 184 184 /* Don't schedule a worker thread event if the vport is going down. */ 185 185 if (test_bit(FC_UNLOADING, &vport->load_flag) || 186 - !test_bit(HBA_SETUP, &phba->hba_flag)) { 186 + (phba->sli_rev == LPFC_SLI_REV4 && 187 + !test_bit(HBA_SETUP, &phba->hba_flag))) { 187 188 188 189 spin_lock_irqsave(&ndlp->lock, iflags); 189 190 ndlp->rport = NULL; ··· 1267 1266 } 1268 1267 phba->defer_flogi_acc.flag = false; 1269 1268 1269 + /* reinitialize initial HBA flag */ 1270 + clear_bit(HBA_FLOGI_ISSUED, &phba->hba_flag); 1271 + clear_bit(HBA_RHBA_CMPL, &phba->hba_flag); 1272 + 1270 1273 /* Clear external loopback plug detected flag */ 1271 1274 phba->link_flag &= ~LS_EXTERNAL_LOOPBACK; 1272 1275 ··· 1440 1435 spin_lock_irq(shost->host_lock); 1441 1436 phba->pport->rcv_flogi_cnt = 0; 1442 1437 spin_unlock_irq(shost->host_lock); 1443 - 1444 - /* reinitialize initial HBA flag */ 1445 - clear_bit(HBA_FLOGI_ISSUED, &phba->hba_flag); 1446 - clear_bit(HBA_RHBA_CMPL, &phba->hba_flag); 1447 1438 1448 1439 return 0; 1449 1440 }
+13 -7
drivers/scsi/lpfc/lpfc_hw4.h
··· 1 1 /******************************************************************* 2 2 * This file is part of the Emulex Linux Device Driver for * 3 3 * Fibre Channel Host Bus Adapters. * 4 - * Copyright (C) 2017-2024 Broadcom. All Rights Reserved. The term * 4 + * Copyright (C) 2017-2025 Broadcom. All Rights Reserved. The term * 5 5 * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * 6 6 * Copyright (C) 2009-2016 Emulex. All rights reserved. * 7 7 * EMULEX and SLI are trademarks of Emulex. * ··· 1328 1328 #define LPFC_CQ_CNT_512 0x1 1329 1329 #define LPFC_CQ_CNT_1024 0x2 1330 1330 #define LPFC_CQ_CNT_WORD7 0x3 1331 + #define lpfc_cq_context_cqe_sz_SHIFT 25 1332 + #define lpfc_cq_context_cqe_sz_MASK 0x00000003 1333 + #define lpfc_cq_context_cqe_sz_WORD word0 1331 1334 #define lpfc_cq_context_autovalid_SHIFT 15 1332 1335 #define lpfc_cq_context_autovalid_MASK 0x00000001 1333 1336 #define lpfc_cq_context_autovalid_WORD word0 ··· 1386 1383 #define lpfc_mbx_cq_create_set_valid_SHIFT 29 1387 1384 #define lpfc_mbx_cq_create_set_valid_MASK 0x00000001 1388 1385 #define lpfc_mbx_cq_create_set_valid_WORD word1 1389 - #define lpfc_mbx_cq_create_set_cqe_cnt_SHIFT 27 1390 - #define lpfc_mbx_cq_create_set_cqe_cnt_MASK 0x00000003 1391 - #define lpfc_mbx_cq_create_set_cqe_cnt_WORD word1 1386 + #define lpfc_mbx_cq_create_set_cqecnt_SHIFT 27 1387 + #define lpfc_mbx_cq_create_set_cqecnt_MASK 0x00000003 1388 + #define lpfc_mbx_cq_create_set_cqecnt_WORD word1 1392 1389 #define lpfc_mbx_cq_create_set_cqe_size_SHIFT 25 1393 1390 #define lpfc_mbx_cq_create_set_cqe_size_MASK 0x00000003 1394 1391 #define lpfc_mbx_cq_create_set_cqe_size_WORD word1 ··· 1401 1398 #define lpfc_mbx_cq_create_set_clswm_SHIFT 12 1402 1399 #define lpfc_mbx_cq_create_set_clswm_MASK 0x00000003 1403 1400 #define lpfc_mbx_cq_create_set_clswm_WORD word1 1401 + #define lpfc_mbx_cq_create_set_cqe_cnt_hi_SHIFT 0 1402 + #define lpfc_mbx_cq_create_set_cqe_cnt_hi_MASK 0x0000001F 1403 + #define lpfc_mbx_cq_create_set_cqe_cnt_hi_WORD word1 1404 1404 uint32_t word2; 1405 1405 #define lpfc_mbx_cq_create_set_arm_SHIFT 31 1406 1406 #define lpfc_mbx_cq_create_set_arm_MASK 0x00000001 1407 1407 #define lpfc_mbx_cq_create_set_arm_WORD word2 1408 - #define lpfc_mbx_cq_create_set_cq_cnt_SHIFT 16 1409 - #define lpfc_mbx_cq_create_set_cq_cnt_MASK 0x00007FFF 1410 - #define lpfc_mbx_cq_create_set_cq_cnt_WORD word2 1408 + #define lpfc_mbx_cq_create_set_cqe_cnt_lo_SHIFT 16 1409 + #define lpfc_mbx_cq_create_set_cqe_cnt_lo_MASK 0x00007FFF 1410 + #define lpfc_mbx_cq_create_set_cqe_cnt_lo_WORD word2 1411 1411 #define lpfc_mbx_cq_create_set_num_cq_SHIFT 0 1412 1412 #define lpfc_mbx_cq_create_set_num_cq_MASK 0x0000FFFF 1413 1413 #define lpfc_mbx_cq_create_set_num_cq_WORD word2
+41 -43
drivers/scsi/lpfc/lpfc_init.c
··· 2627 2627 "Obsolete, Unsupported Fibre Channel Adapter"}; 2628 2628 break; 2629 2629 case PCI_DEVICE_ID_BMID: 2630 - m = (typeof(m)){"LP1150", "PCI-X2", "Fibre Channel Adapter"}; 2630 + m = (typeof(m)){"LP1150", "PCI-X2", 2631 + "Obsolete, Unsupported Fibre Channel Adapter"}; 2631 2632 break; 2632 2633 case PCI_DEVICE_ID_BSMB: 2633 2634 m = (typeof(m)){"LP111", "PCI-X2", 2634 2635 "Obsolete, Unsupported Fibre Channel Adapter"}; 2635 2636 break; 2636 2637 case PCI_DEVICE_ID_ZEPHYR: 2637 - m = (typeof(m)){"LPe11000", "PCIe", "Fibre Channel Adapter"}; 2638 + m = (typeof(m)){"LPe11000", "PCIe", 2639 + "Obsolete, Unsupported Fibre Channel Adapter"}; 2638 2640 break; 2639 2641 case PCI_DEVICE_ID_ZEPHYR_SCSP: 2640 - m = (typeof(m)){"LPe11000", "PCIe", "Fibre Channel Adapter"}; 2642 + m = (typeof(m)){"LPe11000", "PCIe", 2643 + "Obsolete, Unsupported Fibre Channel Adapter"}; 2641 2644 break; 2642 2645 case PCI_DEVICE_ID_ZEPHYR_DCSP: 2643 - m = (typeof(m)){"LP2105", "PCIe", "FCoE Adapter"}; 2646 + m = (typeof(m)){"LP2105", "PCIe", 2647 + "Obsolete, Unsupported FCoE Adapter"}; 2644 2648 GE = 1; 2645 2649 break; 2646 2650 case PCI_DEVICE_ID_ZMID: 2647 - m = (typeof(m)){"LPe1150", "PCIe", "Fibre Channel Adapter"}; 2651 + m = (typeof(m)){"LPe1150", "PCIe", 2652 + "Obsolete, Unsupported Fibre Channel Adapter"}; 2648 2653 break; 2649 2654 case PCI_DEVICE_ID_ZSMB: 2650 - m = (typeof(m)){"LPe111", "PCIe", "Fibre Channel Adapter"}; 2655 + m = (typeof(m)){"LPe111", "PCIe", 2656 + "Obsolete, Unsupported Fibre Channel Adapter"}; 2651 2657 break; 2652 2658 case PCI_DEVICE_ID_LP101: 2653 2659 m = (typeof(m)){"LP101", "PCI-X", ··· 2672 2666 "Obsolete, Unsupported Fibre Channel Adapter"}; 2673 2667 break; 2674 2668 case PCI_DEVICE_ID_SAT: 2675 - m = (typeof(m)){"LPe12000", "PCIe", "Fibre Channel Adapter"}; 2669 + m = (typeof(m)){"LPe12000", "PCIe", 2670 + "Obsolete, Unsupported Fibre Channel Adapter"}; 2676 2671 break; 2677 2672 case PCI_DEVICE_ID_SAT_MID: 2678 - m = (typeof(m)){"LPe1250", "PCIe", "Fibre Channel Adapter"}; 2673 + m = (typeof(m)){"LPe1250", "PCIe", 2674 + "Obsolete, Unsupported Fibre Channel Adapter"}; 2679 2675 break; 2680 2676 case PCI_DEVICE_ID_SAT_SMB: 2681 - m = (typeof(m)){"LPe121", "PCIe", "Fibre Channel Adapter"}; 2677 + m = (typeof(m)){"LPe121", "PCIe", 2678 + "Obsolete, Unsupported Fibre Channel Adapter"}; 2682 2679 break; 2683 2680 case PCI_DEVICE_ID_SAT_DCSP: 2684 - m = (typeof(m)){"LPe12002-SP", "PCIe", "Fibre Channel Adapter"}; 2681 + m = (typeof(m)){"LPe12002-SP", "PCIe", 2682 + "Obsolete, Unsupported Fibre Channel Adapter"}; 2685 2683 break; 2686 2684 case PCI_DEVICE_ID_SAT_SCSP: 2687 - m = (typeof(m)){"LPe12000-SP", "PCIe", "Fibre Channel Adapter"}; 2685 + m = (typeof(m)){"LPe12000-SP", "PCIe", 2686 + "Obsolete, Unsupported Fibre Channel Adapter"}; 2688 2687 break; 2689 2688 case PCI_DEVICE_ID_SAT_S: 2690 - m = (typeof(m)){"LPe12000-S", "PCIe", "Fibre Channel Adapter"}; 2689 + m = (typeof(m)){"LPe12000-S", "PCIe", 2690 + "Obsolete, Unsupported Fibre Channel Adapter"}; 2691 2691 break; 2692 2692 case PCI_DEVICE_ID_PROTEUS_VF: 2693 2693 m = (typeof(m)){"LPev12000", "PCIe IOV", ··· 2709 2697 break; 2710 2698 case PCI_DEVICE_ID_TIGERSHARK: 2711 2699 oneConnect = 1; 2712 - m = (typeof(m)){"OCe10100", "PCIe", "FCoE"}; 2700 + m = (typeof(m)){"OCe10100", "PCIe", 2701 + "Obsolete, Unsupported FCoE Adapter"}; 2713 2702 break; 2714 2703 case PCI_DEVICE_ID_TOMCAT: 2715 2704 oneConnect = 1; 2716 - m = (typeof(m)){"OCe11100", "PCIe", "FCoE"}; 2705 + m = (typeof(m)){"OCe11100", "PCIe", 2706 + "Obsolete, Unsupported FCoE Adapter"}; 2717 2707 break; 2718 2708 case PCI_DEVICE_ID_FALCON: 2719 2709 m = (typeof(m)){"LPSe12002-ML1-E", "PCIe", 2720 - "EmulexSecure Fibre"}; 2710 + "Obsolete, Unsupported Fibre Channel Adapter"}; 2721 2711 break; 2722 2712 case PCI_DEVICE_ID_BALIUS: 2723 2713 m = (typeof(m)){"LPVe12002", "PCIe Shared I/O", 2724 2714 "Obsolete, Unsupported Fibre Channel Adapter"}; 2725 2715 break; 2726 2716 case PCI_DEVICE_ID_LANCER_FC: 2727 - m = (typeof(m)){"LPe16000", "PCIe", "Fibre Channel Adapter"}; 2717 + m = (typeof(m)){"LPe16000", "PCIe", 2718 + "Obsolete, Unsupported Fibre Channel Adapter"}; 2728 2719 break; 2729 2720 case PCI_DEVICE_ID_LANCER_FC_VF: 2730 2721 m = (typeof(m)){"LPe16000", "PCIe", ··· 2735 2720 break; 2736 2721 case PCI_DEVICE_ID_LANCER_FCOE: 2737 2722 oneConnect = 1; 2738 - m = (typeof(m)){"OCe15100", "PCIe", "FCoE"}; 2723 + m = (typeof(m)){"OCe15100", "PCIe", 2724 + "Obsolete, Unsupported FCoE Adapter"}; 2739 2725 break; 2740 2726 case PCI_DEVICE_ID_LANCER_FCOE_VF: 2741 2727 oneConnect = 1; 2742 2728 m = (typeof(m)){"OCe15100", "PCIe", 2743 - "Obsolete, Unsupported FCoE"}; 2729 + "Obsolete, Unsupported FCoE Adapter"}; 2744 2730 break; 2745 2731 case PCI_DEVICE_ID_LANCER_G6_FC: 2746 2732 m = (typeof(m)){"LPe32000", "PCIe", "Fibre Channel Adapter"}; ··· 2755 2739 case PCI_DEVICE_ID_SKYHAWK: 2756 2740 case PCI_DEVICE_ID_SKYHAWK_VF: 2757 2741 oneConnect = 1; 2758 - m = (typeof(m)){"OCe14000", "PCIe", "FCoE"}; 2742 + m = (typeof(m)){"OCe14000", "PCIe", 2743 + "Obsolete, Unsupported FCoE Adapter"}; 2759 2744 break; 2760 2745 default: 2761 2746 m = (typeof(m)){"Unknown", "", ""}; ··· 7936 7919 int longs; 7937 7920 int extra; 7938 7921 uint64_t wwn; 7939 - u32 if_type; 7940 - u32 if_fam; 7941 7922 7942 7923 phba->sli4_hba.num_present_cpu = lpfc_present_cpu; 7943 7924 phba->sli4_hba.num_possible_cpu = cpumask_last(cpu_possible_mask) + 1; ··· 8195 8180 */ 8196 8181 rc = lpfc_get_sli4_parameters(phba, mboxq); 8197 8182 if (rc) { 8198 - if_type = bf_get(lpfc_sli_intf_if_type, 8199 - &phba->sli4_hba.sli_intf); 8200 - if_fam = bf_get(lpfc_sli_intf_sli_family, 8201 - &phba->sli4_hba.sli_intf); 8202 - if (phba->sli4_hba.extents_in_use && 8203 - phba->sli4_hba.rpi_hdrs_in_use) { 8204 - lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, 8205 - "2999 Unsupported SLI4 Parameters " 8206 - "Extents and RPI headers enabled.\n"); 8207 - if (if_type == LPFC_SLI_INTF_IF_TYPE_0 && 8208 - if_fam == LPFC_SLI_INTF_FAMILY_BE2) { 8209 - mempool_free(mboxq, phba->mbox_mem_pool); 8210 - rc = -EIO; 8211 - goto out_free_bsmbx; 8212 - } 8213 - } 8214 - if (!(if_type == LPFC_SLI_INTF_IF_TYPE_0 && 8215 - if_fam == LPFC_SLI_INTF_FAMILY_BE2)) { 8216 - mempool_free(mboxq, phba->mbox_mem_pool); 8217 - rc = -EIO; 8218 - goto out_free_bsmbx; 8219 - } 8183 + lpfc_log_msg(phba, KERN_WARNING, LOG_INIT, 8184 + "2999 Could not get SLI4 parameters\n"); 8185 + rc = -EIO; 8186 + mempool_free(mboxq, phba->mbox_mem_pool); 8187 + goto out_free_bsmbx; 8220 8188 } 8221 8189 8222 8190 /*
+7 -2
drivers/scsi/lpfc/lpfc_scsi.c
··· 1 1 /******************************************************************* 2 2 * This file is part of the Emulex Linux Device Driver for * 3 3 * Fibre Channel Host Bus Adapters. * 4 - * Copyright (C) 2017-2024 Broadcom. All Rights Reserved. The term * 4 + * Copyright (C) 2017-2025 Broadcom. All Rights Reserved. The term * 5 5 * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * 6 6 * Copyright (C) 2004-2016 Emulex. All rights reserved. * 7 7 * EMULEX and SLI are trademarks of Emulex. * ··· 390 390 if (!(vport->cfg_enable_fc4_type & LPFC_ENABLE_FCP)) 391 391 return; 392 392 393 + /* may be called before queues established if hba_setup fails */ 394 + if (!phba->sli4_hba.hdwq) 395 + return; 396 + 393 397 spin_lock_irqsave(&phba->hbalock, iflag); 394 398 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) { 395 399 qp = &phba->sli4_hba.hdwq[idx]; ··· 536 532 psb = container_of(iocbq, struct lpfc_io_buf, cur_iocbq); 537 533 psb->flags &= ~LPFC_SBUF_XBUSY; 538 534 spin_unlock_irqrestore(&phba->hbalock, iflag); 539 - if (!list_empty(&pring->txq)) 535 + if (test_bit(HBA_SETUP, &phba->hba_flag) && 536 + !list_empty(&pring->txq)) 540 537 lpfc_worker_wake_up(phba); 541 538 return; 542 539 }
+7 -7
drivers/scsi/lpfc/lpfc_sli.c
··· 5167 5167 phba->link_events = 0; 5168 5168 phba->pport->fc_myDID = 0; 5169 5169 phba->pport->fc_prevDID = 0; 5170 - clear_bit(HBA_SETUP, &phba->hba_flag); 5171 5170 5172 5171 spin_lock_irq(&phba->hbalock); 5173 5172 psli->sli_flag &= ~(LPFC_PROCESS_LA); ··· 5283 5284 "0296 Restart HBA Data: x%x x%x\n", 5284 5285 phba->pport->port_state, psli->sli_flag); 5285 5286 5287 + clear_bit(HBA_SETUP, &phba->hba_flag); 5286 5288 lpfc_sli4_queue_unset(phba); 5287 5289 5288 5290 rc = lpfc_sli4_brdreset(phba); ··· 16477 16477 case 4096: 16478 16478 if (phba->sli4_hba.pc_sli4_params.cqv == 16479 16479 LPFC_Q_CREATE_VERSION_2) { 16480 - bf_set(lpfc_mbx_cq_create_set_cqe_cnt, 16480 + bf_set(lpfc_mbx_cq_create_set_cqe_cnt_lo, 16481 16481 &cq_set->u.request, 16482 - cq->entry_count); 16483 - bf_set(lpfc_mbx_cq_create_set_cqe_cnt, 16482 + cq->entry_count); 16483 + bf_set(lpfc_mbx_cq_create_set_cqecnt, 16484 16484 &cq_set->u.request, 16485 16485 LPFC_CQ_CNT_WORD7); 16486 16486 break; ··· 16496 16496 } 16497 16497 fallthrough; /* otherwise default to smallest */ 16498 16498 case 256: 16499 - bf_set(lpfc_mbx_cq_create_set_cqe_cnt, 16499 + bf_set(lpfc_mbx_cq_create_set_cqecnt, 16500 16500 &cq_set->u.request, LPFC_CQ_CNT_256); 16501 16501 break; 16502 16502 case 512: 16503 - bf_set(lpfc_mbx_cq_create_set_cqe_cnt, 16503 + bf_set(lpfc_mbx_cq_create_set_cqecnt, 16504 16504 &cq_set->u.request, LPFC_CQ_CNT_512); 16505 16505 break; 16506 16506 case 1024: 16507 - bf_set(lpfc_mbx_cq_create_set_cqe_cnt, 16507 + bf_set(lpfc_mbx_cq_create_set_cqecnt, 16508 16508 &cq_set->u.request, LPFC_CQ_CNT_1024); 16509 16509 break; 16510 16510 }
+3 -1
drivers/scsi/lpfc/lpfc_sli4.h
··· 1 1 /******************************************************************* 2 2 * This file is part of the Emulex Linux Device Driver for * 3 3 * Fibre Channel Host Bus Adapters. * 4 - * Copyright (C) 2017-2024 Broadcom. All Rights Reserved. The term * 4 + * Copyright (C) 2017-2025 Broadcom. All Rights Reserved. The term * 5 5 * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * 6 6 * Copyright (C) 2009-2016 Emulex. All rights reserved. * 7 7 * EMULEX and SLI are trademarks of Emulex. * ··· 575 575 576 576 #define LPFC_CQ_4K_PAGE_SZ 0x1 577 577 #define LPFC_CQ_16K_PAGE_SZ 0x4 578 + #define LPFC_CQ_32K_PAGE_SZ 0x8 578 579 #define LPFC_WQ_4K_PAGE_SZ 0x1 579 580 #define LPFC_WQ_16K_PAGE_SZ 0x4 581 + #define LPFC_WQ_32K_PAGE_SZ 0x8 580 582 581 583 struct lpfc_iov { 582 584 uint32_t pf_number;
+1 -1
drivers/scsi/lpfc/lpfc_version.h
··· 20 20 * included with this package. * 21 21 *******************************************************************/ 22 22 23 - #define LPFC_DRIVER_VERSION "14.4.0.9" 23 + #define LPFC_DRIVER_VERSION "14.4.0.10" 24 24 #define LPFC_DRIVER_NAME "lpfc" 25 25 26 26 /* Used for SLI 2/3 */
+7 -3
drivers/scsi/mpi3mr/mpi3mr.h
··· 56 56 extern int prot_mask; 57 57 extern atomic64_t event_counter; 58 58 59 - #define MPI3MR_DRIVER_VERSION "8.13.0.5.50" 60 - #define MPI3MR_DRIVER_RELDATE "20-February-2025" 59 + #define MPI3MR_DRIVER_VERSION "8.14.0.5.50" 60 + #define MPI3MR_DRIVER_RELDATE "27-June-2025" 61 61 62 62 #define MPI3MR_DRIVER_NAME "mpi3mr" 63 63 #define MPI3MR_DRIVER_LICENSE "GPL" ··· 1137 1137 * @logdata_buf: Circular buffer to store log data entries 1138 1138 * @logdata_buf_idx: Index of entry in buffer to store 1139 1139 * @logdata_entry_sz: log data entry size 1140 + * @adm_req_q_bar_writeq_lock: Admin request queue lock 1141 + * @adm_reply_q_bar_writeq_lock: Admin reply queue lock 1140 1142 * @pend_large_data_sz: Counter to track pending large data 1141 1143 * @io_throttle_data_length: I/O size to track in 512b blocks 1142 1144 * @io_throttle_high: I/O size to start throttle in 512b blocks ··· 1187 1185 char name[MPI3MR_NAME_LENGTH]; 1188 1186 char driver_name[MPI3MR_NAME_LENGTH]; 1189 1187 1190 - volatile struct mpi3_sysif_registers __iomem *sysif_regs; 1188 + struct mpi3_sysif_registers __iomem *sysif_regs; 1191 1189 resource_size_t sysif_regs_phys; 1192 1190 int bars; 1193 1191 u64 dma_mask; ··· 1341 1339 u8 *logdata_buf; 1342 1340 u16 logdata_buf_idx; 1343 1341 u16 logdata_entry_sz; 1342 + spinlock_t adm_req_q_bar_writeq_lock; 1343 + spinlock_t adm_reply_q_bar_writeq_lock; 1344 1344 1345 1345 atomic_t pend_large_data_sz; 1346 1346 u32 io_throttle_data_length;
+6 -4
drivers/scsi/mpi3mr/mpi3mr_app.c
··· 795 795 * 796 796 * @hdb: HDB pointer 797 797 * @type: Trigger type 798 - * @data: Trigger data 799 - * @force: Trigger overwrite flag 800 798 * @trigger_data: Pointer to trigger data information 799 + * @force: Trigger overwrite flag 801 800 * 802 801 * Updates trigger type and trigger data based on parameter 803 802 * passed to this function ··· 821 822 * 822 823 * @mrioc: Adapter instance reference 823 824 * @type: Trigger type 824 - * @data: Trigger data 825 - * @force: Trigger overwrite flag 826 825 * @trigger_data: Pointer to trigger data information 826 + * @force: Trigger overwrite flag 827 827 * 828 828 * Updates trigger type and trigger data based on parameter 829 829 * passed to this function ··· 3386 3388 * @buf: the buffer returned 3387 3389 * 3388 3390 * A sysfs 'read-only' sdev attribute, only works with SATA devices 3391 + * 3392 + * Returns: the number of characters written to @buf 3389 3393 */ 3390 3394 static ssize_t 3391 3395 sas_ncq_prio_supported_show(struct device *dev, ··· 3406 3406 * @buf: the buffer returned 3407 3407 * 3408 3408 * A sysfs 'read/write' sdev attribute, only works with SATA devices 3409 + * 3410 + * Returns: the number of characters written to @buf 3409 3411 */ 3410 3412 static ssize_t 3411 3413 sas_ncq_prio_enable_show(struct device *dev,
+12 -5
drivers/scsi/mpi3mr/mpi3mr_fw.c
··· 23 23 MODULE_PARM_DESC(poll_queues, "Number of queues for io_uring poll mode. (Range 1 - 126)"); 24 24 25 25 #if defined(writeq) && defined(CONFIG_64BIT) 26 - static inline void mpi3mr_writeq(__u64 b, volatile void __iomem *addr) 26 + static inline void mpi3mr_writeq(__u64 b, void __iomem *addr, 27 + spinlock_t *write_queue_lock) 27 28 { 28 29 writeq(b, addr); 29 30 } 30 31 #else 31 - static inline void mpi3mr_writeq(__u64 b, volatile void __iomem *addr) 32 + static inline void mpi3mr_writeq(__u64 b, void __iomem *addr, 33 + spinlock_t *write_queue_lock) 32 34 { 33 35 __u64 data_out = b; 36 + unsigned long flags; 34 37 38 + spin_lock_irqsave(write_queue_lock, flags); 35 39 writel((u32)(data_out), addr); 36 40 writel((u32)(data_out >> 32), (addr + 4)); 41 + spin_unlock_irqrestore(write_queue_lock, flags); 37 42 } 38 43 #endif 39 44 ··· 433 428 MPI3MR_SENSE_BUF_SZ); 434 429 } 435 430 if (cmdptr->is_waiting) { 436 - complete(&cmdptr->done); 437 431 cmdptr->is_waiting = 0; 432 + complete(&cmdptr->done); 438 433 } else if (cmdptr->callback) 439 434 cmdptr->callback(mrioc, cmdptr); 440 435 } ··· 2959 2954 (mrioc->num_admin_req); 2960 2955 writel(num_admin_entries, &mrioc->sysif_regs->admin_queue_num_entries); 2961 2956 mpi3mr_writeq(mrioc->admin_req_dma, 2962 - &mrioc->sysif_regs->admin_request_queue_address); 2957 + &mrioc->sysif_regs->admin_request_queue_address, 2958 + &mrioc->adm_req_q_bar_writeq_lock); 2963 2959 mpi3mr_writeq(mrioc->admin_reply_dma, 2964 - &mrioc->sysif_regs->admin_reply_queue_address); 2960 + &mrioc->sysif_regs->admin_reply_queue_address, 2961 + &mrioc->adm_reply_q_bar_writeq_lock); 2965 2962 writel(mrioc->admin_req_pi, &mrioc->sysif_regs->admin_request_queue_pi); 2966 2963 writel(mrioc->admin_reply_ci, &mrioc->sysif_regs->admin_reply_queue_ci); 2967 2964 return retval;
+21 -1
drivers/scsi/mpi3mr/mpi3mr_os.c
··· 49 49 50 50 #define MPI3_EVENT_WAIT_FOR_DEVICES_TO_REFRESH (0xFFFE) 51 51 52 + /* 53 + * SAS Log info code for a NCQ collateral abort after an NCQ error: 54 + * IOC_LOGINFO_PREFIX_PL | PL_LOGINFO_CODE_SATA_NCQ_FAIL_ALL_CMDS_AFTR_ERR 55 + * See: drivers/message/fusion/lsi/mpi_log_sas.h 56 + */ 57 + #define IOC_LOGINFO_SATA_NCQ_FAIL_AFTER_ERR 0x31080000 58 + 52 59 /** 53 60 * mpi3mr_host_tag_for_scmd - Get host tag for a scmd 54 61 * @mrioc: Adapter instance reference ··· 3437 3430 scmd->result = DID_NO_CONNECT << 16; 3438 3431 break; 3439 3432 case MPI3_IOCSTATUS_SCSI_IOC_TERMINATED: 3440 - scmd->result = DID_SOFT_ERROR << 16; 3433 + if (ioc_loginfo == IOC_LOGINFO_SATA_NCQ_FAIL_AFTER_ERR) { 3434 + /* 3435 + * This is a ATA NCQ command aborted due to another NCQ 3436 + * command failure. We must retry this command 3437 + * immediately but without incrementing its retry 3438 + * counter. 3439 + */ 3440 + WARN_ON_ONCE(xfer_count != 0); 3441 + scmd->result = DID_IMM_RETRY << 16; 3442 + } else { 3443 + scmd->result = DID_SOFT_ERROR << 16; 3444 + } 3441 3445 break; 3442 3446 case MPI3_IOCSTATUS_SCSI_TASK_TERMINATED: 3443 3447 case MPI3_IOCSTATUS_SCSI_EXT_TERMINATED: ··· 5383 5365 spin_lock_init(&mrioc->tgtdev_lock); 5384 5366 spin_lock_init(&mrioc->watchdog_lock); 5385 5367 spin_lock_init(&mrioc->chain_buf_lock); 5368 + spin_lock_init(&mrioc->adm_req_q_bar_writeq_lock); 5369 + spin_lock_init(&mrioc->adm_reply_q_bar_writeq_lock); 5386 5370 spin_lock_init(&mrioc->sas_node_lock); 5387 5371 spin_lock_init(&mrioc->trigger_lock); 5388 5372
-3
drivers/scsi/mpt3sas/mpt3sas_ctl.c
··· 2914 2914 { 2915 2915 struct MPT3SAS_ADAPTER *ioc; 2916 2916 MPI2RequestHeader_t *mpi_request = NULL, *request; 2917 - MPI2DefaultReply_t *mpi_reply; 2918 2917 Mpi26MctpPassthroughRequest_t *mctp_passthru_req; 2919 2918 u16 smid; 2920 2919 unsigned long timeout; ··· 3020 3021 sizeof(Mpi26MctpPassthroughRequest_t) / 4, issue_reset); 3021 3022 goto issue_host_reset; 3022 3023 } 3023 - 3024 - mpi_reply = ioc->ctl_cmds.reply; 3025 3024 3026 3025 /* copy out xdata to user */ 3027 3026 if (data_in_sz)
+19
drivers/scsi/mpt3sas/mpt3sas_scsih.c
··· 195 195 #define MPT3SAS_PORT_ENABLE_COMPLETE (0xFFFD) 196 196 #define MPT3SAS_ABRT_TASK_SET (0xFFFE) 197 197 #define MPT3SAS_REMOVE_UNRESPONDING_DEVICES (0xFFFF) 198 + 199 + /* 200 + * SAS Log info code for a NCQ collateral abort after an NCQ error: 201 + * IOC_LOGINFO_PREFIX_PL | PL_LOGINFO_CODE_SATA_NCQ_FAIL_ALL_CMDS_AFTR_ERR 202 + * See: drivers/message/fusion/lsi/mpi_log_sas.h 203 + */ 204 + #define IOC_LOGINFO_SATA_NCQ_FAIL_AFTER_ERR 0x31080000 205 + 198 206 /** 199 207 * struct fw_event_work - firmware event struct 200 208 * @list: link list framework ··· 5821 5813 if (sas_device_priv_data->block) { 5822 5814 scmd->result = DID_TRANSPORT_DISRUPTED << 16; 5823 5815 goto out; 5816 + } 5817 + if (log_info == IOC_LOGINFO_SATA_NCQ_FAIL_AFTER_ERR) { 5818 + /* 5819 + * This is a ATA NCQ command aborted due to another NCQ 5820 + * command failure. We must retry this command 5821 + * immediately but without incrementing its retry 5822 + * counter. 5823 + */ 5824 + WARN_ON_ONCE(xfer_cnt != 0); 5825 + scmd->result = DID_IMM_RETRY << 16; 5826 + break; 5824 5827 } 5825 5828 if (log_info == 0x31110630) { 5826 5829 if (scmd->retries > 2) {
+2 -2
drivers/scsi/mvsas/mv_sas.c
··· 818 818 dev_printk(KERN_ERR, mvi->dev, "mvsas prep failed[%d]!\n", rc); 819 819 if (!sas_protocol_ata(task->task_proto)) 820 820 if (n_elem) 821 - dma_unmap_sg(mvi->dev, task->scatter, n_elem, 821 + dma_unmap_sg(mvi->dev, task->scatter, task->num_scatter, 822 822 task->data_dir); 823 823 prep_out: 824 824 return rc; ··· 864 864 if (!sas_protocol_ata(task->task_proto)) 865 865 if (slot->n_elem) 866 866 dma_unmap_sg(mvi->dev, task->scatter, 867 - slot->n_elem, task->data_dir); 867 + task->num_scatter, task->data_dir); 868 868 869 869 switch (task->task_proto) { 870 870 case SAS_PROTOCOL_SMP:
+10
drivers/scsi/pm8001/pm8001_sas.h
··· 170 170 #define SPCV_MSGU_CFG_TABLE_TRANSFER_DEBUG_INFO 0x80 171 171 #define MAIN_MERRDCTO_MERRDCES 0xA0/* DWORD 0x28) */ 172 172 173 + /** 174 + * enum fatal_error_reporter: Indicates the originator of the fatal error 175 + */ 176 + enum fatal_error_reporter { 177 + REPORTER_DRIVER, 178 + REPORTER_FIRMWARE, 179 + }; 180 + 173 181 struct pm8001_dispatch { 174 182 char *name; 175 183 int (*chip_init)(struct pm8001_hba_info *pm8001_ha); ··· 723 715 struct device_attribute *attr, char *buf); 724 716 ssize_t pm8001_get_gsm_dump(struct device *cdev, u32, char *buf); 725 717 int pm80xx_fatal_errors(struct pm8001_hba_info *pm8001_ha); 718 + void pm80xx_fatal_error_uevent_emit(struct pm8001_hba_info *pm8001_ha, 719 + enum fatal_error_reporter error_reporter); 726 720 void pm8001_free_dev(struct pm8001_device *pm8001_dev); 727 721 /* ctl shared API */ 728 722 extern const struct attribute_group *pm8001_host_groups[];
+58 -2
drivers/scsi/pm8001/pm80xx_hwi.c
··· 1552 1552 } 1553 1553 1554 1554 /** 1555 + * pm80xx_fatal_error_uevent_emit - emits a single fatal error uevent 1556 + * @pm8001_ha: our hba card information 1557 + * @error_reporter: reporter of fatal error 1558 + */ 1559 + void pm80xx_fatal_error_uevent_emit(struct pm8001_hba_info *pm8001_ha, 1560 + enum fatal_error_reporter error_reporter) 1561 + { 1562 + struct kobj_uevent_env *env; 1563 + 1564 + pm8001_dbg(pm8001_ha, FAIL, "emitting fatal error uevent"); 1565 + 1566 + env = kzalloc(sizeof(struct kobj_uevent_env), GFP_KERNEL); 1567 + if (!env) 1568 + return; 1569 + 1570 + if (add_uevent_var(env, "DRIVER=%s", DRV_NAME)) 1571 + goto exit; 1572 + 1573 + if (add_uevent_var(env, "HBA_NUM=%u", pm8001_ha->id)) 1574 + goto exit; 1575 + 1576 + if (add_uevent_var(env, "EVENT_TYPE=FATAL_ERROR")) 1577 + goto exit; 1578 + 1579 + switch (error_reporter) { 1580 + case REPORTER_DRIVER: 1581 + if (add_uevent_var(env, "REPORTED_BY=DRIVER")) 1582 + goto exit; 1583 + break; 1584 + case REPORTER_FIRMWARE: 1585 + if (add_uevent_var(env, "REPORTED_BY=FIRMWARE")) 1586 + goto exit; 1587 + break; 1588 + default: 1589 + if (add_uevent_var(env, "REPORTED_BY=OTHER")) 1590 + goto exit; 1591 + break; 1592 + } 1593 + 1594 + kobject_uevent_env(&pm8001_ha->shost->shost_dev.kobj, KOBJ_CHANGE, env->envp); 1595 + 1596 + exit: 1597 + kfree(env); 1598 + } 1599 + 1600 + /** 1555 1601 * pm80xx_fatal_errors - returns non-zero *ONLY* when fatal errors 1556 1602 * @pm8001_ha: our hba card information 1557 1603 * ··· 1626 1580 "Fatal error SCRATCHPAD1 = 0x%x SCRATCHPAD2 = 0x%x SCRATCHPAD3 = 0x%x SCRATCHPAD_RSVD0 = 0x%x SCRATCHPAD_RSVD1 = 0x%x\n", 1627 1581 scratch_pad1, scratch_pad2, scratch_pad3, 1628 1582 scratch_pad_rsvd0, scratch_pad_rsvd1); 1583 + pm80xx_fatal_error_uevent_emit(pm8001_ha, REPORTER_DRIVER); 1629 1584 ret = 1; 1630 1585 } 1631 1586 ··· 4086 4039 pm8001_dbg(pm8001_ha, FAIL, 4087 4040 "Firmware Fatal error! Regval:0x%x\n", 4088 4041 regval); 4042 + pm80xx_fatal_error_uevent_emit(pm8001_ha, REPORTER_FIRMWARE); 4089 4043 pm8001_handle_event(pm8001_ha, NULL, IO_FATAL_ERROR); 4090 4044 print_scratchpad_registers(pm8001_ha); 4091 4045 return ret; ··· 4725 4677 &pm8001_ha->phy[phy_id].dev_sas_addr, SAS_ADDR_SIZE); 4726 4678 payload.sas_identify.phy_id = phy_id; 4727 4679 4728 - return pm8001_mpi_build_cmd(pm8001_ha, 0, opcode, &payload, 4680 + ret = pm8001_mpi_build_cmd(pm8001_ha, 0, opcode, &payload, 4729 4681 sizeof(payload), 0); 4682 + if (ret < 0) 4683 + pm8001_tag_free(pm8001_ha, tag); 4684 + 4685 + return ret; 4730 4686 } 4731 4687 4732 4688 /** ··· 4756 4704 payload.tag = cpu_to_le32(tag); 4757 4705 payload.phy_id = cpu_to_le32(phy_id); 4758 4706 4759 - return pm8001_mpi_build_cmd(pm8001_ha, 0, opcode, &payload, 4707 + ret = pm8001_mpi_build_cmd(pm8001_ha, 0, opcode, &payload, 4760 4708 sizeof(payload), 0); 4709 + if (ret < 0) 4710 + pm8001_tag_free(pm8001_ha, tag); 4711 + 4712 + return ret; 4761 4713 } 4762 4714 4763 4715 /*
+1 -5
drivers/scsi/qla2xxx/Kconfig
··· 25 25 Upon request, the driver caches the firmware image until 26 26 the driver is unloaded. 27 27 28 - Firmware images can be retrieved from: 29 - 30 - http://ldriver.qlogic.com/firmware/ 31 - 32 - They are also included in the linux-firmware tree as well. 28 + Firmware images are included in the linux-firmware tree. 33 29 34 30 config TCM_QLA2XXX 35 31 tristate "TCM_QLA2XXX fabric module for QLogic 24xx+ series target mode HBAs"
+5 -13
drivers/scsi/qla2xxx/qla_dfs.c
··· 179 179 struct qla_hw_data *ha = vha->hw; 180 180 struct gid_list_info *gid_list; 181 181 dma_addr_t gid_list_dma; 182 - fc_port_t fc_port; 183 182 char *id_iter; 184 183 int rc, i; 185 - uint16_t entries, loop_id; 184 + uint16_t entries; 186 185 187 186 seq_printf(s, "%s\n", vha->host_str); 188 187 gid_list = dma_alloc_coherent(&ha->pdev->dev, ··· 204 205 seq_puts(s, "Port Name Port ID Loop ID\n"); 205 206 206 207 for (i = 0; i < entries; i++) { 207 - struct gid_list_info *gid = 208 - (struct gid_list_info *)id_iter; 209 - loop_id = le16_to_cpu(gid->loop_id); 210 - memset(&fc_port, 0, sizeof(fc_port_t)); 208 + struct gid_list_info *gid = (struct gid_list_info *)id_iter; 211 209 212 - fc_port.loop_id = loop_id; 213 - 214 - rc = qla24xx_gpdb_wait(vha, &fc_port, 0); 215 - seq_printf(s, "%8phC %02x%02x%02x %d\n", 216 - fc_port.port_name, fc_port.d_id.b.domain, 217 - fc_port.d_id.b.area, fc_port.d_id.b.al_pa, 218 - fc_port.loop_id); 210 + rc = qla24xx_print_fc_port_id(vha, s, le16_to_cpu(gid->loop_id)); 211 + if (rc != QLA_SUCCESS) 212 + break; 219 213 id_iter += ha->gid_list_info_size; 220 214 } 221 215 out_free_id_list:
+1
drivers/scsi/qla2xxx/qla_gbl.h
··· 557 557 558 558 int qla24xx_send_mb_cmd(struct scsi_qla_host *, mbx_cmd_t *); 559 559 int qla24xx_gpdb_wait(struct scsi_qla_host *, fc_port_t *, u8); 560 + int qla24xx_print_fc_port_id(struct scsi_qla_host *, struct seq_file *, u16); 560 561 int qla24xx_gidlist_wait(struct scsi_qla_host *, void *, dma_addr_t, 561 562 uint16_t *); 562 563 int __qla24xx_parse_gpdb(struct scsi_qla_host *, fc_port_t *,
-4
drivers/scsi/qla2xxx/qla_init.c
··· 8603 8603 return QLA_SUCCESS; 8604 8604 } 8605 8605 8606 - #define QLA_FW_URL "http://ldriver.qlogic.com/firmware/" 8607 - 8608 8606 int 8609 8607 qla2x00_load_risc(scsi_qla_host_t *vha, uint32_t *srisc_addr) 8610 8608 { ··· 8620 8622 if (!blob) { 8621 8623 ql_log(ql_log_info, vha, 0x0083, 8622 8624 "Firmware image unavailable.\n"); 8623 - ql_log(ql_log_info, vha, 0x0084, 8624 - "Firmware images can be retrieved from: "QLA_FW_URL ".\n"); 8625 8625 return QLA_FUNCTION_FAILED; 8626 8626 } 8627 8627
+48
drivers/scsi/qla2xxx/qla_mbx.c
··· 6597 6597 return rval; 6598 6598 } 6599 6599 6600 + int qla24xx_print_fc_port_id(struct scsi_qla_host *vha, struct seq_file *s, u16 loop_id) 6601 + { 6602 + int rval = QLA_FUNCTION_FAILED; 6603 + dma_addr_t pd_dma; 6604 + struct port_database_24xx *pd; 6605 + struct qla_hw_data *ha = vha->hw; 6606 + mbx_cmd_t mc; 6607 + 6608 + if (!vha->hw->flags.fw_started) 6609 + goto done; 6610 + 6611 + pd = dma_pool_zalloc(ha->s_dma_pool, GFP_KERNEL, &pd_dma); 6612 + if (pd == NULL) { 6613 + ql_log(ql_log_warn, vha, 0xd047, 6614 + "Failed to allocate port database structure.\n"); 6615 + goto done; 6616 + } 6617 + 6618 + memset(&mc, 0, sizeof(mc)); 6619 + mc.mb[0] = MBC_GET_PORT_DATABASE; 6620 + mc.mb[1] = loop_id; 6621 + mc.mb[2] = MSW(pd_dma); 6622 + mc.mb[3] = LSW(pd_dma); 6623 + mc.mb[6] = MSW(MSD(pd_dma)); 6624 + mc.mb[7] = LSW(MSD(pd_dma)); 6625 + mc.mb[9] = vha->vp_idx; 6626 + 6627 + rval = qla24xx_send_mb_cmd(vha, &mc); 6628 + if (rval != QLA_SUCCESS) { 6629 + ql_dbg(ql_dbg_mbx, vha, 0x1193, "%s: fail\n", __func__); 6630 + goto done_free_sp; 6631 + } 6632 + 6633 + ql_dbg(ql_dbg_mbx, vha, 0x1197, "%s: %8phC done\n", 6634 + __func__, pd->port_name); 6635 + 6636 + seq_printf(s, "%8phC %02x%02x%02x %d\n", 6637 + pd->port_name, pd->port_id[0], 6638 + pd->port_id[1], pd->port_id[2], 6639 + loop_id); 6640 + 6641 + done_free_sp: 6642 + if (pd) 6643 + dma_pool_free(ha->s_dma_pool, pd, pd_dma); 6644 + done: 6645 + return rval; 6646 + } 6647 + 6600 6648 /* 6601 6649 * qla24xx_gpdb_wait 6602 6650 * NOTE: Do not call this routine from DPC thread
+6 -9
drivers/scsi/scsi.c
··· 242 242 * specific SCSI device to determine if and when there is a 243 243 * need to adjust the queue depth on the device. 244 244 * 245 - * Returns: 0 - No change needed, >0 - Adjust queue depth to this new depth, 246 - * -1 - Drop back to untagged operation using host->cmd_per_lun 247 - * as the untagged command depth 245 + * Returns: 246 + * * 0 - No change needed 247 + * * >0 - Adjust queue depth to this new depth, 248 + * * -1 - Drop back to untagged operation using host->cmd_per_lun as the 249 + * untagged command depth 248 250 * 249 251 * Lock Status: None held on entry 250 252 * ··· 710 708 int scsi_cdl_enable(struct scsi_device *sdev, bool enable) 711 709 { 712 710 char buf[64]; 713 - bool is_ata; 714 711 int ret; 715 712 716 713 if (!sdev->cdl_supported) 717 714 return -EOPNOTSUPP; 718 715 719 - rcu_read_lock(); 720 - is_ata = rcu_dereference(sdev->vpd_pg89); 721 - rcu_read_unlock(); 722 - 723 716 /* 724 717 * For ATA devices, CDL needs to be enabled with a SET FEATURES command. 725 718 */ 726 - if (is_ata) { 719 + if (sdev->is_ata) { 727 720 struct scsi_mode_data data; 728 721 struct scsi_sense_hdr sshdr; 729 722 char *buf_data;
+1 -1
drivers/scsi/scsi_debug.c
··· 8770 8770 dif_size = sdebug_store_sectors * sizeof(struct t10_pi_tuple); 8771 8771 sip->dif_storep = vmalloc(dif_size); 8772 8772 8773 - pr_info("dif_storep %u bytes @ %pK\n", dif_size, 8773 + pr_info("dif_storep %u bytes @ %p\n", dif_size, 8774 8774 sip->dif_storep); 8775 8775 8776 8776 if (!sip->dif_storep) {
+3 -8
drivers/scsi/scsi_devinfo.c
··· 269 269 static struct scsi_dev_info_list_table *scsi_devinfo_lookup_by_key(int key) 270 270 { 271 271 struct scsi_dev_info_list_table *devinfo_table; 272 - int found = 0; 273 272 274 273 list_for_each_entry(devinfo_table, &scsi_dev_info_list, node) 275 - if (devinfo_table->key == key) { 276 - found = 1; 277 - break; 278 - } 279 - if (!found) 280 - return ERR_PTR(-EINVAL); 274 + if (devinfo_table->key == key) 275 + return devinfo_table; 281 276 282 - return devinfo_table; 277 + return ERR_PTR(-EINVAL); 283 278 } 284 279 285 280 /*
+1 -1
drivers/scsi/scsi_lib.c
··· 1843 1843 * a function to initialize that data. 1844 1844 */ 1845 1845 if (shost->hostt->cmd_size && !shost->hostt->init_cmd_priv) 1846 - memset(cmd + 1, 0, shost->hostt->cmd_size); 1846 + memset(scsi_cmd_priv(cmd), 0, shost->hostt->cmd_size); 1847 1847 1848 1848 if (!(req->rq_flags & RQF_DONTPREP)) { 1849 1849 ret = scsi_prepare_cmd(req);
+2 -1
drivers/scsi/scsi_scan.c
··· 909 909 sdev->model = (char *) (sdev->inquiry + 16); 910 910 sdev->rev = (char *) (sdev->inquiry + 32); 911 911 912 - if (strncmp(sdev->vendor, "ATA ", 8) == 0) { 912 + sdev->is_ata = strncmp(sdev->vendor, "ATA ", 8) == 0; 913 + if (sdev->is_ata) { 913 914 /* 914 915 * sata emulation layer device. This is a hack to work around 915 916 * the SATL power management specifications which state that
+42 -30
drivers/scsi/scsi_transport_fc.c
··· 446 446 return -ENOMEM; 447 447 448 448 fc_host->dev_loss_tmo = fc_dev_loss_tmo; 449 - fc_host->devloss_work_q = alloc_workqueue("fc_dl_%d", 0, 0, 450 - shost->host_no); 451 - if (!fc_host->devloss_work_q) { 452 - destroy_workqueue(fc_host->work_q); 453 - fc_host->work_q = NULL; 454 - return -ENOMEM; 455 - } 456 449 457 450 fc_bsg_hostadd(shost, fc_host); 458 451 /* ignore any bsg add error - we just can't do sgio */ ··· 2807 2814 /** 2808 2815 * fc_queue_devloss_work - Schedule work for the fc_host devloss workqueue. 2809 2816 * @shost: Pointer to Scsi_Host bound to fc_host. 2817 + * @rport: rport associated with the devloss work 2810 2818 * @work: Work to queue for execution. 2811 2819 * @delay: jiffies to delay the work queuing 2812 2820 * ··· 2815 2821 * 1 on success / 0 already queued / < 0 for error 2816 2822 */ 2817 2823 static int 2818 - fc_queue_devloss_work(struct Scsi_Host *shost, struct delayed_work *work, 2819 - unsigned long delay) 2824 + fc_queue_devloss_work(struct Scsi_Host *shost, struct fc_rport *rport, 2825 + struct delayed_work *work, unsigned long delay) 2820 2826 { 2821 - if (unlikely(!fc_host_devloss_work_q(shost))) { 2827 + if (unlikely(!rport->devloss_work_q)) { 2822 2828 printk(KERN_ERR 2823 2829 "ERROR: FC host '%s' attempted to queue work, " 2824 2830 "when no workqueue created.\n", shost->hostt->name); ··· 2827 2833 return -EINVAL; 2828 2834 } 2829 2835 2830 - return queue_delayed_work(fc_host_devloss_work_q(shost), work, delay); 2836 + return queue_delayed_work(rport->devloss_work_q, work, delay); 2831 2837 } 2832 2838 2833 2839 /** 2834 2840 * fc_flush_devloss - Flush a fc_host's devloss workqueue. 2835 2841 * @shost: Pointer to Scsi_Host bound to fc_host. 2842 + * @rport: rport associated with the devloss work 2836 2843 */ 2837 2844 static void 2838 - fc_flush_devloss(struct Scsi_Host *shost) 2845 + fc_flush_devloss(struct Scsi_Host *shost, struct fc_rport *rport) 2839 2846 { 2840 - if (!fc_host_devloss_work_q(shost)) { 2847 + if (unlikely(!rport->devloss_work_q)) { 2841 2848 printk(KERN_ERR 2842 2849 "ERROR: FC host '%s' attempted to flush work, " 2843 2850 "when no workqueue created.\n", shost->hostt->name); ··· 2846 2851 return; 2847 2852 } 2848 2853 2849 - flush_workqueue(fc_host_devloss_work_q(shost)); 2854 + flush_workqueue(rport->devloss_work_q); 2850 2855 } 2851 2856 2852 2857 ··· 2908 2913 fc_host->work_q = NULL; 2909 2914 destroy_workqueue(work_q); 2910 2915 } 2911 - 2912 - /* flush all devloss work items, then kill it */ 2913 - if (fc_host->devloss_work_q) { 2914 - work_q = fc_host->devloss_work_q; 2915 - fc_host->devloss_work_q = NULL; 2916 - destroy_workqueue(work_q); 2917 - } 2918 2916 } 2919 2917 EXPORT_SYMBOL(fc_remove_host); 2920 2918 ··· 2955 2967 struct device *dev = &rport->dev; 2956 2968 struct Scsi_Host *shost = rport_to_shost(rport); 2957 2969 struct fc_internal *i = to_fc_internal(shost->transportt); 2970 + struct workqueue_struct *work_q; 2958 2971 unsigned long flags; 2959 2972 int do_callback = 0; 2960 2973 ··· 2977 2988 if (rport->flags & FC_RPORT_DEVLOSS_PENDING) { 2978 2989 spin_unlock_irqrestore(shost->host_lock, flags); 2979 2990 if (!cancel_delayed_work(&rport->fail_io_work)) 2980 - fc_flush_devloss(shost); 2991 + fc_flush_devloss(shost, rport); 2981 2992 if (!cancel_delayed_work(&rport->dev_loss_work)) 2982 - fc_flush_devloss(shost); 2993 + fc_flush_devloss(shost, rport); 2983 2994 cancel_work_sync(&rport->scan_work); 2984 2995 spin_lock_irqsave(shost->host_lock, flags); 2985 2996 rport->flags &= ~FC_RPORT_DEVLOSS_PENDING; ··· 3009 3020 i->f->dev_loss_tmo_callbk(rport); 3010 3021 3011 3022 fc_bsg_remove(rport->rqst_q); 3023 + 3024 + if (rport->devloss_work_q) { 3025 + work_q = rport->devloss_work_q; 3026 + rport->devloss_work_q = NULL; 3027 + destroy_workqueue(work_q); 3028 + } 3012 3029 3013 3030 transport_remove_device(dev); 3014 3031 device_del(dev); ··· 3087 3092 scsi_host_get(shost); /* for fc_host->rport list */ 3088 3093 3089 3094 spin_unlock_irqrestore(shost->host_lock, flags); 3095 + 3096 + rport->devloss_work_q = alloc_workqueue("fc_dl_%d_%d", 0, 0, 3097 + shost->host_no, rport->number); 3098 + if (!rport->devloss_work_q) { 3099 + printk(KERN_ERR "FC Remote Port alloc_workqueue failed\n"); 3100 + /* 3101 + * Note that we have not yet called device_initialize() / get_device() 3102 + * Cannot reclaim incremented rport->number because we released host_lock 3103 + */ 3104 + spin_lock_irqsave(shost->host_lock, flags); 3105 + list_del(&rport->peers); 3106 + scsi_host_put(shost); /* for fc_host->rport list */ 3107 + spin_unlock_irqrestore(shost->host_lock, flags); 3108 + kfree(rport); 3109 + return NULL; 3110 + } 3090 3111 3091 3112 dev = &rport->dev; 3092 3113 device_initialize(dev); /* takes self reference */ ··· 3266 3255 * be checked and will NOOP the function. 3267 3256 */ 3268 3257 if (!cancel_delayed_work(&rport->fail_io_work)) 3269 - fc_flush_devloss(shost); 3258 + fc_flush_devloss(shost, rport); 3270 3259 if (!cancel_delayed_work(&rport->dev_loss_work)) 3271 - fc_flush_devloss(shost); 3260 + fc_flush_devloss(shost, rport); 3272 3261 3273 3262 spin_lock_irqsave(shost->host_lock, flags); 3274 3263 ··· 3462 3451 /* see if we need to kill io faster than waiting for device loss */ 3463 3452 if ((rport->fast_io_fail_tmo != -1) && 3464 3453 (rport->fast_io_fail_tmo < timeout)) 3465 - fc_queue_devloss_work(shost, &rport->fail_io_work, 3466 - rport->fast_io_fail_tmo * HZ); 3454 + fc_queue_devloss_work(shost, rport, &rport->fail_io_work, 3455 + rport->fast_io_fail_tmo * HZ); 3467 3456 3468 3457 /* cap the length the devices can be blocked until they are deleted */ 3469 - fc_queue_devloss_work(shost, &rport->dev_loss_work, timeout * HZ); 3458 + fc_queue_devloss_work(shost, rport, &rport->dev_loss_work, 3459 + timeout * HZ); 3470 3460 } 3471 3461 EXPORT_SYMBOL(fc_remote_port_delete); 3472 3462 ··· 3526 3514 * transaction. 3527 3515 */ 3528 3516 if (!cancel_delayed_work(&rport->fail_io_work)) 3529 - fc_flush_devloss(shost); 3517 + fc_flush_devloss(shost, rport); 3530 3518 if (!cancel_delayed_work(&rport->dev_loss_work)) 3531 - fc_flush_devloss(shost); 3519 + fc_flush_devloss(shost, rport); 3532 3520 3533 3521 spin_lock_irqsave(shost->host_lock, flags); 3534 3522 rport->flags &= ~(FC_RPORT_FAST_FAIL_TIMEDOUT |
+4 -9
drivers/scsi/sd.c
··· 3464 3464 } 3465 3465 3466 3466 if (scsi_report_opcode(sdev, buffer, SD_BUF_SIZE, INQUIRY, 0) < 0) { 3467 - struct scsi_vpd *vpd; 3468 - 3469 3467 sdev->no_report_opcodes = 1; 3470 3468 3471 - /* Disable WRITE SAME if REPORT SUPPORTED OPERATION 3472 - * CODES is unsupported and the device has an ATA 3473 - * Information VPD page (SAT). 3469 + /* 3470 + * Disable WRITE SAME if REPORT SUPPORTED OPERATION CODES is 3471 + * unsupported and this is an ATA device. 3474 3472 */ 3475 - rcu_read_lock(); 3476 - vpd = rcu_dereference(sdev->vpd_pg89); 3477 - if (vpd) 3473 + if (sdev->is_ata) 3478 3474 sdev->no_write_same = 1; 3479 - rcu_read_unlock(); 3480 3475 } 3481 3476 3482 3477 if (scsi_report_opcode(sdev, buffer, SD_BUF_SIZE, WRITE_SAME_16, 0) == 1)
+190
drivers/ufs/core/ufs-sysfs.c
··· 87 87 } 88 88 } 89 89 90 + static const char * const ufs_hid_states[] = { 91 + [HID_IDLE] = "idle", 92 + [ANALYSIS_IN_PROGRESS] = "analysis_in_progress", 93 + [DEFRAG_REQUIRED] = "defrag_required", 94 + [DEFRAG_IN_PROGRESS] = "defrag_in_progress", 95 + [DEFRAG_COMPLETED] = "defrag_completed", 96 + [DEFRAG_NOT_REQUIRED] = "defrag_not_required", 97 + }; 98 + 99 + static const char *ufs_hid_state_to_string(enum ufs_hid_state state) 100 + { 101 + if (state < NUM_UFS_HID_STATES) 102 + return ufs_hid_states[state]; 103 + 104 + return "unknown"; 105 + } 106 + 90 107 static const char *ufshcd_uic_link_state_to_string( 91 108 enum uic_link_state state) 92 109 { ··· 1780 1763 .attrs = ufs_sysfs_attributes, 1781 1764 }; 1782 1765 1766 + static int hid_query_attr(struct ufs_hba *hba, enum query_opcode opcode, 1767 + enum attr_idn idn, u32 *attr_val) 1768 + { 1769 + int ret; 1770 + 1771 + down(&hba->host_sem); 1772 + if (!ufshcd_is_user_access_allowed(hba)) { 1773 + up(&hba->host_sem); 1774 + return -EBUSY; 1775 + } 1776 + 1777 + ufshcd_rpm_get_sync(hba); 1778 + ret = ufshcd_query_attr(hba, opcode, idn, 0, 0, attr_val); 1779 + ufshcd_rpm_put_sync(hba); 1780 + 1781 + up(&hba->host_sem); 1782 + return ret; 1783 + } 1784 + 1785 + static ssize_t analysis_trigger_store(struct device *dev, 1786 + struct device_attribute *attr, const char *buf, size_t count) 1787 + { 1788 + struct ufs_hba *hba = dev_get_drvdata(dev); 1789 + int mode; 1790 + int ret; 1791 + 1792 + if (sysfs_streq(buf, "enable")) 1793 + mode = HID_ANALYSIS_ENABLE; 1794 + else if (sysfs_streq(buf, "disable")) 1795 + mode = HID_ANALYSIS_AND_DEFRAG_DISABLE; 1796 + else 1797 + return -EINVAL; 1798 + 1799 + ret = hid_query_attr(hba, UPIU_QUERY_OPCODE_WRITE_ATTR, 1800 + QUERY_ATTR_IDN_HID_DEFRAG_OPERATION, &mode); 1801 + 1802 + return ret < 0 ? ret : count; 1803 + } 1804 + 1805 + static DEVICE_ATTR_WO(analysis_trigger); 1806 + 1807 + static ssize_t defrag_trigger_store(struct device *dev, 1808 + struct device_attribute *attr, const char *buf, size_t count) 1809 + { 1810 + struct ufs_hba *hba = dev_get_drvdata(dev); 1811 + int mode; 1812 + int ret; 1813 + 1814 + if (sysfs_streq(buf, "enable")) 1815 + mode = HID_ANALYSIS_AND_DEFRAG_ENABLE; 1816 + else if (sysfs_streq(buf, "disable")) 1817 + mode = HID_ANALYSIS_AND_DEFRAG_DISABLE; 1818 + else 1819 + return -EINVAL; 1820 + 1821 + ret = hid_query_attr(hba, UPIU_QUERY_OPCODE_WRITE_ATTR, 1822 + QUERY_ATTR_IDN_HID_DEFRAG_OPERATION, &mode); 1823 + 1824 + return ret < 0 ? ret : count; 1825 + } 1826 + 1827 + static DEVICE_ATTR_WO(defrag_trigger); 1828 + 1829 + static ssize_t fragmented_size_show(struct device *dev, 1830 + struct device_attribute *attr, char *buf) 1831 + { 1832 + struct ufs_hba *hba = dev_get_drvdata(dev); 1833 + u32 value; 1834 + int ret; 1835 + 1836 + ret = hid_query_attr(hba, UPIU_QUERY_OPCODE_READ_ATTR, 1837 + QUERY_ATTR_IDN_HID_AVAILABLE_SIZE, &value); 1838 + if (ret) 1839 + return ret; 1840 + 1841 + return sysfs_emit(buf, "%u\n", value); 1842 + } 1843 + 1844 + static DEVICE_ATTR_RO(fragmented_size); 1845 + 1846 + static ssize_t defrag_size_show(struct device *dev, 1847 + struct device_attribute *attr, char *buf) 1848 + { 1849 + struct ufs_hba *hba = dev_get_drvdata(dev); 1850 + u32 value; 1851 + int ret; 1852 + 1853 + ret = hid_query_attr(hba, UPIU_QUERY_OPCODE_READ_ATTR, 1854 + QUERY_ATTR_IDN_HID_SIZE, &value); 1855 + if (ret) 1856 + return ret; 1857 + 1858 + return sysfs_emit(buf, "%u\n", value); 1859 + } 1860 + 1861 + static ssize_t defrag_size_store(struct device *dev, 1862 + struct device_attribute *attr, const char *buf, size_t count) 1863 + { 1864 + struct ufs_hba *hba = dev_get_drvdata(dev); 1865 + u32 value; 1866 + int ret; 1867 + 1868 + if (kstrtou32(buf, 0, &value)) 1869 + return -EINVAL; 1870 + 1871 + ret = hid_query_attr(hba, UPIU_QUERY_OPCODE_WRITE_ATTR, 1872 + QUERY_ATTR_IDN_HID_SIZE, &value); 1873 + 1874 + return ret < 0 ? ret : count; 1875 + } 1876 + 1877 + static DEVICE_ATTR_RW(defrag_size); 1878 + 1879 + static ssize_t progress_ratio_show(struct device *dev, 1880 + struct device_attribute *attr, char *buf) 1881 + { 1882 + struct ufs_hba *hba = dev_get_drvdata(dev); 1883 + u32 value; 1884 + int ret; 1885 + 1886 + ret = hid_query_attr(hba, UPIU_QUERY_OPCODE_READ_ATTR, 1887 + QUERY_ATTR_IDN_HID_PROGRESS_RATIO, &value); 1888 + if (ret) 1889 + return ret; 1890 + 1891 + return sysfs_emit(buf, "%u\n", value); 1892 + } 1893 + 1894 + static DEVICE_ATTR_RO(progress_ratio); 1895 + 1896 + static ssize_t state_show(struct device *dev, 1897 + struct device_attribute *attr, char *buf) 1898 + { 1899 + struct ufs_hba *hba = dev_get_drvdata(dev); 1900 + u32 value; 1901 + int ret; 1902 + 1903 + ret = hid_query_attr(hba, UPIU_QUERY_OPCODE_READ_ATTR, 1904 + QUERY_ATTR_IDN_HID_STATE, &value); 1905 + if (ret) 1906 + return ret; 1907 + 1908 + return sysfs_emit(buf, "%s\n", ufs_hid_state_to_string(value)); 1909 + } 1910 + 1911 + static DEVICE_ATTR_RO(state); 1912 + 1913 + static struct attribute *ufs_sysfs_hid[] = { 1914 + &dev_attr_analysis_trigger.attr, 1915 + &dev_attr_defrag_trigger.attr, 1916 + &dev_attr_fragmented_size.attr, 1917 + &dev_attr_defrag_size.attr, 1918 + &dev_attr_progress_ratio.attr, 1919 + &dev_attr_state.attr, 1920 + NULL, 1921 + }; 1922 + 1923 + static umode_t ufs_sysfs_hid_is_visible(struct kobject *kobj, 1924 + struct attribute *attr, int n) 1925 + { 1926 + struct device *dev = container_of(kobj, struct device, kobj); 1927 + struct ufs_hba *hba = dev_get_drvdata(dev); 1928 + 1929 + return hba->dev_info.hid_sup ? attr->mode : 0; 1930 + } 1931 + 1932 + static const struct attribute_group ufs_sysfs_hid_group = { 1933 + .name = "hid", 1934 + .attrs = ufs_sysfs_hid, 1935 + .is_visible = ufs_sysfs_hid_is_visible, 1936 + }; 1937 + 1783 1938 static const struct attribute_group *ufs_sysfs_groups[] = { 1784 1939 &ufs_sysfs_default_group, 1785 1940 &ufs_sysfs_capabilities_group, ··· 1966 1777 &ufs_sysfs_string_descriptors_group, 1967 1778 &ufs_sysfs_flags_group, 1968 1779 &ufs_sysfs_attributes_group, 1780 + &ufs_sysfs_hid_group, 1969 1781 NULL, 1970 1782 }; 1971 1783
+59 -12
drivers/ufs/core/ufshcd.c
··· 2566 2566 * @hba: per adapter instance 2567 2567 * @uic_cmd: UIC command 2568 2568 * 2569 - * Return: 0 only if success. 2569 + * Return: 0 if successful; < 0 upon failure. 2570 2570 */ 2571 2571 static int 2572 2572 __ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd) ··· 2826 2826 /* Copy the Descriptor */ 2827 2827 if (query->request.upiu_req.opcode == UPIU_QUERY_OPCODE_WRITE_DESC) 2828 2828 memcpy(ucd_req_ptr + 1, query->descriptor, len); 2829 - 2830 - memset(lrbp->ucd_rsp_ptr, 0, sizeof(struct utp_upiu_rsp)); 2831 2829 } 2832 2830 2833 2831 static inline void ufshcd_prepare_utp_nop_upiu(struct ufshcd_lrb *lrbp) ··· 2838 2840 .transaction_code = UPIU_TRANSACTION_NOP_OUT, 2839 2841 .task_tag = lrbp->task_tag, 2840 2842 }; 2841 - 2842 - memset(lrbp->ucd_rsp_ptr, 0, sizeof(struct utp_upiu_rsp)); 2843 2843 } 2844 2844 2845 2845 /** ··· 2862 2866 ufshcd_prepare_utp_nop_upiu(lrbp); 2863 2867 else 2864 2868 ret = -EINVAL; 2869 + 2870 + memset(lrbp->ucd_rsp_ptr, 0, sizeof(struct utp_upiu_rsp)); 2865 2871 2866 2872 return ret; 2867 2873 } ··· 3072 3074 hba->dev_cmd.type = cmd_type; 3073 3075 } 3074 3076 3077 + /* 3078 + * Return: 0 upon success; < 0 upon failure. 3079 + */ 3075 3080 static int ufshcd_compose_dev_cmd(struct ufs_hba *hba, 3076 3081 struct ufshcd_lrb *lrbp, enum dev_cmd_type cmd_type, int tag) 3077 3082 { ··· 3187 3186 break; 3188 3187 } 3189 3188 3189 + WARN_ONCE(err > 0, "Incorrect return value %d > 0\n", err); 3190 3190 return err; 3191 3191 } 3192 3192 3193 + /* 3194 + * Return: 0 upon success; < 0 upon failure. 3195 + */ 3193 3196 static int ufshcd_wait_for_dev_cmd(struct ufs_hba *hba, 3194 3197 struct ufshcd_lrb *lrbp, int max_timeout) 3195 3198 { ··· 3268 3263 } 3269 3264 } 3270 3265 3266 + WARN_ONCE(err > 0, "Incorrect return value %d > 0\n", err); 3271 3267 return err; 3272 3268 } 3273 3269 ··· 3286 3280 ufshcd_release(hba); 3287 3281 } 3288 3282 3283 + /* 3284 + * Return: 0 upon success; < 0 upon failure. 3285 + */ 3289 3286 static int ufshcd_issue_dev_cmd(struct ufs_hba *hba, struct ufshcd_lrb *lrbp, 3290 3287 const u32 tag, int timeout) 3291 3288 { ··· 3376 3367 dev_err(hba->dev, 3377 3368 "%s: query flag, opcode %d, idn %d, failed with error %d after %d retries\n", 3378 3369 __func__, opcode, idn, ret, retries); 3370 + WARN_ONCE(ret > 0, "Incorrect return value %d > 0\n", ret); 3379 3371 return ret; 3380 3372 } 3381 3373 ··· 3388 3378 * @index: flag index to access 3389 3379 * @flag_res: the flag value after the query request completes 3390 3380 * 3391 - * Return: 0 for success, non-zero in case of failure. 3381 + * Return: 0 for success; < 0 upon failure. 3392 3382 */ 3393 3383 int ufshcd_query_flag(struct ufs_hba *hba, enum query_opcode opcode, 3394 3384 enum flag_idn idn, u8 index, bool *flag_res) ··· 3444 3434 3445 3435 out_unlock: 3446 3436 ufshcd_dev_man_unlock(hba); 3437 + WARN_ONCE(err > 0, "Incorrect return value %d > 0\n", err); 3447 3438 return err; 3448 3439 } 3449 3440 ··· 3457 3446 * @selector: selector field 3458 3447 * @attr_val: the attribute value after the query request completes 3459 3448 * 3460 - * Return: 0 for success, non-zero in case of failure. 3449 + * Return: 0 upon success; < 0 upon failure. 3461 3450 */ 3462 3451 int ufshcd_query_attr(struct ufs_hba *hba, enum query_opcode opcode, 3463 3452 enum attr_idn idn, u8 index, u8 selector, u32 *attr_val) ··· 3506 3495 3507 3496 out_unlock: 3508 3497 ufshcd_dev_man_unlock(hba); 3498 + WARN_ONCE(err > 0, "Incorrect return value %d > 0\n", err); 3509 3499 return err; 3510 3500 } 3511 3501 ··· 3521 3509 * @attr_val: the attribute value after the query request 3522 3510 * completes 3523 3511 * 3524 - * Return: 0 for success, non-zero in case of failure. 3512 + * Return: 0 for success; < 0 upon failure. 3525 3513 */ 3526 3514 int ufshcd_query_attr_retry(struct ufs_hba *hba, 3527 3515 enum query_opcode opcode, enum attr_idn idn, u8 index, u8 selector, ··· 3544 3532 dev_err(hba->dev, 3545 3533 "%s: query attribute, idn %d, failed with error %d after %d retries\n", 3546 3534 __func__, idn, ret, QUERY_REQ_RETRIES); 3535 + WARN_ONCE(ret > 0, "Incorrect return value %d > 0\n", ret); 3547 3536 return ret; 3548 3537 } 3549 3538 3539 + /* 3540 + * Return: 0 if successful; < 0 upon failure. 3541 + */ 3550 3542 static int __ufshcd_query_descriptor(struct ufs_hba *hba, 3551 3543 enum query_opcode opcode, enum desc_idn idn, u8 index, 3552 3544 u8 selector, u8 *desc_buf, int *buf_len) ··· 3608 3592 out_unlock: 3609 3593 hba->dev_cmd.query.descriptor = NULL; 3610 3594 ufshcd_dev_man_unlock(hba); 3595 + WARN_ONCE(err > 0, "Incorrect return value %d > 0\n", err); 3611 3596 return err; 3612 3597 } 3613 3598 ··· 3625 3608 * The buf_len parameter will contain, on return, the length parameter 3626 3609 * received on the response. 3627 3610 * 3628 - * Return: 0 for success, non-zero in case of failure. 3611 + * Return: 0 for success; < 0 upon failure. 3629 3612 */ 3630 3613 int ufshcd_query_descriptor_retry(struct ufs_hba *hba, 3631 3614 enum query_opcode opcode, ··· 3643 3626 break; 3644 3627 } 3645 3628 3629 + WARN_ONCE(err > 0, "Incorrect return value %d > 0\n", err); 3646 3630 return err; 3647 3631 } 3648 3632 ··· 3656 3638 * @param_read_buf: pointer to buffer where parameter would be read 3657 3639 * @param_size: sizeof(param_read_buf) 3658 3640 * 3659 - * Return: 0 in case of success, non-zero otherwise. 3641 + * Return: 0 in case of success; < 0 upon failure. 3660 3642 */ 3661 3643 int ufshcd_read_desc_param(struct ufs_hba *hba, 3662 3644 enum desc_idn desc_id, ··· 3723 3705 out: 3724 3706 if (is_kmalloc) 3725 3707 kfree(desc_buf); 3708 + WARN_ONCE(ret > 0, "Incorrect return value %d > 0\n", ret); 3726 3709 return ret; 3727 3710 } 3728 3711 ··· 3837 3818 * @param_read_buf: pointer to buffer where parameter would be read 3838 3819 * @param_size: sizeof(param_read_buf) 3839 3820 * 3840 - * Return: 0 in case of success, non-zero otherwise. 3821 + * Return: 0 in case of success; < 0 upon failure. 3841 3822 */ 3842 3823 static inline int ufshcd_read_unit_desc_param(struct ufs_hba *hba, 3843 3824 int lun, ··· 4271 4252 return ret; 4272 4253 } 4273 4254 EXPORT_SYMBOL_GPL(ufshcd_dme_get_attr); 4255 + 4256 + /** 4257 + * ufshcd_dme_rmw - get modify set a DME attribute 4258 + * @hba: per adapter instance 4259 + * @mask: indicates which bits to clear from the value that has been read 4260 + * @val: actual value to write 4261 + * @attr: dme attribute 4262 + */ 4263 + int ufshcd_dme_rmw(struct ufs_hba *hba, u32 mask, 4264 + u32 val, u32 attr) 4265 + { 4266 + u32 cfg = 0; 4267 + int err; 4268 + 4269 + err = ufshcd_dme_get(hba, UIC_ARG_MIB(attr), &cfg); 4270 + if (err) 4271 + return err; 4272 + 4273 + cfg &= ~mask; 4274 + cfg |= (val & mask); 4275 + 4276 + return ufshcd_dme_set(hba, UIC_ARG_MIB(attr), cfg); 4277 + } 4278 + EXPORT_SYMBOL_GPL(ufshcd_dme_rmw); 4274 4279 4275 4280 /** 4276 4281 * ufshcd_uic_pwr_ctrl - executes UIC commands (which affects the link power ··· 4839 4796 * 3. Program UTRL and UTMRL base address 4840 4797 * 4. Configure run-stop-registers 4841 4798 * 4842 - * Return: 0 on success, non-zero value on failure. 4799 + * Return: 0 if successful; < 0 upon failure. 4843 4800 */ 4844 4801 int ufshcd_make_hba_operational(struct ufs_hba *hba) 4845 4802 { ··· 8462 8419 dev_info->bqueuedepth = desc_buf[DEVICE_DESC_PARAM_Q_DPTH]; 8463 8420 8464 8421 dev_info->rtt_cap = desc_buf[DEVICE_DESC_PARAM_RTT_CAP]; 8422 + 8423 + dev_info->hid_sup = get_unaligned_be32(desc_buf + 8424 + DEVICE_DESC_PARAM_EXT_UFS_FEATURE_SUP) & 8425 + UFS_DEV_HID_SUPPORT; 8465 8426 8466 8427 model_index = desc_buf[DEVICE_DESC_PARAM_PRDCT_NAME]; 8467 8428
+2 -2
drivers/ufs/host/ufs-exynos.c
··· 1110 1110 hci_writel(ufs, val, HCI_TXPRDT_ENTRY_SIZE); 1111 1111 1112 1112 hci_writel(ufs, ilog2(DATA_UNIT_SIZE), HCI_RXPRDT_ENTRY_SIZE); 1113 - hci_writel(ufs, (1 << hba->nutrs) - 1, HCI_UTRL_NEXUS_TYPE); 1114 - hci_writel(ufs, (1 << hba->nutmrs) - 1, HCI_UTMRL_NEXUS_TYPE); 1113 + hci_writel(ufs, BIT(hba->nutrs) - 1, HCI_UTRL_NEXUS_TYPE); 1114 + hci_writel(ufs, BIT(hba->nutmrs) - 1, HCI_UTMRL_NEXUS_TYPE); 1115 1115 hci_writel(ufs, 0xf, HCI_AXIDMA_RWDATA_BURST_LEN); 1116 1116 1117 1117 if (ufs->opts & EXYNOS_UFS_OPT_SKIP_CONNECTION_ESTAB)
+22 -2
drivers/ufs/host/ufs-qcom.c
··· 552 552 */ 553 553 static void ufs_qcom_enable_hw_clk_gating(struct ufs_hba *hba) 554 554 { 555 + int err; 556 + 557 + /* Enable UTP internal clock gating */ 555 558 ufshcd_rmwl(hba, REG_UFS_CFG2_CGC_EN_ALL, REG_UFS_CFG2_CGC_EN_ALL, 556 559 REG_UFS_CFG2); 557 560 558 561 /* Ensure that HW clock gating is enabled before next operations */ 559 562 ufshcd_readl(hba, REG_UFS_CFG2); 563 + 564 + /* Enable Unipro internal clock gating */ 565 + err = ufshcd_dme_rmw(hba, DL_VS_CLK_CFG_MASK, 566 + DL_VS_CLK_CFG_MASK, DL_VS_CLK_CFG); 567 + if (err) 568 + goto out; 569 + 570 + err = ufshcd_dme_rmw(hba, PA_VS_CLK_CFG_REG_MASK, 571 + PA_VS_CLK_CFG_REG_MASK, PA_VS_CLK_CFG_REG); 572 + if (err) 573 + goto out; 574 + 575 + err = ufshcd_dme_rmw(hba, DME_VS_CORE_CLK_CTRL_DME_HW_CGC_EN, 576 + DME_VS_CORE_CLK_CTRL_DME_HW_CGC_EN, 577 + DME_VS_CORE_CLK_CTRL); 578 + out: 579 + if (err) 580 + dev_err(hba->dev, "hw clk gating enabled failed\n"); 560 581 } 561 582 562 583 static int ufs_qcom_hce_enable_notify(struct ufs_hba *hba, ··· 2130 2109 2131 2110 retain_and_null_ptr(qi); 2132 2111 2133 - if (host->hw_ver.major == 6 && host->hw_ver.minor == 0 && 2134 - host->hw_ver.step == 0) { 2112 + if (host->hw_ver.major >= 6) { 2135 2113 ufshcd_rmwl(hba, ESI_VEC_MASK, FIELD_PREP(ESI_VEC_MASK, MAX_ESI_VEC - 1), 2136 2114 REG_UFS_CFG3); 2137 2115 }
+9
drivers/ufs/host/ufs-qcom.h
··· 24 24 25 25 #define UFS_QCOM_LIMIT_HS_RATE PA_HS_MODE_B 26 26 27 + /* bit and mask definitions for PA_VS_CLK_CFG_REG attribute */ 28 + #define PA_VS_CLK_CFG_REG 0x9004 29 + #define PA_VS_CLK_CFG_REG_MASK GENMASK(8, 0) 30 + 31 + /* bit and mask definitions for DL_VS_CLK_CFG attribute */ 32 + #define DL_VS_CLK_CFG 0xA00B 33 + #define DL_VS_CLK_CFG_MASK GENMASK(9, 0) 34 + #define DME_VS_CORE_CLK_CTRL_DME_HW_CGC_EN BIT(9) 35 + 27 36 /* QCOM UFS host controller vendor specific registers */ 28 37 enum { 29 38 REG_UFS_SYS1CLK_1US = 0xC0,
+5
include/scsi/scsi_device.h
··· 184 184 */ 185 185 unsigned force_runtime_start_on_system_start:1; 186 186 187 + /* 188 + * Set if the device is an ATA device. 189 + */ 190 + unsigned is_ata:1; 191 + 187 192 unsigned removable:1; 188 193 unsigned changed:1; /* Data invalid due to media change */ 189 194 unsigned busy:1; /* Used to prevent races */
+2 -3
include/scsi/scsi_transport_fc.h
··· 383 383 struct work_struct stgt_delete_work; 384 384 struct work_struct rport_delete_work; 385 385 struct request_queue *rqst_q; /* bsg support */ 386 + 387 + struct workqueue_struct *devloss_work_q; 386 388 } __attribute__((aligned(sizeof(unsigned long)))); 387 389 388 390 /* bit field values for struct fc_rport "flags" field: */ ··· 578 576 579 577 /* work queues for rport state manipulation */ 580 578 struct workqueue_struct *work_q; 581 - struct workqueue_struct *devloss_work_q; 582 579 583 580 /* bsg support */ 584 581 struct request_queue *rqst_q; ··· 655 654 (((struct fc_host_attrs *)(x)->shost_data)->npiv_vports_inuse) 656 655 #define fc_host_work_q(x) \ 657 656 (((struct fc_host_attrs *)(x)->shost_data)->work_q) 658 - #define fc_host_devloss_work_q(x) \ 659 - (((struct fc_host_attrs *)(x)->shost_data)->devloss_work_q) 660 657 #define fc_host_dev_loss_tmo(x) \ 661 658 (((struct fc_host_attrs *)(x)->shost_data)->dev_loss_tmo) 662 659 #define fc_host_max_ct_payload(x) \
+11 -2
include/trace/events/scsi.h
··· 200 200 __print_hex(__get_dynamic_array(cmnd), __entry->cmd_len)) 201 201 ); 202 202 203 + #define scsi_rtn_name(result) { result, #result } 204 + #define show_rtn_name(val) \ 205 + __print_symbolic(val, \ 206 + scsi_rtn_name(SCSI_MLQUEUE_HOST_BUSY), \ 207 + scsi_rtn_name(SCSI_MLQUEUE_DEVICE_BUSY), \ 208 + scsi_rtn_name(SCSI_MLQUEUE_EH_RETRY), \ 209 + scsi_rtn_name(SCSI_MLQUEUE_TARGET_BUSY)) 210 + 203 211 TRACE_EVENT(scsi_dispatch_cmd_error, 204 212 205 213 TP_PROTO(struct scsi_cmnd *cmd, int rtn), ··· 248 240 249 241 TP_printk("host_no=%u channel=%u id=%u lun=%u data_sgl=%u prot_sgl=%u" \ 250 242 " prot_op=%s driver_tag=%d scheduler_tag=%d cmnd=(%s %s raw=%s)" \ 251 - " rtn=%d", 243 + " rtn=%s", 252 244 __entry->host_no, __entry->channel, __entry->id, 253 245 __entry->lun, __entry->data_sglen, __entry->prot_sglen, 254 246 show_prot_op_name(__entry->prot_op), __entry->driver_tag, 255 247 __entry->scheduler_tag, show_opcode_name(__entry->opcode), 256 248 __parse_cdb(__get_dynamic_array(cmnd), __entry->cmd_len), 257 249 __print_hex(__get_dynamic_array(cmnd), __entry->cmd_len), 258 - __entry->rtn) 250 + show_rtn_name(__entry->rtn) 251 + ) 259 252 ); 260 253 261 254 DECLARE_EVENT_CLASS(scsi_cmd_done_timeout_template,
+26
include/ufs/ufs.h
··· 182 182 QUERY_ATTR_IDN_CURR_WB_BUFF_SIZE = 0x1F, 183 183 QUERY_ATTR_IDN_TIMESTAMP = 0x30, 184 184 QUERY_ATTR_IDN_DEV_LVL_EXCEPTION_ID = 0x34, 185 + QUERY_ATTR_IDN_HID_DEFRAG_OPERATION = 0x35, 186 + QUERY_ATTR_IDN_HID_AVAILABLE_SIZE = 0x36, 187 + QUERY_ATTR_IDN_HID_SIZE = 0x37, 188 + QUERY_ATTR_IDN_HID_PROGRESS_RATIO = 0x38, 189 + QUERY_ATTR_IDN_HID_STATE = 0x39, 185 190 QUERY_ATTR_IDN_WB_BUF_RESIZE_HINT = 0x3C, 186 191 QUERY_ATTR_IDN_WB_BUF_RESIZE_EN = 0x3D, 187 192 QUERY_ATTR_IDN_WB_BUF_RESIZE_STATUS = 0x3E, ··· 406 401 UFS_DEV_HPB_SUPPORT = BIT(7), 407 402 UFS_DEV_WRITE_BOOSTER_SUP = BIT(8), 408 403 UFS_DEV_LVL_EXCEPTION_SUP = BIT(12), 404 + UFS_DEV_HID_SUPPORT = BIT(13), 409 405 }; 410 406 #define UFS_DEV_HPB_SUPPORT_VERSION 0x310 411 407 ··· 470 464 REF_CLK_FREQ_38_4_MHZ = 2, 471 465 REF_CLK_FREQ_52_MHZ = 3, 472 466 REF_CLK_FREQ_INVAL = -1, 467 + }; 468 + 469 + /* bDefragOperation attribute values */ 470 + enum ufs_hid_defrag_operation { 471 + HID_ANALYSIS_AND_DEFRAG_DISABLE = 0, 472 + HID_ANALYSIS_ENABLE = 1, 473 + HID_ANALYSIS_AND_DEFRAG_ENABLE = 2, 474 + }; 475 + 476 + /* bHIDState attribute values */ 477 + enum ufs_hid_state { 478 + HID_IDLE = 0, 479 + ANALYSIS_IN_PROGRESS = 1, 480 + DEFRAG_REQUIRED = 2, 481 + DEFRAG_IN_PROGRESS = 3, 482 + DEFRAG_COMPLETED = 4, 483 + DEFRAG_NOT_REQUIRED = 5, 484 + NUM_UFS_HID_STATES = 6, 473 485 }; 474 486 475 487 /* bWriteBoosterBufferResizeEn attribute */ ··· 649 625 u32 rtc_update_period; 650 626 651 627 u8 rtt_cap; /* bDeviceRTTCap */ 628 + 629 + bool hid_sup; 652 630 }; 653 631 654 632 /*
+1
include/ufs/ufshcd.h
··· 1480 1480 bool ufshcd_is_hba_active(struct ufs_hba *hba); 1481 1481 void ufshcd_pm_qos_init(struct ufs_hba *hba); 1482 1482 void ufshcd_pm_qos_exit(struct ufs_hba *hba); 1483 + int ufshcd_dme_rmw(struct ufs_hba *hba, u32 mask, u32 val, u32 attr); 1483 1484 1484 1485 /* Wrapper functions for safely calling variant operations */ 1485 1486 static inline int ufshcd_vops_init(struct ufs_hba *hba)