aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_sli.c (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2020-07-02scsi: lpfc: Allow applications to issue Common Set Features mailbox commandDick Kennedy2-0/+15
Currently the driver validates command codes received from the application. COMMON_SET_FEATURES is not currently being approved. Add definition of the missing command and allow it to be issued by applications. Link: https://lore.kernel.org/r/20200630215001.70793-11-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>
2020-07-02scsi: lpfc: Fix language in 0373 message to reflect non-error messageDick Kennedy1-2/+2
Change vocabulary of 0373 log msg from "error" to "cmpl" The current language of the 0373 message contains the word "error" which caused a number of customers to inquire about the "error" and if it should be a concern. It isn't an error, it's simply an io completion status. Revise the message to replace the word "error" with "cmpl" for completion. Link: https://lore.kernel.org/r/20200630215001.70793-10-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>
2020-07-02scsi: lpfc: Fix kdump hang on PPCDick Kennedy1-6/+30
When the kdump kernel shuts down lpfc calls flush_work_queue on an interrupt to schedule the cq handler. When there is only one CPU active on the kdump kernel, it is possible for the work_on to get scheduled on a non-active CPU causing it to never be scheduled. When in the kdump environment, per-CPU affinity of cq's to cpus is not necessary. In those cases, use a general queue_work rather than a queue_work_on(). Link: https://lore.kernel.org/r/20200630215001.70793-9-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>
2020-07-02scsi: lpfc: Fix shost refcount mismatch when deleting vportDick Kennedy1-18/+8
When vports are deleted, it is observed that there is memory/kthread leakage as the vport isn't fully being released. There is a shost reference taken in scsi_add_host_dma that is not released during scsi_remove_host. It was noticed that other drivers resolve this by doing a scsi_host_put after calling scsi_remove_host. The vport_delete routine is taking two references one that corresponds to an access to the scsi_host in the vport_delete routine and another that is released after the adapter mailbox command completes that destroys the VPI that corresponds to the vport. Remove one of the references taken such that the second reference that is put will complete the missing scsi_add_host_dma reference and the shost will be terminated. Link: https://lore.kernel.org/r/20200630215001.70793-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>
2020-07-02scsi: lpfc: Fix stack trace seen while setting rrq activeDick Kennedy2-2/+3
Call traces have been observed running different tests that involve aborts and setting the rrq active flag. The lpfc_set_rrq_active routine is doing a mempool_alloc under the soft_irq processing level. When the mempool needs to get a new buffer from the free pool and has to wait for memory to become free it will check the flags passed in on the alloc and dump the stack if the thread is running in interrupt context. Replace the GFP_KERNEL flag with GFP_ATOMIC so that the memory allocation will not attempt to sleep if there is no mem available. Link: https://lore.kernel.org/r/20200630215001.70793-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>
2020-07-02scsi: lpfc: Fix oops due to overrun when reading SLI3 dataDick Kennedy2-13/+15
When using DUMP on SLI3 to read VPD and Port status data (config region 23), the adapter is overruning the kmalloc'd buffer causing havoc on other consumers of the allocation pools. Rework the loops processing the dump data and validate/size memory lengths before performing bcopy. Link: https://lore.kernel.org/r/20200630215001.70793-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>
2020-07-02scsi: lpfc: Fix NVMe rport deregister and registration during ADISCDick Kennedy1-5/+11
During driver unload/reload testing, the NVMe initiator would not re-establish connectivity to NVMe controllers on reload. The failing NVMe array supports concurrent FCP and NVMe operation via different nport_id's. The array was repeatedly sending an ADISC every 2 seconds after PLOGI completed and while NVMe subsystems were executing discovery. The target would continue this state for roughly 45 seconds. The driver's current behavior on ADISC receipt is to validate a the ADISC vs the device and issue a RESUME_RPI to restore transmission. The receipt of the ADISC effectively caused a driver to take actions similar to a logout and login for the remote port, causing the deregistration of the nvme rport and a subsequent re-registration. This caused a constant reset and re-connect of the NVMe controller while this 45s window occurred. There was no need for the state changes as ADISC does not change login state. This patch corrects this behavior by validating if the remoteport is already logged in (MAPPED) and when true, avoids the call to set the ndlp state to MAPPED, which triggers the unreg/re-reg. Thus ADISC does not change the login state of the node. Link: https://lore.kernel.org/r/20200630215001.70793-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>
2020-07-02scsi: lpfc: Fix missing MDS functionalityDick Kennedy2-1/+2
Visual code inspection of the MDS implementation revealed two errors in the driver: - The set features Feature Code had an incorrect value - The routine that classifies command type for cmd completions was missing the Send Frame definition. Send Frame is used for MDS driver loopback. Link: https://lore.kernel.org/r/20200630215001.70793-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>
2020-07-02scsi: lpfc: Fix unused assignment in lpfc_sli4_bsg_link_diag_testDick Kennedy1-18/+16
Coverity reported the following error: Assigned value that is never used may represent unnecessary computation. The rc variable was initially assigned a value but in several cases, when an error case is detected, it is reassigned a new value. The initial value had little use. In code-reviewing this routine, it could use some cleanup: - Setting the initialization value to -ENODEV is a much better choice and lessens code in the routine. - The wasn't tracking logic errors vs no error and mailbox failure. Better to resolve by adding a status to track the mailbox failure and merge it with the logic error when the routine returns. Link: https://lore.kernel.org/r/20200630215001.70793-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>
2020-07-01scsi: qla2xxx: SAN congestion management implementationShyam Sundar8-33/+295
* Firmware Initialization with SCM enabled based on NVRAM setting and firmware support (About Firmware). * Enable PUREX and add support for fabric performance impact notification (FPIN) handling. * Allocate a default PUREX item for each vha to handle memory allocation failures in ISR. Link: https://lore.kernel.org/r/20200630102229.29660-3-njavali@marvell.com Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com> Reviewed-by: James Smart <james.smart@broadcom.com> Signed-off-by: Shyam Sundar <ssundar@marvell.com> Signed-off-by: Arun Easi <aeasi@marvell.com> Signed-off-by: Nilesh Javali <njavali@marvell.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-07-01scsi: qla2xxx: Change in PUREX to handle FPIN ELS requestsShyam Sundar6-43/+134
SAN Congestion Management generates ELS pkts whose size can vary and be > 64 bytes. Change the PUREX handling code to support non-standard ELS pkt size. Link: https://lore.kernel.org/r/20200630102229.29660-2-njavali@marvell.com Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com> Signed-off-by: Shyam Sundar <ssundar@marvell.com> Signed-off-by: Arun Easi <aeasi@marvell.com> Signed-off-by: Nilesh Javali <njavali@marvell.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-30scsi: qla2xxx: Introduce a function for computing the debug message prefixBart Van Assche1-64/+32
Instead of repeating the code for generating a debug message prefix six times, introduce a function for computing the debug message prefix. Link: https://lore.kernel.org/r/20200629225454.22863-10-bvanassche@acm.org Cc: Nilesh Javali <njavali@marvell.com> Cc: Quinn Tran <qutran@marvell.com> Cc: Himanshu Madhani <himanshu.madhani@oracle.com> Cc: Martin Wilck <mwilck@suse.com> Cc: Roman Bolshakov <r.bolshakov@yadro.com> Reviewed-by: Daniel Wagner <dwagner@suse.de> Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-30scsi: qla2xxx: Make qla2x00_restart_isp() easier to readBart Van Assche1-17/+22
Instead of using complicated control flow to only have one return statement at the end of qla2x00_restart_isp(), return an error status as soon as it is known that this function will fail. Link: https://lore.kernel.org/r/20200629225454.22863-9-bvanassche@acm.org Cc: Nilesh Javali <njavali@marvell.com> Cc: Quinn Tran <qutran@marvell.com> Cc: Himanshu Madhani <himanshu.madhani@oracle.com> Cc: Martin Wilck <mwilck@suse.com> Cc: Roman Bolshakov <r.bolshakov@yadro.com> Reviewed-by: Daniel Wagner <dwagner@suse.de> Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-30scsi: qla2xxx: Fix a Coverity complaint in qla2100_fw_dump()Bart Van Assche2-1/+2
'cnt' can exceed the size of the risc_ram[] array. Prevent that Coverity complains by rewriting an address calculation expression. This patch fixes the following Coverity complaint: CID 337803 (#1 of 1): Out-of-bounds read (OVERRUN) 109. overrun-local: Overrunning array of 122880 bytes at byte offset 122880 by dereferencing pointer &fw->risc_ram[cnt]. Link: https://lore.kernel.org/r/20200629225454.22863-8-bvanassche@acm.org Cc: Nilesh Javali <njavali@marvell.com> Cc: Quinn Tran <qutran@marvell.com> Cc: Himanshu Madhani <himanshu.madhani@oracle.com> Cc: Martin Wilck <mwilck@suse.com> Cc: Roman Bolshakov <r.bolshakov@yadro.com> Reviewed-by: Daniel Wagner <dwagner@suse.de> Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-30scsi: qla2xxx: Make __qla2x00_alloc_iocbs() initialize 32 bits of request_t.handleBart Van Assche1-2/+2
The request_t 'handle' member is 32-bits wide, hence use wrt_reg_dword(). Change the cast in the wrt_reg_byte() call to make it clear that a regular pointer is casted to an __iomem pointer. Note: 'pkt' points to I/O memory for the qlafx00 adapter family and to coherent memory for all other adapter families. This patch fixes the following Coverity complaint: CID 358864 (#1 of 1): Reliance on integer endianness (INCOMPATIBLE_CAST) incompatible_cast: Pointer &pkt->handle points to an object whose effective type is unsigned int (32 bits, unsigned) but is dereferenced as a narrower unsigned short (16 bits, unsigned). This may lead to unexpected results depending on machine endianness. Link: https://lore.kernel.org/r/20200629225454.22863-7-bvanassche@acm.org Fixes: 8ae6d9c7eb10 ("[SCSI] qla2xxx: Enhancements to support ISPFx00.") Cc: Nilesh Javali <njavali@marvell.com> Cc: Quinn Tran <qutran@marvell.com> Cc: Himanshu Madhani <himanshu.madhani@oracle.com> Cc: Martin Wilck <mwilck@suse.com> Cc: Roman Bolshakov <r.bolshakov@yadro.com> Reviewed-by: Daniel Wagner <dwagner@suse.de> Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-30scsi: qla2xxx: Remove a superfluous castBart Van Assche1-2/+1
Remove an unnecessary cast because it prevents the compiler to perform type checking. Link: https://lore.kernel.org/r/20200629225454.22863-6-bvanassche@acm.org Cc: Nilesh Javali <njavali@marvell.com> Cc: Quinn Tran <qutran@marvell.com> Cc: Himanshu Madhani <himanshu.madhani@oracle.com> Cc: Martin Wilck <mwilck@suse.com> Cc: Roman Bolshakov <r.bolshakov@yadro.com> Reviewed-by: Daniel Wagner <dwagner@suse.de> Reviewed-by: Shyam Sundar <ssundar@marvell.com> Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-30scsi: qla2xxx: Initialize 'n' before using itBart Van Assche1-0/+1
The following code: qla82xx_rom_fast_read(ha, 0, &n) only initializes 'n' if it succeeds. Since 'n' may be reported in a debug message even if no ROM reads succeeded, initialize 'n' to zero. This patch fixes the following sparse warning: qla_nx.c:1218: qla82xx_pinit_from_rom() error: uninitialized symbol 'n'. Link: https://lore.kernel.org/r/20200629225454.22863-5-bvanassche@acm.org Cc: Nilesh Javali <njavali@marvell.com> Cc: Quinn Tran <qutran@marvell.com> Cc: Himanshu Madhani <himanshu.madhani@oracle.com> Cc: Martin Wilck <mwilck@suse.com> Cc: Roman Bolshakov <r.bolshakov@yadro.com> Reviewed-by: Daniel Wagner <dwagner@suse.de> Reviewed-by: Shyam Sundar <ssundar@marvell.com> Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-30scsi: qla2xxx: Make qla82xx_flash_wait_write_finish() easier to readBart Van Assche1-12/+7
Return early instead of having a single return statement at the end of this function. This patch fixes the following sparse warning: qla_nx.c:1018: qla82xx_flash_wait_write_finish() error: uninitialized symbol 'val'. Link: https://lore.kernel.org/r/20200629225454.22863-4-bvanassche@acm.org Cc: Nilesh Javali <njavali@marvell.com> Cc: Quinn Tran <qutran@marvell.com> Cc: Himanshu Madhani <himanshu.madhani@oracle.com> Cc: Martin Wilck <mwilck@suse.com> Cc: Roman Bolshakov <r.bolshakov@yadro.com> Reviewed-by: Daniel Wagner <dwagner@suse.de> Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-30scsi: qla2xxx: Remove the __packed annotation from struct fcp_hdr and fcp_hdr_leBart Van Assche1-2/+2
Remove the __packed annotation from struct fcp_hdr* because that annotation is not necessary for these data structures. Link: https://lore.kernel.org/r/20200629225454.22863-3-bvanassche@acm.org Cc: Nilesh Javali <njavali@marvell.com> Cc: Quinn Tran <qutran@marvell.com> Cc: Himanshu Madhani <himanshu.madhani@oracle.com> Cc: Martin Wilck <mwilck@suse.com> Cc: Roman Bolshakov <r.bolshakov@yadro.com> Reviewed-by: Daniel Wagner <dwagner@suse.de> Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-30scsi: qla2xxx: Check the size of struct fcp_hdr at compile timeBart Van Assche1-0/+1
Since struct fcp_hdr is used to exchange data with the firmware, check its size at compile time. Link: https://lore.kernel.org/r/20200629225454.22863-2-bvanassche@acm.org Cc: Nilesh Javali <njavali@marvell.com> Cc: Quinn Tran <qutran@marvell.com> Cc: Himanshu Madhani <himanshu.madhani@oracle.com> Cc: Martin Wilck <mwilck@suse.com> Cc: Roman Bolshakov <r.bolshakov@yadro.com> Reviewed-by: Daniel Wagner <dwagner@suse.de> Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-29scsi: target: tcmu: Fix crash on ARM during cmd completionBodo Stroesser1-1/+8
If tcmu_handle_completions() has to process a padding shorter than sizeof(struct tcmu_cmd_entry), the current call to tcmu_flush_dcache_range() with sizeof(struct tcmu_cmd_entry) as length param is wrong and causes crashes on e.g. ARM, because tcmu_flush_dcache_range() in this case calls flush_dcache_page(vmalloc_to_page(start)); with start being an invalid address above the end of the vmalloc'ed area. The fix is to use the minimum of remaining ring space and sizeof(struct tcmu_cmd_entry) as the length param. The patch was tested on kernel 4.19.118. See https://bugzilla.kernel.org/show_bug.cgi?id=208045#c10 Link: https://lore.kernel.org/r/20200629093756.8947-1-bstroesser@ts.fujitsu.com Tested-by: JiangYu <lnsyyj@hotmail.com> Acked-by: Mike Christie <michael.christie@oracle.com> Signed-off-by: Bodo Stroesser <bstroesser@ts.fujitsu.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-29scsi: ufs: ufs-exynos: Remove an unnecessary NULL checkDan Carpenter1-1/+1
The "head" pointer can't be NULL because it points to an address in the middle of a ufs_hba struct. Looking at this code, probably someone would wonder if the intent was to check whether "hba" is NULL, but "hba" isn't NULL and the check can just be removed. Link: https://lore.kernel.org/r/20200626105133.GF314359@mwanda Acked-by: Alim Akhtar <alim.akhtar@samsung.com> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-26scsi: storvsc: Fix spelling mistakeFlavio Suligoi1-1/+1
Fix typo: "trigerred" --> "triggered" Link: https://lore.kernel.org/r/20200624135600.14274-1-f.suligoi@asem.it Signed-off-by: Flavio Suligoi <f.suligoi@asem.it> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-26scsi: ufs: Disable WriteBooster capability for non-supported UFS devicesStanley Chu1-16/+19
If a UFS device is not qualified to use WriteBooster, either due to wrong UFS version or device-specific quirks, then the capability in host shall be disabled to prevent any WriteBooster operations in the future. Link: https://lore.kernel.org/r/20200625030430.25048-1-stanley.chu@mediatek.com Fixes: 3d17b9b5ab11 ("scsi: ufs: Add write booster feature support") Tested-by: Steev Klimaszewski <steev@kali.org> Reviewed-by: Avri Altman <avri.altman@wdc.com> Reviewed-by: Bean Huo <beanhuo@micron.com> Signed-off-by: Stanley Chu <stanley.chu@mediatek.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-26scsi: bnx2fc: Removal of unused variablesJaved Hasan1-15/+1
Removed all the unused variables. Link: https://lore.kernel.org/r/20200622093814.3250-1-jhasan@marvell.com Reported-by: kbuild test robot <lkp@intel.com> Signed-off-by: Javed Hasan <jhasan@marvell.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-26scsi: cumana_2: Fix different dev_id between request_irq() and free_irq()Christophe JAILLET1-1/+1
The dev_id used in request_irq() and free_irq() should match. Use 'info' in both cases. Link: https://lore.kernel.org/r/20200625204730.943520-1-christophe.jaillet@wanadoo.fr Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Acked-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-26scsi: ufs: ufs-exynos: Fix build warningAlim Akhtar1-0/+5
While building for x86_64 allmodconfig, the following warning was reported: WARNING: modpost: missing MODULE_LICENSE() in drivers/scsi/ufs/ufs-exynos.o Add the missing license/author/description tags. Link: https://lore.kernel.org/r/20200625154405.60448-1-alim.akhtar@samsung.com Fixes: 55f4b1f73631 ("scsi: ufs: ufs-exynos: Add UFS host support for Exynos SoCs") Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-24scsi: ufs: ufs-exynos: Fix return value check in exynos_ufs_init()Wei Yongjun1-6/+6
In case of error, the function devm_ioremap_resource() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Link: https://lore.kernel.org/r/20200618133837.127274-1-weiyongjun1@huawei.com Fixes: 55f4b1f73631 ("scsi: ufs: ufs-exynos: Add UFS host support for Exynos SoCs") Reported-by: Hulk Robot <hulkci@huawei.com> Acked-by: Alim Akhtar <alim.akhtar@samsung.com> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-24scsi: ufs: Allow exynos ufs driver to build as moduleAlim Akhtar1-1/+1
Allow Exynos UFS driver to build as a module. This patch fixes the followin build issue reported by kernel build robot. drivers/scsi/ufs/ufs-exynos.o: in function `exynos_ufs_probe': drivers/scsi/ufs/ufs-exynos.c:1231: undefined reference to `ufshcd_pltfrm_init' drivers/scsi/ufs/ufs-exynos.o: in function `exynos_ufs_pre_pwr_mode': drivers/scsi/ufs/ufs-exynos.c:635: undefined reference to `ufshcd_get_pwr_dev_param' drivers/scsi/ufs/ufs-exynos.o:undefined reference to `ufshcd_pltfrm_shutdown' drivers/scsi/ufs/ufs-exynos.o:undefined reference to `ufshcd_pltfrm_suspend' drivers/scsi/ufs/ufs-exynos.o:undefined reference to `ufshcd_pltfrm_resume' drivers/scsi/ufs/ufs-exynos.o:undefined reference to `ufshcd_pltfrm_runtime_suspend' drivers/scsi/ufs/ufs-exynos.o:undefined reference to `ufshcd_pltfrm_runtime_resume' drivers/scsi/ufs/ufs-exynos.o:undefined reference to `ufshcd_pltfrm_runtime_idle' Link: https://lore.kernel.org/r/20200620173232.52521-1-alim.akhtar@samsung.com Fixes: 55f4b1f73631 ("scsi: ufs: ufs-exynos: Add UFS host support for Exynos SoCs") Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-19scsi: target: tcmu: Fix crash in tcmu_flush_dcache_range on ARMBodo Stroesser1-1/+1
This patch fixes the following crash (see https://bugzilla.kernel.org/show_bug.cgi?id=208045) Process iscsi_trx (pid: 7496, stack limit = 0x0000000010dd111a) CPU: 0 PID: 7496 Comm: iscsi_trx Not tainted 4.19.118-0419118-generic #202004230533 Hardware name: Greatwall QingTian DF720/F601, BIOS 601FBE20 Sep 26 2019 pstate: 80400005 (Nzcv daif +PAN -UAO) pc : flush_dcache_page+0x18/0x40 lr : is_ring_space_avail+0x68/0x2f8 [target_core_user] sp : ffff000015123a80 x29: ffff000015123a80 x28: 0000000000000000 x27: 0000000000001000 x26: ffff000023ea5000 x25: ffffcfa25bbe08b8 x24: 0000000000000078 x23: ffff7e0000000000 x22: ffff000023ea5001 x21: ffffcfa24b79c000 x20: 0000000000000fff x19: ffff7e00008fa940 x18: 0000000000000000 x17: 0000000000000000 x16: ffff2d047e709138 x15: 0000000000000000 x14: 0000000000000000 x13: 0000000000000000 x12: ffff2d047fbd0a40 x11: 0000000000000000 x10: 0000000000000030 x9 : 0000000000000000 x8 : ffffc9a254820a00 x7 : 00000000000013b0 x6 : 000000000000003f x5 : 0000000000000040 x4 : ffffcfa25bbe08e8 x3 : 0000000000001000 x2 : 0000000000000078 x1 : ffffcfa25bbe08b8 x0 : ffff2d040bc88a18 Call trace: flush_dcache_page+0x18/0x40 is_ring_space_avail+0x68/0x2f8 [target_core_user] queue_cmd_ring+0x1f8/0x680 [target_core_user] tcmu_queue_cmd+0xe4/0x158 [target_core_user] __target_execute_cmd+0x30/0xf0 [target_core_mod] target_execute_cmd+0x294/0x390 [target_core_mod] transport_generic_new_cmd+0x1e8/0x358 [target_core_mod] transport_handle_cdb_direct+0x50/0xb0 [target_core_mod] iscsit_execute_cmd+0x2b4/0x350 [iscsi_target_mod] iscsit_sequence_cmd+0xd8/0x1d8 [iscsi_target_mod] iscsit_process_scsi_cmd+0xac/0xf8 [iscsi_target_mod] iscsit_get_rx_pdu+0x404/0xd00 [iscsi_target_mod] iscsi_target_rx_thread+0xb8/0x130 [iscsi_target_mod] kthread+0x130/0x138 ret_from_fork+0x10/0x18 Code: f9000bf3 aa0003f3 aa1e03e0 d503201f (f9400260) ---[ end trace 1e451c73f4266776 ]--- The solution is based on patch: "scsi: target: tcmu: Optimize use of flush_dcache_page" which restricts the use of tcmu_flush_dcache_range() to addresses from vmalloc'ed areas only. This patch now replaces the virt_to_page() call in tcmu_flush_dcache_range() - which is wrong for vmalloced addrs - by vmalloc_to_page(). The patch was tested on ARM with kernel 4.19.118 and 5.7.2 Link: https://lore.kernel.org/r/20200618131632.32748-3-bstroesser@ts.fujitsu.com Tested-by: JiangYu <lnsyyj@hotmail.com> Tested-by: Daniel Meyerholt <dxm523@gmail.com> Acked-by: Mike Christie <michael.christie@oracle.com> Signed-off-by: Bodo Stroesser <bstroesser@ts.fujitsu.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-19scsi: target: tcmu: Optimize use of flush_dcache_pageBodo Stroesser1-4/+7
(scatter|gather)_data_area() need to flush dcache after writing data to or before reading data from a page in uio data area. The two routines are able to handle data transfer to/from such a page in fragments and flush the cache after each fragment was copied by calling the wrapper tcmu_flush_dcache_range(). That means: 1) flush_dcache_page() can be called multiple times for the same page. 2) Calling flush_dcache_page() indirectly using the wrapper does not make sense, because each call of the wrapper is for one single page only and the calling routine already has the correct page pointer. Change (scatter|gather)_data_area() such that, instead of calling tcmu_flush_dcache_range() before/after each memcpy, it now calls flush_dcache_page() before unmapping a page (when writing is complete for that page) or after mapping a page (when starting to read the page). After this change only calls to tcmu_flush_dcache_range() for addresses in vmalloc'ed command ring are left over. The patch was tested on ARM with kernel 4.19.118 and 5.7.2 Link: https://lore.kernel.org/r/20200618131632.32748-2-bstroesser@ts.fujitsu.com Tested-by: JiangYu <lnsyyj@hotmail.com> Tested-by: Daniel Meyerholt <dxm523@gmail.com> Acked-by: Mike Christie <michael.christie@oracle.com> Signed-off-by: Bodo Stroesser <bstroesser@ts.fujitsu.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-19scsi: ufs: docs: Add WriteBooster documentationAsutosh Das1-0/+136
Adds sysfs documentation for WriteBooster entries. Link: https://lore.kernel.org/r/1591723067-22998-1-git-send-email-asutoshd@codeaurora.org Acked-by: Avri Altman <avri.altman@wdc.com> Signed-off-by: Asutosh Das <asutoshd@codeaurora.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-19scsi: core: Fix formatting errors in scsi_lib.cBean Huo1-22/+21
Delete trailing whitespace, multiple blank lines, and make switch/case be at the same indentation. Link: https://lore.kernel.org/r/20200619154117.10262-3-huobean@gmail.com Signed-off-by: Bean Huo <beanhuo@micron.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-19scsi: core: Remove scsi_sdb_cacheBean Huo3-19/+0
After commit f664a3cc17b7 ("scsi: kill off the legacy IO path"), scsi_sdb_cache is not used anymore. Remove it. Link: https://lore.kernel.org/r/20200619154117.10262-2-huobean@gmail.com Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Bean Huo <beanhuo@micron.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-19scsi: target: tcmu: Remove unnecessary bit TCMU_CMD_BIT_INFLIGHTBodo Stroesser1-2/+0
Since commit 61fb24822166 ("scsi: target: tcmu: Userspace must not complete queued commands") tcmu_cmd bit TCMU_CMD_BIT_INFLIGHT is set but never checked. So we can remove it safely. [mkp: fixed Mike's email address] Link: https://lore.kernel.org/r/20200619173806.5016-1-bstroesser@ts.fujitsu.com Signed-off-by: Bodo Stroesser <bstroesser@ts.fujitsu.com> Acked-by: Mike Christie <michael.christie@oracle.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-19scsi: ufs: ufs-exynos: Fix spelling mistake "pa_granularty" -> "pa_granularity"Colin Ian King1-1/+1
There is a spelling mistake in a dev_warn message. Fix it. Link: https://lore.kernel.org/r/20200617084911.167359-1-colin.king@canonical.com Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com> Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-19scsi: ufs-mediatek: Make ufs_mtk_wait_link_state staticStanley Chu1-2/+2
Fix build warning reported by kernel test robot: Warning: >> drivers/scsi/ufs/ufs-mediatek.c:181:5: warning: no previous prototype >> for 'ufs_mtk_wait_link_state' [-Wmissing-prototypes] Link: https://lore.kernel.org/r/20200616095120.14570-1-stanley.chu@mediatek.com Reported-by: kernel test robot <lkp@intel.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>
2020-06-15scsi: ufs: Fix imprecise load calculation in devfreq windowStanley Chu2-9/+11
The UFS load calculation is based on "total_time" and "busy_time" in a devfreq window. However, the source of time is different for both parameters: "busy_time" is assigned from "jiffies" thus has different accuracy from "total_time" which is assigned from ktime_get(). In addition, the time of window boundary is not exactly the same as the starting busy time in this window if UFS is actually busy in the beginning of the window. A similar accuracy error may also happen for the end of busy time in current window. To guarantee the precision of load calculation, we need to 1. Align time accuracy of both devfreq_dev_status.total_time and devfreq_dev_status.busy_time. For example, use "ktime_get()" directly. 2. Align the following timelines: - The beginning time of devfreq windows - The beginning of busy time in a new window - The end of busy time in the current window Link: https://lore.kernel.org/r/20200611101043.6379-1-stanley.chu@mediatek.com Fixes: a3cd5ec55f6c ("scsi: ufs: add load based scaling of UFS gear") 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>
2020-06-15scsi: ufs: Add trace event for UIC commandsStanley Chu2-0/+57
Use the ftrace infrastructure to conditionally trace UFS UIC command events. New trace event "ufshcd_uic_command" is created, which samples the following UFS UIC command data: - Device name - Optional identification string - UIC command opcode - UIC command argument1 - UIC command argument2 - UIC command argement3 Usage: echo 1 > /sys/kernel/debug/tracing/events/ufs/enable cat /sys/kernel/debug/tracing/trace_pipe Link: https://lore.kernel.org/r/20200615072235.23042-3-stanley.chu@mediatek.com Acked-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>
2020-06-15scsi: ufs: Remove unused field in struct uic_commandStanley Chu1-4/+0
Remove unused fields "cmd_active" and "result" in struct ufs_command. Link: https://lore.kernel.org/r/20200615072235.23042-2-stanley.chu@mediatek.com Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com> Signed-off-by: Stanley Chu <stanley.chu@mediatek.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-15scsi: ufs: Clean up device vendor name and device quirk tableStanley Chu2-10/+7
Clean up the following items: - Sort vendor names in alphabetical order - Squash quirks as compact as possible in device table to enhance performance of the lookup - Sort device quirks in alphabetical order Link: https://lore.kernel.org/r/20200612012625.6615-3-stanley.chu@mediatek.com Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com> Signed-off-by: Stanley Chu <stanley.chu@mediatek.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-15scsi: ufs: Add DELAY_BEFORE_LPM quirk for Micron devicesStanley Chu2-0/+3
It is confirmed that Micron device needs DELAY_BEFORE_LPM quirk to have a delay before VCC is powered off. Sdd Micron vendor ID and this quirk for Micron devices. Link: https://lore.kernel.org/r/20200612012625.6615-2-stanley.chu@mediatek.com Reviewed-by: Bean Huo <beanhuo@micron.com> Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com> Signed-off-by: Stanley Chu <stanley.chu@mediatek.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-15scsi: mpt3sas: Fix spelling mistakeFlavio Suligoi2-2/+2
Fix typo: "tigger" --> "trigger" Link: https://lore.kernel.org/r/20200609161313.32098-1-f.suligoi@asem.it Signed-off-by: Flavio Suligoi <f.suligoi@asem.it> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-15scsi: Fix trivial spellingKieran Bingham4-6/+6
The word 'descriptor' is misspelled throughout the tree. Fix it up accordingly: decriptors -> descriptors Link: https://lore.kernel.org/r/20200609124610.3445662-7-kieran.bingham+renesas@ideasonboard.com Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-15scsi: ufs: Add SPDX GPL-2.0 to replace GPL v2 boilerplateBean Huo6-157/+6
Add SPDX GPL-2.0 to UFS driver files that specified the GPL version 2 license, remove the full boilerplate text. Link: https://lore.kernel.org/r/20200605200520.20831-2-huobean@gmail.com Reviewed-by: Tomas Winkler <tomas.winkler@intel.com> Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com> Signed-off-by: Bean Huo <beanhuo@micron.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-15scsi: ufs: Add compatibility with 3.1 UFS unit descriptor lengthBean Huo2-3/+9
For UFS 3.1, the normal unit descriptor is 10 bytes larger than the RPMB unit. However, both descriptors share the same desc_idn, to cover both unit descriptors with one length, we choose the normal unit descriptor length by desc_index. Link: https://lore.kernel.org/r/20200603091959.27618-6-huobean@gmail.com Reviewed-by: Avri Altman <avri.altman@wdc.com> Signed-off-by: Bean Huo <beanhuo@micron.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-15scsi: ufs: Clean up ufs initialization pathBean Huo4-161/+38
At UFS initialization stage, to get the length of the descriptor, ufshcd_read_desc_length() was being called 6 times. Instead, we will capture the descriptor size the first time we'll read it. Delete unnecessary redundant code, remove ufshcd_read_desc_length(), ufshcd_init_desc_sizes(), and boost UFS initialization. Link: https://lore.kernel.org/r/20200603091959.27618-5-huobean@gmail.com Acked-by: Avri Altman <avri.altman@wdc.com> Reviewed-by: Bart van Assche <bvanassche@acm.org> Reviewed-by: Stanley Chu <stanley.chu@mediatek.com> Signed-off-by: Bean Huo <beanhuo@micron.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-15scsi: ufs: Fix potential NULL pointer access during memcpyBean Huo1-2/+2
If param_offset is not 0, the memcpy length shouldn't be the true descriptor length. Link: https://lore.kernel.org/r/20200603091959.27618-4-huobean@gmail.com Acked-by: Avri Altman <avri.altman@wdc.com> Signed-off-by: Bean Huo <beanhuo@micron.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-15scsi: ufs: Delete ufshcd_read_desc()Bean Huo1-19/+8
Delete ufshcd_read_desc(). Instead, let caller directly call ufshcd_read_desc_param(). Link: https://lore.kernel.org/r/20200603091959.27618-3-huobean@gmail.com Reviewed-by: Avri Altman <avri.altman@wdc.com> Reviewed-by: Bart van Assche <bvanassche@acm.org> Reviewed-by: Stanley Chu <stanley.chu@mediatek.com> Signed-off-by: Bean Huo <beanhuo@micron.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2020-06-15scsi: ufs: Remove max_t in ufs_get_device_descBean Huo1-4/+1
For the UFS device, the maximum descriptor size is 255, max_t called on ufs_get_device_desc() is useless. Link: https://lore.kernel.org/r/20200603091959.27618-2-huobean@gmail.com Reviewed-by: Stanley Chu <stanley.chu@mediatek.com> Acked-by: Avri Altman <avri.altman@wdc.com> Signed-off-by: Bart van Assche <bvanassche@acm.org> Signed-off-by: Bean Huo <beanhuo@micron.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>