summaryrefslogtreecommitdiff
path: root/drivers/scsi
AgeCommit message (Collapse)Author
2019-12-21scsi: lpfc: Fix unmap of dpp bars affecting next driver loadJames Smart
When unattaching, the driver did not unmap the DPP bar. This caused the next load of the driver, which attempts to enable wc, to not work correctly and wc to be disabled due to an address mapping overlap. Fix by unmapping on unattach. Link: https://lore.kernel.org/r/20191218235808.31922-8-jsmart2021@gmail.com Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <jsmart2021@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-21scsi: lpfc: Fix disablement of FC-AL on lpe35000 modelsJames Smart
The order of the flags/checks for adapters where FC-AL is supported erroneously excluded lpe35000 adapter models. Also noted that the G7 flags for Loop and Persistent topology are incorrect. They should follow the rules as G6. Rework the logic to enable LPe35000 FC-AL support. Collapse G7 support logic to the same rules as G6. Link: https://lore.kernel.org/r/20191218235808.31922-7-jsmart2021@gmail.com Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <jsmart2021@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-21scsi: lpfc: Fix ras_log via debugfsJames Smart
/sys/kernel/debug/lpfc/fn0/ras_log always shows the same ras_log even if there are link bounce events triggered via issue_lip Dynamic FW logging had logic that prematurely breaks from the buffer filling loop. Fix the check for buffer overrun by looking before copying and restricting copy length to the remaining buffer. When copying, ensure space for NULL character is left in the buffer. While in the routine - ensure the buffer is cleared before adding elements. Link: https://lore.kernel.org/r/20191218235808.31922-6-jsmart2021@gmail.com Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <jsmart2021@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-21scsi: lpfc: Fix Fabric hostname registration if system hostname changesJames Smart
There are reports of multiple ports on the same system displaying different hostnames in fabric FDMI displays. Currently, the driver registers the hostname at initialization and obtains the hostname via init_utsname()->nodename queried at the time the FC link comes up. Unfortunately, if the machine hostname is updated after initialization, such as via DHCP or admin command, the value registered initially will be incorrect. Fix by having the driver save the hostname that was registered with FDMI. The driver then runs a heartbeat action that will check the hostname. If the name changes, reregister the FMDI data. The hostname is used in RSNN_NN, FDMI RPA and FDMI RHBA. Link: https://lore.kernel.org/r/20191218235808.31922-5-jsmart2021@gmail.com Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <jsmart2021@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-21scsi: lpfc: Fix missing check for CSF in Write Object Mbox RspJames Smart
When the WriteObject mailbox response has change_status set to is 0x2 (Firmware Reset) or 0x04 (Port Migration Reset), the CSF field should also be checked to see if a fw reset is sufficient to enable all new features in the updated firmware image. If not, a fw reset would start the new firmware, but with a feature level equal to existing firmware. To enable the new features, a chip reset/pci slot reset would be required. Check the CSF bit when change_status is 0x2 or 0x4 to know whether to perform a pci bus reset or fw reset. Link: https://lore.kernel.org/r/20191218235808.31922-4-jsmart2021@gmail.com Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <jsmart2021@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-21scsi: lpfc: Fix: Rework setting of fdmi symbolic node name registrationJames Smart
This patch reworks the fdmi symbolic node name data for the following two issues: - Correcting extraneous periods following the DV and HN fdmi data fields. - Avoiding buffer overflow issues when formatting the data. The fix to the fist issue is to just remove the characters. The fix to the second issue has all data being staged in temporary storage before being moved to the real buffer. Link: https://lore.kernel.org/r/20191218235808.31922-3-jsmart2021@gmail.com Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <jsmart2021@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-21scsi: lpfc: Fix incomplete NVME discovery when targetJames Smart
NVMe device re-discovery does not complete. Dev_loss_tmo messages seen on initiator after recovery from a link disturbance. The failing case is the following: When the driver (as a NVME target) receives a PLOGI, the driver initiates an "unreg rpi" mailbox command. While the mailbox command is in progress, the driver requests that an ACC be sent to the initiator. The target's ACC is received by the initiator and the initiator then transmits a PLOGI. The driver receives the PLOGI prior to receiving the completion for the PLOGI response WQE that sent the ACC. (Different delivery sources from the hw so the race is very possible). Given the PLOGI is prior to the ACC completion (signifying PLOGI exchange complete), the driver LS_RJT's the PRLI. The "unreg rpi" mailbox then completes. Since PRLI has been received, the driver transmits a PLOGI to restart discovery, which the initiator then ACC's. If the driver processes the (re)PLOGI ACC prior to the completing the handling for the earlier ACC it sent the intiators original PLOGI, there is no state change for completion of the (re)PLOGI. The ndlp remains in "PLOGI Sent" and the initiator continues sending PRLI's which are rejected by the target until timeout or retry is reached. Fix by: When in target mode, defer sending an ACC for the received PLOGI until unreg RPI completes. Link: https://lore.kernel.org/r/20191218235808.31922-2-jsmart2021@gmail.com Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <jsmart2021@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-21scsi: qla2xxx: Update driver version to 10.01.00.22-kHimanshu Madhani
Link: https://lore.kernel.org/r/20191217220617.28084-15-hmadhani@marvell.com Signed-off-by: Himanshu Madhani <hmadhani@marvell.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-21scsi: qla2xxx: Fix mtcp dump collection failureQuinn Tran
MTCP dump failed due to MB Reg 10 was picking garbage data from stack memory. Fixes: 81178772b636a ("[SCSI] qla2xxx: Implemetation of mctp.") Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20191217220617.28084-14-hmadhani@marvell.com Signed-off-by: Quinn Tran <qutran@marvell.com> Signed-off-by: Himanshu Madhani <hmadhani@marvell.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-21scsi: qla2xxx: Fix stuck session in GNLQuinn Tran
Fix race condition between GNL completion processing and GNL request. Late submission of GNL request was not seen by the GNL completion thread. This patch will re-submit the GNL request for late submission fcport. Link: https://lore.kernel.org/r/20191217220617.28084-13-hmadhani@marvell.com Signed-off-by: Quinn Tran <qutran@marvell.com> Signed-off-by: Himanshu Madhani <hmadhani@marvell.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-21scsi: qla2xxx: Fix RIDA Format-2Quinn Tran
This patch fixes offset for Format-2 data structure for Report ID Acquisition. This caused driver to set remote_nport_id to 0x0000 in N2N configuration. In a scenario where initiator's WWPN is higher than target's WWPN, driver will assign 0x00 as target nport-id, which results into login failure. Link: https://lore.kernel.org/r/20191217220617.28084-12-hmadhani@marvell.com Signed-off-by: Quinn Tran <qutran@marvell.com> Signed-off-by: Himanshu Madhani <hmadhani@marvell.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-21scsi: qla2xxx: Consolidate fabric scanQuinn Tran
Consolidate scan for fabric loop and fabric topologies into a single scan. Link: https://lore.kernel.org/r/20191217220617.28084-11-hmadhani@marvell.com Signed-off-by: Quinn Tran <qutran@marvell.com> Signed-off-by: Himanshu Madhani <hmadhani@marvell.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-21scsi: qla2xxx: Correct fcport flags handlingShyam Sundar
This patch fixes some instances of FCF_ASYNC_{SENT|ACTIVE} flag setting and clearning were missing. Link: https://lore.kernel.org/r/20191217220617.28084-10-hmadhani@marvell.com Signed-off-by: Shyam Sundar <ssundar@marvell.com> Signed-off-by: Himanshu Madhani <hmadhani@marvell.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-21scsi: qla2xxx: Fix stuck login session using prli_pend_timerQuinn Tran
Session is stuck if driver sees FW has received a PRLI. Driver allows FW to finish with processing of PRLI by checking back with FW at a later time to see if the PRLI has finished. Instead, driver failed to push forward after re-checking PRLI completion. Fixes: ce0ba496dccf ("scsi: qla2xxx: Fix stuck login session") Cc: stable@vger.kernel.org # 5.3 Link: https://lore.kernel.org/r/20191217220617.28084-9-hmadhani@marvell.com Signed-off-by: Quinn Tran <qutran@marvell.com> Signed-off-by: Himanshu Madhani <hmadhani@marvell.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-19scsi: qla2xxx: Use common routine to free fcport structQuinn Tran
This patch does not change any any functionality. Link: https://lore.kernel.org/r/20191217220617.28084-8-hmadhani@marvell.com Signed-off-by: Quinn Tran <qutran@marvell.com> Signed-off-by: Himanshu Madhani <hmadhani@marvell.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-19scsi: qla2xxx: Add D-Port Diagnostic reason explanation logsJoe Carnuccio
This patch adds more details when D-Port diag async event is generated by the firmware. Link: https://lore.kernel.org/r/20191217220617.28084-7-hmadhani@marvell.com Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com> Signed-off-by: Himanshu Madhani <hmadhani@marvell.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-19scsi: qla2xxx: Fix update_fcport for current_topologyHimanshu Madhani
logout_on_delete flag should not be set if the topology is Loop. This patch fixes unintentional logout during loop topology. Link: https://lore.kernel.org/r/20191217220617.28084-6-hmadhani@marvell.com Signed-off-by: Himanshu Madhani <hmadhani@marvell.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-19scsi: qla2xxx: Cleanup unused async_logout_doneShyam Sundar
This patch removes unused qla2x00_async_logout_done from the code. Link: https://lore.kernel.org/r/20191217220617.28084-5-hmadhani@marvell.com Signed-off-by: Shyam Sundar <ssundar@marvell.com> Signed-off-by: Himanshu Madhani <hmadhani@marvell.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-19scsi: qla2xxx: Add a shadow variable to hold disc_state history of fcportShyam Sundar
This patch adds a shadow variable to hold disc_state history for the fcport and prints state transition when the logging is enabled. Link: https://lore.kernel.org/r/20191217220617.28084-4-hmadhani@marvell.com Signed-off-by: Shyam Sundar <ssundar@marvell.com> Signed-off-by: Himanshu Madhani <hmadhani@marvell.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-19scsi: qla2xxx: Fix fabric scan hangQuinn Tran
On timeout, SRB pointer was cleared from outstanding command array and dropped. It was not allowed to go through the done process and cleanup. This patch will abort the SRB where FW will return it with an error status and resume the normal cleanup. Link: https://lore.kernel.org/r/20191217220617.28084-3-hmadhani@marvell.com Signed-off-by: Quinn Tran <qutran@marvell.com> Signed-off-by: Himanshu Madhani <hmadhani@marvell.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-19scsi: qla2xxx: Remove defer flag to indicate immeadiate port lossHimanshu Madhani
During cable pull test case, if the port is disconnected for time larger than devloss timeout, driver does not mark path offline. In such case, instead of notifying SCSI-ML of loop down, driver goes into endless loop of device relogin because defer flag is set. With newer handling of device relogin in driver discovery, defer flag is now redundant. This patch removes defer flag and cleans up code handling port lost indication to SCSI-ML. Link: https://lore.kernel.org/r/20191217220617.28084-2-hmadhani@marvell.com Signed-off-by: Quinn Tran <qtran@marvell.com> Signed-off-by: Himanshu Madhani <hmadhani@marvell.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-19scsi: vmw_pvscsi: Silence dma mapping errorsThomas Hellstrom
These errors typically occur with swiotlb when the swiotlb buffer is full. But they are transient and would typically unnecessarily worry a user. Instead of errors, print debug messages. Cc: "James E.J. Bottomley" <jejb@linux.ibm.com> Cc: "Martin K. Petersen" <martin.petersen@oracle.com> Link: https://lore.kernel.org/r/20191203193052.7583-2-thomas_os@shipmail.org Acked-by: Jim Gill <jgill@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-19scsi: vmw_pvscsi: Fix swiotlb operationThomas Hellstrom
With swiotlb, the first byte of the sense buffer may in some cases be uninitialized since we use DMA_FROM_DEVICE, and the device incorrectly doesn't clear it. In those cases, clear it after DMA unmapping. Cc: "James E.J. Bottomley" <jejb@linux.ibm.com> Cc: "Martin K. Petersen" <martin.petersen@oracle.com> Link: https://lore.kernel.org/r/20191203193052.7583-1-thomas_os@shipmail.org Suggested-by: Vishal Bhakta <vbhakta@vmware.com> Acked-by: Jim Gill <jgill@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-19scsi: csiostor: Adjust indentation in csio_device_resetNathan Chancellor
Clang warns: ../drivers/scsi/csiostor/csio_scsi.c:1386:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation] csio_lnodes_exit(hw, 1); ^ ../drivers/scsi/csiostor/csio_scsi.c:1382:2: note: previous statement is here if (*buf != '1') ^ 1 warning generated. This warning occurs because there is a space after the tab on this line. Remove it so that the indentation is consistent with the Linux kernel coding style and clang no longer warns. Fixes: a3667aaed569 ("[SCSI] csiostor: Chelsio FCoE offload driver") Link: https://github.com/ClangBuiltLinux/linux/issues/818 Link: https://lore.kernel.org/r/20191218014726.8455-1-natechancellor@gmail.com Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-19scsi: aic7xxx: Adjust indentation in ahc_find_syncrateNathan Chancellor
Clang warns: ../drivers/scsi/aic7xxx/aic7xxx_core.c:2317:5: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation] if ((syncrate->sxfr_u2 & ST_SXFR) != 0) ^ ../drivers/scsi/aic7xxx/aic7xxx_core.c:2310:4: note: previous statement is here if (syncrate == &ahc_syncrates[maxsync]) ^ 1 warning generated. This warning occurs because there is a space amongst the tabs on this line. Remove it so that the indentation is consistent with the Linux kernel coding style and clang no longer warns. This has been a problem since the beginning of git history hence no fixes tag. Link: https://github.com/ClangBuiltLinux/linux/issues/817 Link: https://lore.kernel.org/r/20191218014220.52746-1-natechancellor@gmail.com Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-19scsi: qla4xxx: Adjust indentation in qla4xxx_mem_freeNathan Chancellor
Clang warns: ../drivers/scsi/qla4xxx/ql4_os.c:4148:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation] if (ha->fw_dump) ^ ../drivers/scsi/qla4xxx/ql4_os.c:4144:2: note: previous statement is here if (ha->queues) ^ 1 warning generated. This warning occurs because there is a space after the tab on this line. Remove it so that the indentation is consistent with the Linux kernel coding style and clang no longer warns. Fixes: 068237c87c64 ("[SCSI] qla4xxx: Capture minidump for ISP82XX on firmware failure") Link: https://github.com/ClangBuiltLinux/linux/issues/819 Link: https://lore.kernel.org/r/20191218015252.20890-1-natechancellor@gmail.com Acked-by: Manish Rangankar <mrangankar@marvell.com> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-19scsi: initio: make initio_state_7() staticChen Zhou
Fix sparse warning: drivers/scsi/initio.c:1643:5: warning: symbol 'initio_state_7' was not declared. Should it be static? Link: https://lore.kernel.org/r/20191217134309.41649-1-chenzhou10@huawei.com Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Chen Zhou <chenzhou10@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-19scsi: ibmvscsi_tgt: remove set but not used variables 'iue' and 'sd'Chen Zhou
Fixes gcc '-Wunused-but-set-variable' warning: drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c: In function ibmvscsis_send_messages: drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c:1888:19: warning: variable iue set but not used [-Wunused-but-set-variable] drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c: In function ibmvscsis_queue_data_in: drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c:3806:8: warning: variable sd set but not used [-Wunused-but-set-variable] Link: https://lore.kernel.org/r/20191213064042.161840-1-chenzhou10@huawei.com Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Chen Zhou <chenzhou10@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-19scsi: sym53c8xx: fix typos in commentsChen Zhou
Fix the typo "GPOI" -> "GPIO" in comment. Link: https://lore.kernel.org/r/20191212023556.72618-1-chenzhou10@huawei.com Signed-off-by: Chen Zhou <chenzhou10@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-19scsi: core: Fix a compiler warning triggered by the SCSI logging codeBart Van Assche
This patch fixes the following compiler warning: In file included from drivers/scsi/scsi_error.c:46: drivers/scsi/scsi_error.c: In function 'scsi_eh_target_reset': drivers/scsi/scsi_logging.h:65:81: warning: suggest braces around empty body in an 'if' statement [-Wempty-body] 65 | LOGGING(SCSI_LOG_ERROR_SHIFT, SCSI_LOG_ERROR_BITS, LEVEL,CMD); | ^ drivers/scsi/scsi_error.c:1562:4: note: in expansion of macro 'SCSI_LOG_ERROR_RECOVERY' 1562 | SCSI_LOG_ERROR_RECOVERY(3, | ^~~~~~~~~~~~~~~~~~~~~~~ Link: https://lore.kernel.org/r/20191209174205.190025-1-bvanassche@acm.org Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-19scsi: ufs: Power off hook for Cadence UFS driverSheeba B
Attach power off hook to Cadence UFS driver. Link: https://lore.kernel.org/r/1576491432-631-1-git-send-email-sheebab@cadence.com Reviewed-by: Avri Altman <avri.altman@wdc.com> Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com> Signed-off-by: Sheeba B <sheebab@cadence.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-19scsi: ufs: disable interrupt during clock-gatingStanley Chu
Similar to suspend, ufshcd interrupt can be disabled since there won't be any host controller transaction expected till clocks ungated. Link: https://lore.kernel.org/r/1575721321-8071-3-git-send-email-stanley.chu@mediatek.com Reviewed-by: Asutosh Das <asutoshd@codeaurora.org> Reviewed-by: Avri Altman <avri.altman@wdc.com> Signed-off-by: Stanley Chu <stanley.chu@mediatek.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-19scsi: ufs: disable irq before disabling clocksStanley Chu
During suspend flow, interrupt shall be disabled before disabling clocks to avoid potential system hang due to accessing host registers after host clocks are disabled. For example, if an interrupt comes with IRQF_IRQPOLL flag configured with the misrouted interrupt recovery feature enabled, ufshcd ISR may be triggered even if nothing shall be done for UFS. In this case, system hang may happen if UFS interrupt status register is accessed with host clocks disabled. Link: https://lore.kernel.org/r/1575721321-8071-2-git-send-email-stanley.chu@mediatek.com Reviewed-by: Avri Altman <avri.altman@wdc.com> Signed-off-by: Stanley Chu <stanley.chu@mediatek.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-19scsi: ufs: Simplify a conditionDan Carpenter
We know that "check_for_bkops" is non-zero on this side of the || because it was checked on the other side. Link: https://lore.kernel.org/r/20191213104935.wgpq2epaz6zh5zus@kili.mountain Reviewed-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Avri Altman <avri.altman@wdc.com> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-19scsi: ufs: Unlock on a couple error pathsDan Carpenter
We introduced a few new error paths, but we can't return directly, we first have to unlock "hba->clk_scaling_lock" first. Fixes: a276c19e3e98 ("scsi: ufs: Avoid busy-waiting by eliminating tag conflicts") Link: https://lore.kernel.org/r/20191213104828.7i64cpoof26rc4fw@kili.mountain Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-19scsi: ufs: Update L4 attributes on manual hibern8 exit in Cadence UFS.Sheeba B
Backup L4 attributes duirng manual hibern8 entry and restore the L4 attributes on manual hibern8 exit as per JESD220C. Link: https://lore.kernel.org/r/1575606303-10917-1-git-send-email-sheebab@cadence.com Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com> Tested-by: Vignesh Raghavendra <vigneshr@ti.com> Signed-off-by: Sheeba B <sheebab@cadence.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-19scsi: ufs: Do not free irq in suspendCan Guo
Since ufshcd irq resource is allocated with the device resource management aware IRQ request implementation, we don't really need to free up irq during suspend, disabling it during suspend and reenabling it during resume should be good enough. Link: https://lore.kernel.org/r/0101016ed3d69793-22918f99-23bf-495d-8a36-a9c108d1cbce-000000@us-west-2.amazonses.com Reviewed-by: Stanley Chu <stanley.chu@mediatek.com> Signed-off-by: Can Guo <cang@codeaurora.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-19scsi: ufs: Do not clear the DL layer timersCan Guo
During power mode change, PACP_PWR_Req frame sends PAPowerModeUserData parameters (and they are considered valid by device if Flags[4] - UserDataValid bit is set in the same frame). Currently we don't set these PAPowerModeUserData parameters and hardware always sets UserDataValid bit which would clear all the DL layer timeout values of the peer device after the power mode change. This change sets the PAPowerModeUserData[0..5] to UniPro specification recommended default values, in addition we are also setting the relevant DME_LOCAL_* timer attributes as required by UFS HCI specification. Link: https://lore.kernel.org/r/0101016ed3d688a4-cfaeb1c9-238b-46c4-9c89-d48c410ba325-000000@us-west-2.amazonses.com Reviewed-by: Avri Altman <avri.altman@wdc.com> Reviewed-by: Bean Huo <beanhuo@micron.com> Signed-off-by: Can Guo <cang@codeaurora.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-19scsi: ufs: Release clock if DMA map failsCan Guo
In queuecommand path, if DMA map fails, it bails out with clock held. In this case, release the clock to keep its usage paired. [mkp: applied by hand] Link: https://lore.kernel.org/r/0101016ed3d66395-1b7e7fce-b74d-42ca-a88a-4db78b795d3b-000000@us-west-2.amazonses.com Reviewed-by: Bean Huo <beanhuo@micron.com> Signed-off-by: Can Guo <cang@codeaurora.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-19scsi: ufs: Use DBD setting in mode senseCan Guo
UFS standard requires DBD field to be set to 1 in MODE SENSE(10). Some card vendors are more strict and check the DBD field, hence respond with CHECK_CONDITION (Sense key set to ILLEGAL_REQUEST and ASC set to INVALID FIELD IN CDB). When host sends MODE SENSE for page caching, as a result of the CHECK_CONDITION response, host assumes that the device doesn't support the cache feature and doesn't send SYNCHRONIZE_CACHE commands to flush the device cache. This can result in data corruption in case of sudden power down when there is data stored in the device cache. This patch fixes the DBD field setting as required in UFS standard. Link: https://lore.kernel.org/r/0101016ed3d657e4-32a6dd52-1505-4312-97ff-2bd3bee59eb7-000000@us-west-2.amazonses.com Reviewed-by: Bean Huo <beanhuo@micron.com> Signed-off-by: Can Guo <cang@codeaurora.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-19scsi: core: Adjust DBD setting in MODE SENSE for caching mode page per LLDCan Guo
UFS JEDEC standards require DBD field to be set to 1 in mode sense command. This patch allows LLD to define the setting of DBD, if required. Link: https://lore.kernel.org/r/0101016ed3d643f9-ffd45d6c-c593-4a13-a18f-a32da3d3bb97-000000@us-west-2.amazonses.com Reviewed-by: Avri Altman <avri.altman@wdc.com> Signed-off-by: Can Guo <cang@codeaurora.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-19scsi: ufs: Complete pending requests in host reset and restore pathCan Guo
In UFS host reset and restore path, before probe, we stop and start the host controller once. After host controller is stopped, the pending requests, if any, are cleared from the doorbell, but no completion IRQ would be raised due to the hba is stopped. These pending requests shall be completed along with the first NOP_OUT command (as it is the first command which can raise a transfer completion IRQ) sent during probe. Since the OCSs of these pending requests are not SUCCESS (because they are not yet literally finished), their UPIUs shall be dumped. When there are multiple pending requests, the UPIU dump can be overwhelming and may lead to stability issues because it is in atomic context. Therefore, before probe, complete these pending requests right after host controller is stopped and silence the UPIU dump from them. Link: https://lore.kernel.org/r/1574751214-8321-5-git-send-email-cang@qti.qualcomm.com Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com> Reviewed-by: Bean Huo <beanhuo@micron.com> Tested-by: Bean Huo <beanhuo@micron.com> Signed-off-by: Can Guo <cang@codeaurora.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-19scsi: ufs: Avoid messing up the compl_time_stamp of lrbsCan Guo
To be on the safe side, do not touch lrb after clearing its slot in the lrb_in_use bitmap to avoid messing up the next task which would possibly occupy this lrb. [mkp: applied by hand] Link: https://lore.kernel.org/r/1574751214-8321-4-git-send-email-cang@qti.qualcomm.com Reviewed by: Avri Altman <avri.altman@wdc.com> Reviewed-by: Bean Huo <beanhuo@micron.com> Signed-off-by: Can Guo <cang@codeaurora.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-19scsi: ufs: Update VCCQ2 and VCCQ min/max voltage hard codesCan Guo
Per UFS 3.0 JEDEC standard, the VCCQ2 min voltage is 1.7v and the VCCQ voltage range is 1.14v ~ 1.26v. Update their hard codes accordingly to make sure they work in a safe range compliant for ver 1.0/1.1/2.0/2.1/3.0 UFS devices. Link: https://lore.kernel.org/r/1574751214-8321-3-git-send-email-cang@qti.qualcomm.com Reviewed-by: Bean Huo <beanhuo@micron.com> Reviewed-by: Avri Altman <avri.altman@wdc.com> Signed-off-by: Can Guo <cang@codeaurora.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-19scsi: ufs: Recheck bkops level if bkops is disabledAsutosh Das
bkops level should be rechecked upon receiving an exception. Currently the level is being cached and never updated. Update bkops each time the level is checked. Also do not use the cached bkops level value if it is disabled and then enabled. Fixes: afdfff59a0e0 (scsi: ufs: handle non spec compliant bkops behaviour by device) Link: https://lore.kernel.org/r/1574751214-8321-2-git-send-email-cang@qti.qualcomm.com Reviewed-by: Bean Huo <beanhuo@micron.com> Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com> Tested-by: Alim Akhtar <alim.akhtar@samsung.com> Signed-off-by: Asutosh Das <asutoshd@codeaurora.org> Signed-off-by: Can Guo <cang@codeaurora.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-19scsi: ufs: Use blk_{get,put}_request() to allocate and free TMFsBart Van Assche
Manage TMF tags with blk_{get,put}_request() instead of ufshcd_get_tm_free_slot() / ufshcd_put_tm_slot(). Store a per-request completion pointer in request.end_io_data instead of using a waitqueue to report TMF completion. Cc: Can Guo <cang@codeaurora.org> Cc: Stanley Chu <stanley.chu@mediatek.com> Cc: Avri Altman <avri.altman@wdc.com> Cc: Tomas Winkler <tomas.winkler@intel.com> Link: https://lore.kernel.org/r/20191209181309.196233-3-bvanassche@acm.org Tested-by: Bean Huo <beanhuo@micron.com> Reviewed-by: Avri Altman <avri.altman@wdc.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-19scsi: ufs: Avoid busy-waiting by eliminating tag conflictsBart Van Assche
Instead of tracking which tags are in use in the ufs_hba.lrb_in_use bitmask, rely on the block layer tag allocation mechanism. This patch removes the following busy-waiting loop if ufshcd_issue_devman_upiu_cmd() and the block layer accidentally allocate the same tag for a SCSI request: * ufshcd_queuecommand() returns SCSI_MLQUEUE_HOST_BUSY. * The SCSI core requeues the SCSI command. Cc: Can Guo <cang@codeaurora.org> Cc: Stanley Chu <stanley.chu@mediatek.com> Cc: Avri Altman <avri.altman@wdc.com> Cc: Tomas Winkler <tomas.winkler@intel.com> Link: https://lore.kernel.org/r/20191209181309.196233-2-bvanassche@acm.org Tested-by: Bean Huo <beanhuo@micron.com> Reviewed-by: Avri Altman <avri.altman@wdc.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-19scsi: esp_scsi: Add support for FSC chipKars de Jong
The FSC (NCR53CF9x-2 / SYM53CF9x-2) has a different family code than QLogic or Emulex parts. This caused it to be detected as a FAS100A. Unforunately, this meant the configuration of the CONFIG3 register was incorrect. This causes data transfer issues with FAST-SCSI targets. The FSC also has the CONFIG4 register. It can be used to enable a feature called Active Negation which should always be enabled according to the data manual. Link: https://lore.kernel.org/r/20191119202021.28720-3-jongk@linux-m68k.org Reviewed-by: Finn Thain <fthain@telegraphics.com.au> Signed-off-by: Kars de Jong <jongk@linux-m68k.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-19scsi: esp_scsi: Correct ordering of PCSCSI definition in esp_rev enumKars de Jong
The order of the definitions in the esp_rev enum is important. The values are used in comparisons for chip features. Add a comment to the enum explaining this. Also, the actual values for the enum fields are irrelevant, so remove the explicit values (suggested by Geert Uytterhoeven). This makes adding a new field in the middle of the enum easier. Finally, move the PCSCSI definition to the right place in the enum. In its previous location, at the end of the enum, the wrong values are written to the CONFIG3 register when used with FAST-SCSI targets. Link: https://lore.kernel.org/r/20191119202021.28720-2-jongk@linux-m68k.org Signed-off-by: Kars de Jong <jongk@linux-m68k.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-12-19scsi: libcxgbi: fix NULL pointer dereference in cxgbi_device_destroy()Varun Prakash
If cxgb4i_ddp_init() fails then cdev->cdev2ppm will be NULL, so add a check for NULL pointer before dereferencing it. Link: https://lore.kernel.org/r/1576676731-3068-1-git-send-email-varun@chelsio.com Signed-off-by: Varun Prakash <varun@chelsio.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>