aboutsummaryrefslogtreecommitdiff
path: root/drivers/scsi
AgeCommit message (Collapse)AuthorFilesLines
2019-03-27scsi: sd: Quiesce warning if device does not report optimal I/O sizeMartin K. Petersen1-0/+3
Commit a83da8a4509d ("scsi: sd: Optimal I/O size should be a multiple of physical block size") split one conditional into several separate statements in an effort to provide more accurate warning messages when a device reports a nonsensical value. However, this reorganization accidentally dropped the precondition of the reported value being larger than zero. This lead to a warning getting emitted on devices that do not report an optimal I/O size at all. Remain silent if a device does not report an optimal I/O size. Fixes: a83da8a4509d ("scsi: sd: Optimal I/O size should be a multiple of physical block size") Cc: Randy Dunlap <[email protected]> Cc: <[email protected]> Reported-by: Hussam Al-Tayeb <[email protected]> Tested-by: Hussam Al-Tayeb <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-27scsi: sd: Fix a race between closing an sd device and sd I/OBart Van Assche1-6/+13
The scsi_end_request() function calls scsi_cmd_to_driver() indirectly and hence needs the disk->private_data pointer. Avoid that that pointer is cleared before all affected I/O requests have finished. This patch avoids that the following crash occurs: Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 Call trace: scsi_mq_uninit_cmd+0x1c/0x30 scsi_end_request+0x7c/0x1b8 scsi_io_completion+0x464/0x668 scsi_finish_command+0xbc/0x160 scsi_eh_flush_done_q+0x10c/0x170 sas_scsi_recover_host+0x84c/0xa98 [libsas] scsi_error_handler+0x140/0x5b0 kthread+0x100/0x12c ret_from_fork+0x10/0x18 Cc: Christoph Hellwig <[email protected]> Cc: Ming Lei <[email protected]> Cc: Hannes Reinecke <[email protected]> Cc: Johannes Thumshirn <[email protected]> Cc: Jason Yan <[email protected]> Cc: <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Reported-by: Jason Yan <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-27scsi: core: Run queue when state is set to running after being blockedzhengbin1-0/+6
Use dd to test a SCSI device: 1. echo "blocked" >/sys/block/sda/device/state 2. dd if=/dev/sda of=/mnt/t.log bs=1M count=10 3. echo "running" >/sys/block/sda/device/state dd should finish this work after step 3, but it hangs. After step2, the call chain is this: blk_mq_dispatch_rq_list-->scsi_queue_rq-->prep_to_mq prep_to_mq will return BLK_STS_RESOURCE, and scsi_queue_rq will transition it to BLK_STS_DEV_RESOURCE which means that driver can guarantee that IO dispatch will be triggered in future when the resource is available. Need to follow the rule if we set the device state to running. [mkp: tweaked commit description and code comment as suggested by Bart] Signed-off-by: zhengbin <[email protected]> Reviewed-by: Ming Lei <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-27scsi: sd: Inline sd_probe_part2()Bart Van Assche1-58/+43
Make sd_probe() easier to read by inlining sd_probe_part2(). This patch does not change any functionality. Cc: Lee Duncan <[email protected]> Cc: Hannes Reinecke <[email protected]> Cc: Luis Chamberlain <[email protected]> Cc: Johannes Thumshirn <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-27scsi: sd: Rely on the driver core for asynchronous probingBart Van Assche4-47/+5
As explained during the 2018 LSF/MM session about increasing SCSI disk probing concurrency, the problems with the current probing approach are as follows: - The driver core is unaware of asynchronous SCSI LUN probing. wait_for_device_probe() waits for all asynchronous probes except asynchronous SCSI disk probes. - There is unnecessary serialization between sd_probe() and sd_remove(). This can lead to a deadlock. Hence this patch that modifies the sd driver such that it uses the driver core framework for asynchronous probing. The async domains and get_device()/put_device() pairs that became superfluous due to this change are removed. This patch does not affect the time needed for loading the scsi_debug kernel module with parameters delay=0 and max_luns=256. This patch depends on commit ef0ff68351be ("driver core: Probe devices asynchronously instead of the driver") that went upstream in kernel version v5.1-rc1. Cc: Lee Duncan <[email protected]> Cc: Hannes Reinecke <[email protected]> Cc: Luis Chamberlain <[email protected]> Cc: Johannes Thumshirn <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Dan Williams <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-27scsi: mpt3sas: fix indentation issueColin Ian King1-2/+2
There are a couple of statements that are incorrectly indented, fix these. Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-27scsi: libcxgbi: remove uninitialized variable lenColin Ian King1-3/+2
The variable len is not being inintialized and the uninitialized value is being returned. However, this return path is never reached because the default case in the switch statement returns -ENOSYS. Clean up the code by replacing the return -ENOSYS with a break for the default case and returning -ENOSYS at the end of the function. This allows len to be removed. Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-25scsi: qla4xxx: fix a potential NULL pointer dereferenceKangjie Lu1-0/+2
In case iscsi_lookup_endpoint fails, the fix returns -EINVAL to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu <[email protected]> Acked-by: Manish Rangankar <[email protected]> Reviewed-by: Mukesh Ojha <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-25scsi: gdth: Only call dma_free_coherent when buf is not NULL in ioc_generalNathan Chancellor1-2/+3
When building with -Wsometimes-uninitialized, Clang warns: drivers/scsi/gdth.c:3662:6: warning: variable 'paddr' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] Don't attempt to call dma_free_coherent when buf is NULL (meaning that we never called dma_alloc_coherent and initialized paddr), which avoids this warning. Link: https://github.com/ClangBuiltLinux/linux/issues/402 Signed-off-by: Nathan Chancellor <[email protected]> Reviewed-by: Arnd Bergmann <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-25scsi: pm8001: remove set but not used variables 'param, sas_ha'YueHaibing1-4/+0
Fixes gcc '-Wunused-but-set-variable' warning: drivers/scsi/pm8001/pm8001_hwi.c: In function 'mpi_smp_completion': drivers/scsi/pm8001/pm8001_hwi.c:2901:6: warning: variable 'param' set but not used [-Wunused-but-set-variable] drivers/scsi/pm8001/pm8001_hwi.c: In function 'pm8001_bytes_dmaed': drivers/scsi/pm8001/pm8001_hwi.c:3247:24: warning: variable 'sas_ha' set but not used [-Wunused-but-set-variable] They're never used since introduction, so can be removed. Signed-off-by: YueHaibing <[email protected]> Acked-by: Jack Wang <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-25scsi: aacraid: Insure we don't access PCIe space during AER/EEHDave Carroll2-3/+8
There are a few windows during AER/EEH when we can access PCIe I/O mapped registers. This will harden the access to insure we do not allow PCIe access during errors Signed-off-by: Dave Carroll <[email protected]> Reviewed-by: Sagar Biradar <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-25scsi: qla4xxx: avoid freeing unallocated dma memoryArnd Bergmann1-1/+1
Clang -Wuninitialized notices that on is_qla40XX we never allocate any DMA memory in get_fw_boot_info() but attempt to free it anyway: drivers/scsi/qla4xxx/ql4_os.c:5915:7: error: variable 'buf_dma' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] if (!(val & 0x07)) { ^~~~~~~~~~~~~ drivers/scsi/qla4xxx/ql4_os.c:5985:47: note: uninitialized use occurs here dma_free_coherent(&ha->pdev->dev, size, buf, buf_dma); ^~~~~~~ drivers/scsi/qla4xxx/ql4_os.c:5915:3: note: remove the 'if' if its condition is always true if (!(val & 0x07)) { ^~~~~~~~~~~~~~~~~~~ drivers/scsi/qla4xxx/ql4_os.c:5885:20: note: initialize the variable 'buf_dma' to silence this warning dma_addr_t buf_dma; ^ = 0 Skip the call to dma_free_coherent() here. Fixes: 2a991c215978 ("[SCSI] qla4xxx: Boot from SAN support for open-iscsi") Signed-off-by: Arnd Bergmann <[email protected]> Reviewed-by: Nathan Chancellor <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-25scsi: lpfc: avoid uninitialized variable warningArnd Bergmann1-4/+4
clang -Wuninitialized incorrectly sees a variable being used without initialization: drivers/scsi/lpfc/lpfc_nvme.c:2102:37: error: variable 'localport' is uninitialized when used here [-Werror,-Wuninitialized] lport = (struct lpfc_nvme_lport *)localport->private; ^~~~~~~~~ drivers/scsi/lpfc/lpfc_nvme.c:2059:38: note: initialize the variable 'localport' to silence this warning struct nvme_fc_local_port *localport; ^ = NULL 1 error generated. This is clearly in dead code, as the condition leading up to it is always false when CONFIG_NVME_FC is disabled, and the variable is always initialized when nvme_fc_register_localport() got called successfully. Change the preprocessor conditional to the equivalent C construct, which makes the code more readable and gets rid of the warning. Signed-off-by: Arnd Bergmann <[email protected]> Acked-by: James Smart <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-25scsi: lpfc: change snprintf to scnprintf for possible overflowSilvio Cesare4-339/+349
Change snprintf to scnprintf. There are generally two cases where using snprintf causes problems. 1) Uses of size += snprintf(buf, SIZE - size, fmt, ...) In this case, if snprintf would have written more characters than what the buffer size (SIZE) is, then size will end up larger than SIZE. In later uses of snprintf, SIZE - size will result in a negative number, leading to problems. Note that size might already be too large by using size = snprintf before the code reaches a case of size += snprintf. 2) If size is ultimately used as a length parameter for a copy back to user space, then it will potentially allow for a buffer overflow and information disclosure when size is greater than SIZE. When the size is used to index the buffer directly, we can have memory corruption. This also means when size = snprintf... is used, it may also cause problems since size may become large. Copying to userspace is mitigated by the HARDENED_USERCOPY kernel configuration. The solution to these issues is to use scnprintf which returns the number of characters actually written to the buffer, so the size variable will never exceed SIZE. Signed-off-by: Silvio Cesare <[email protected]> Signed-off-by: Willy Tarreau <[email protected]> Signed-off-by: James Smart <[email protected]> Cc: Dick Kennedy <[email protected]> Cc: Dan Carpenter <[email protected]> Cc: Kees Cook <[email protected]> Cc: Will Deacon <[email protected]> Cc: Greg KH <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-25scsi: ufs-mediatek: Add missing MODULE_* informationAnders Roxell1-0/+5
When building the ufs-mediatek module the following warning shows up: WARNING: modpost: missing MODULE_LICENSE() in drivers/scsi/ufs/ufs-mediatek.o Rework to add MODULE_LICENSE,MODULE_AUTHOR and MODULE_DESCRIPTION. Fixes: ddd90623ce26 ("scsi: ufs-mediatek: Add UFS support for Mediatek SoC chips") Signed-off-by: Anders Roxell <[email protected]> Reviewed-by: Stanley Chu <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-25scsi: ufs-mediatek: Fix platform_no_drv_owner.cocci warningsYueHaibing1-1/+0
Remove .owner field if calls are used which set it automatically Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci Signed-off-by: YueHaibing <[email protected]> Reviewed-by: Stanley Chu <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-25scsi: mpt3sas: Fix kernel panic during expander resetSreekanth Reddy2-0/+18
During expander reset handling, the driver invokes kernel function scsi_host_find_tag() to obtain outstanding requests associated with the scsi host managed by the driver. Driver loops from tag value zero to hba queue depth to obtain the outstanding scmds. But when blk-mq is enabled, the block layer may return stale entry for one or more requests. This may lead to kernel panic if the returned value is inaccessible or the memory pointed by the returned value is reused. Reference of upstream discussion: https://patchwork.kernel.org/patch/10734933/ Instead of calling scsi_host_find_tag() API for each and every smid (smid is tag +1) from one to shost->can_queue, now driver will call this API (to obtain the outstanding scmd) only for those smid's which are outstanding at the driver level. Driver will determine whether this smid is outstanding at driver level by looking into it's corresponding MPI request frame, if its MPI request frame is empty, then it means that this smid is free and does not need to call scsi_host_find_tag() for it. By doing this, driver will invoke scsi_host_find_tag() for only those tags which are outstanding at the driver level. Driver will check whether particular MPI request frame is empty or not by looking into the "DevHandle" field. If this field is zero then it means that this MPI request is empty. For active MPI request DevHandle must be non-zero. Also driver will memset the MPI request frame once the corresponding scmd is processed (i.e. just before calling scmd->done function). Signed-off-by: Sreekanth Reddy <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-20scsi: ibmvscsi: Fix empty event pool access during host removalTyrel Datwyler1-6/+16
The event pool used for queueing commands is destroyed fairly early in the ibmvscsi_remove() code path. Since, this happens prior to the call so scsi_remove_host() it is possible for further calls to queuecommand to be processed which manifest as a panic due to a NULL pointer dereference as seen here: PANIC: "Unable to handle kernel paging request for data at address 0x00000000" Context process backtrace: DSISR: 0000000042000000 ????Syscall Result: 0000000000000000 4 [c000000002cb3820] memcpy_power7 at c000000000064204 [Link Register] [c000000002cb3820] ibmvscsi_send_srp_event at d000000003ed14a4 5 [c000000002cb3920] ibmvscsi_send_srp_event at d000000003ed14a4 [ibmvscsi] ?(unreliable) 6 [c000000002cb39c0] ibmvscsi_queuecommand at d000000003ed2388 [ibmvscsi] 7 [c000000002cb3a70] scsi_dispatch_cmd at d00000000395c2d8 [scsi_mod] 8 [c000000002cb3af0] scsi_request_fn at d00000000395ef88 [scsi_mod] 9 [c000000002cb3be0] __blk_run_queue at c000000000429860 10 [c000000002cb3c10] blk_delay_work at c00000000042a0ec 11 [c000000002cb3c40] process_one_work at c0000000000dac30 12 [c000000002cb3cd0] worker_thread at c0000000000db110 13 [c000000002cb3d80] kthread at c0000000000e3378 14 [c000000002cb3e30] ret_from_kernel_thread at c00000000000982c The kernel buffer log is overfilled with this log: [11261.952732] ibmvscsi: found no event struct in pool! This patch reorders the operations during host teardown. Start by calling the SRP transport and Scsi_Host remove functions to flush any outstanding work and set the host offline. LLDD teardown follows including destruction of the event pool, freeing the Command Response Queue (CRQ), and unmapping any persistent buffers. The event pool destruction is protected by the scsi_host lock, and the pool is purged prior of any requests for which we never received a response. Finally, move the removal of the scsi host from our global list to the end so that the host is easily locatable for debugging purposes during teardown. Cc: <[email protected]> # v2.6.12+ Signed-off-by: Tyrel Datwyler <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-20scsi: ibmvscsi: Protect ibmvscsi_head from concurrent modificaitonTyrel Datwyler1-0/+5
For each ibmvscsi host created during a probe or destroyed during a remove we either add or remove that host to/from the global ibmvscsi_head list. This runs the risk of concurrent modification. This patch adds a simple spinlock around the list modification calls to prevent concurrent updates as is done similarly in the ibmvfc driver and ipr driver. Fixes: 32d6e4b6e4ea ("scsi: ibmvscsi: add vscsi hosts to global list_head") Cc: <[email protected]> # v4.10+ Signed-off-by: Tyrel Datwyler <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-20scsi: ufs-mediatek: Avoid using ret uninitialized in ufs_mtk_setup_clocksNathan Chancellor1-4/+1
When building with -Wsometimes-uninitialized, Clang warns: drivers/scsi/ufs/ufs-mediatek.c:112:7: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] if (on) ^~ drivers/scsi/ufs/ufs-mediatek.c:120:9: note: uninitialized use occurs here return ret; ^~~ drivers/scsi/ufs/ufs-mediatek.c:112:3: note: remove the 'if' if its condition is always true if (on) ^~~~~~~ drivers/scsi/ufs/ufs-mediatek.c:108:7: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] if (!on) ^~~ drivers/scsi/ufs/ufs-mediatek.c:120:9: note: uninitialized use occurs here return ret; ^~~ drivers/scsi/ufs/ufs-mediatek.c:108:3: note: remove the 'if' if its condition is always true if (!on) ^~~~~~~~ drivers/scsi/ufs/ufs-mediatek.c:96:9: note: initialize the variable 'ret' to silence this warning int ret; ^ = 0 2 warnings generated. Remove the default case and initialize ret to -EINVAL to properly fix this warning. Fixes: ddd90623ce26 ("scsi: ufs-mediatek: Add UFS support for Mediatek SoC chips") Link: https://github.com/ClangBuiltLinux/linux/issues/426 Signed-off-by: Nathan Chancellor <[email protected]> Reviewed-by: Nick Desaulniers <[email protected]> Reviewed-by: Stanley Chu <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-20scsi: ufs-mediatek: Make some symbols staticYueHaibing1-3/+3
Fix sparse warnings: drivers/scsi/ufs/ufs-mediatek.c:19:6: warning: symbol 'ufs_mtk_cfg_unipro_cg' was not declared. Should it be static? drivers/scsi/ufs/ufs-mediatek.c:55:5: warning: symbol 'ufs_mtk_bind_mphy' was not declared. Should it be static? drivers/scsi/ufs/ufs-mediatek.c:342:27: warning: symbol 'ufs_mtk_of_match' was not declared. Should it be static? Signed-off-by: YueHaibing <[email protected]> Reviewed-by: Mukesh Ojha <[email protected]> Reviewed-by: Stanley Chu <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-20scsi: lpfc: Fixup eq_clr_intr referencesJames Smart2-4/+4
Declaring interrupt clear routines as inline is bogus as they are used as an indirect pointer. Remove the inline references. Signed-off-by: Dick Kennedy <[email protected]> Signed-off-by: James Smart <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-20scsi: lpfc: Fix build errorJames Bottomley2-7/+5
You can't declare a function inline in a header if it doesn't have a body available to the compiler. So realistically you either don't declare it inline or you make it a static inline in the header. I think the latter applies in this case, so this should be the fix Signed-off-by: James Bottomley <[email protected]> Acked-by: James Smart <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-20scsi: hisi_sas: Add softreset in hisi_sas_I_T_nexus_reset()Luo Jiaxing1-0/+6
We found out that for v2 hw, a SATA disk can not be written to after the system comes up. In commit ffb1c820b8b6 ("scsi: hisi_sas: remove the check of sas_dev status in hisi_sas_I_T_nexus_reset()"), we introduced a path where we may issue an internal abort for a SATA device, but without following it with a softreset. We need to always follow an internal abort with a software reset, as per HW programming flow, so add this. Fixes: ffb1c820b8b6 ("scsi: hisi_sas: remove the check of sas_dev status in hisi_sas_I_T_nexus_reset()") Signed-off-by: Luo Jiaxing <[email protected]> Signed-off-by: John Garry <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-19scsi: mvumi: Stop using plain integer as NULL pointerYueHaibing1-3/+3
Fix following sparse warning: drivers/scsi/mvumi.c:1797:48: warning: Using plain integer as NULL pointer drivers/scsi/mvumi.c:2143:50: warning: Using plain integer as NULL pointer drivers/scsi/mvumi.c:755:58: warning: Using plain integer as NULL pointer Signed-off-by: YueHaibing <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-19scsi: qedi: Remove set but not used variable 'cls_sess'YueHaibing1-4/+0
Fixes gcc '-Wunused-but-set-variable' warning: drivers/scsi/qedi/qedi_fw.c: In function 'qedi_tmf_resp_work': drivers/scsi/qedi/qedi_fw.c:158:28: warning: variable 'cls_sess' set but not used [-Wunused-but-set-variable] drivers/scsi/qedi/qedi_fw.c: In function 'qedi_tmf_work': drivers/scsi/qedi/qedi_fw.c:1370:28: warning: variable 'cls_sess' set but not used [-Wunused-but-set-variable] It's never used since introduction. Signed-off-by: YueHaibing <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-19scsi: be2iscsi: lpfc: fix typoMatteo Croce2-3/+3
Fix spelling mistake: "lenght" -> "length" Signed-off-by: Matteo Croce <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-19scsi: qla2xxx: Fix a small typo in qla_bsg.cMilan P. Gandhi1-1/+1
Fixed a typo for 'iiDMA' cmd in qla_bsg.c. Signed-off-by: Milan P. Gandhi <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-19scsi: qla2xxx: Fix comment alignment in qla_bsg.cMilan P. Gandhi1-1/+1
Fixed a minor formatting issue with comment section in qla_bsg.c Signed-off-by: Milan P. Gandhi <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-19scsi: mvsas: clean up a few indentation issuesColin Ian King3-3/+5
There are a few statements that are not indented correctly, so fix these. Also add empty line between variable declaration and first statements in functions. Also remove whitespace between * and mvi_dev to clean up a cppcheck warning. Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-19scsi: qlogicfas408: clean up a couple of indentation issuesColin Ian King1-2/+2
An if statement is indented correctly and an outb statement has a redundant empty comment and incorrect indentation. Fix these. Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-19scsi: dpt_i2o: clean up indentation issues, remove spacesColin Ian King1-6/+6
There are several lines where the indentation has an extra space, fix this by removing the spaces. Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-19scsi: atp870u: clean up code style and indentation issuesColin Ian King1-4/+3
Clean up { brace to fix cppcheck warning. Remove some trailing spaces at end of a statement. Also clean up an indentation issue. Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-19scsi: ufs-mediatek: Add UFS support for Mediatek SoC chipsStanley Chu4-0/+435
This patch adds UFS support for MediaTek SoC chips. Signed-off-by: Stanley Chu <[email protected]> Reviewed-by: Avri Altman <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-19scsi: ufs-hisi: Re-factor ufshcd_get_pwr_dev_paramStanley Chu1-105/+4
ufshcd_get_pwr_dev_param function and ufs_dev_params struct have been relocated to ufs core. Switch ufs-hisi to the common interface. Signed-off-by: Stanley Chu <[email protected]> Reviewed-by: Avri Altman <[email protected]> Acked-by: Bean Huo <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-19scsi: ufs-qcom: Re-factor ufshcd_get_pwr_dev_paramStanley Chu1-102/+4
ufshcd_get_pwr_dev_param function and ufs_dev_params struct have been relocated to ufs core. Switch ufs-qcom to the common interface. Signed-off-by: Stanley Chu <[email protected]> Reviewed-by: Avri Altman <[email protected]> Acked-by: Bean Huo <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-19scsi: ufs: Introduce ufshcd_get_pwr_dev_paramStanley Chu2-0/+119
ufshcd_get_pwr_dev_param defines an interface for power mode management currently used by both ufs-qcom and ufs-hisi. Move the interface to ufs core so every driver can take advantage of it. Signed-off-by: Stanley Chu <[email protected]> Reviewed-by: Avri Altman <[email protected]> Acked-by: Bean Huo <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-19scsi: smartpqi: Use HCTX_TYPE_DEFAULT for blk_mq_tag_set->mapDongli Zhang1-1/+1
Use HCTX_TYPE_DEFAULT instead of 0 to avoid hardcoding. Signed-off-by: Dongli Zhang <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-19scsi: qla2xxx: Use HCTX_TYPE_DEFAULT for blk_mq_tag_set->mapDongli Zhang1-1/+1
Use HCTX_TYPE_DEFAULT instead of 0 to avoid hardcoding. Signed-off-by: Dongli Zhang <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-19scsi: virtio_scsi: Use HCTX_TYPE_DEFAULT for blk_mq_tag_set->mapDongli Zhang1-1/+1
Use HCTX_TYPE_DEFAULT instead of 0 to avoid hardcoding. Signed-off-by: Dongli Zhang <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-19scsi: core: Use HCTX_TYPE_DEFAULT for blk_mq_tag_set->mapDongli Zhang1-1/+1
Use HCTX_TYPE_DEFAULT instead of 0 to avoid hardcoding. Signed-off-by: Dongli Zhang <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-19scsi: ufs: fix a missing check of devm_reset_control_getKangjie Lu1-0/+4
devm_reset_control_get could fail, so the fix checks its return value and passes the error code upstream in case it fails. Signed-off-by: Kangjie Lu <[email protected]> Acked-by: Avri Altman <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-19scsi: qla2xxx: Fix NULL pointer crash due to stale CPUIDHimanshu Madhani1-1/+1
This patch fixes crash due to NULL pointer derefrence because CPU pointer is not set and used by driver. Instead, driver is passes CPU as tag via ha->isp_ops->{lun_reset|target_reset} [ 30.160780] qla2xxx [0000:a0:00.1]-8038:9: Cable is unplugged... [ 69.984045] qla2xxx [0000:a0:00.0]-8009:8: DEVICE RESET ISSUED nexus=8:0:0 cmd=00000000b0d62f46. [ 69.992849] BUG: unable to handle kernel NULL pointer dereference at 0000000000000040 [ 70.000680] PGD 0 P4D 0 [ 70.003232] Oops: 0000 [#1] SMP PTI [ 70.006727] CPU: 2 PID: 6714 Comm: sg_reset Kdump: loaded Not tainted 4.18.0-67.el8.x86_64 #1 [ 70.015258] Hardware name: NEC Express5800/T110j [N8100-2758Y]/MX32-PH0-NJ, BIOS F11 02/13/2019 [ 70.024016] RIP: 0010:blk_mq_rq_cpu+0x9/0x10 [ 70.028315] Code: 01 58 01 00 00 48 83 c0 28 48 3d 80 02 00 00 75 ab c3 0f 1f 44 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 8b 47 08 <8b> 40 40 c3 0f 1f 00 0f 1f 44 00 00 48 83 ec 10 48 c7 c6 20 6e 7c [ 70.047087] RSP: 0018:ffff99a481487d58 EFLAGS: 00010246 [ 70.052322] RAX: 0000000000000000 RBX: ffffffffc041b08b RCX: 0000000000000000 [ 70.059466] RDX: 0000000000000000 RSI: ffff8d10b6b16898 RDI: ffff8d10b341e400 [ 70.066615] RBP: ffffffffc03a6bd0 R08: 0000000000000415 R09: 0000000000aaaaaa [ 70.073765] R10: 0000000000000001 R11: 0000000000000001 R12: ffff8d10b341e528 [ 70.080914] R13: ffff8d10aadefc00 R14: ffff8d0f64efa998 R15: ffff8d0f64efa000 [ 70.088083] FS: 00007f90a201e540(0000) GS:ffff8d10b6b00000(0000) knlGS:0000000000000000 [ 70.096188] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 70.101959] CR2: 0000000000000040 CR3: 0000000268886005 CR4: 00000000003606e0 [ 70.109127] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 70.116277] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 70.123425] Call Trace: [ 70.125896] __qla2xxx_eh_generic_reset+0xb1/0x220 [qla2xxx] [ 70.131572] scsi_ioctl_reset+0x1f5/0x2a0 [ 70.135600] scsi_ioctl+0x18e/0x397 [ 70.139099] ? sd_ioctl+0x7c/0x100 [sd_mod] [ 70.143287] blkdev_ioctl+0x32b/0x9f0 [ 70.146954] ? __check_object_size+0xa3/0x181 [ 70.151323] block_ioctl+0x39/0x40 [ 70.154735] do_vfs_ioctl+0xa4/0x630 [ 70.158322] ? syscall_trace_enter+0x1d3/0x2c0 [ 70.162769] ksys_ioctl+0x60/0x90 [ 70.166104] __x64_sys_ioctl+0x16/0x20 [ 70.169859] do_syscall_64+0x5b/0x1b0 [ 70.173532] entry_SYSCALL_64_after_hwframe+0x65/0xca [ 70.178587] RIP: 0033:0x7f90a1b3445b [ 70.182183] Code: 0f 1e fa 48 8b 05 2d aa 2c 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d fd a9 2c 00 f7 d8 64 89 01 48 [ 70.200956] RSP: 002b:00007fffdca88b68 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 [ 70.208535] RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007f90a1b3445b [ 70.215684] RDX: 00007fffdca88b84 RSI: 0000000000002284 RDI: 0000000000000003 [ 70.222833] RBP: 00007fffdca88ca8 R08: 00007fffdca88b84 R09: 0000000000000000 [ 70.229981] R10: 0000000000000000 R11: 0000000000000246 R12: 00007fffdca88b84 [ 70.237131] R13: 0000000000000000 R14: 000055ab09b0bd28 R15: 0000000000000000 [ 70.244284] Modules linked in: nft_chain_route_ipv4 xt_CHECKSUM nft_chain_nat_ipv4 ipt_MASQUERADE nf_nat_ipv4 nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack libcrc32c ipt_REJECT nf_reject_ipv4 nft_counter nft_compat tun bridge stp llc nf_tables nfnetli nk devlink sunrpc vfat fat intel_rapl intel_pmc_core x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm wmi_bmof iTCO_wdt iTCO_ vendor_support irqbypass crct10dif_pclmul crc32_pclmul ghash_clmulni_intel ipmi_ssif intel_cstate intel_uncore intel_rapl_perf ipmi_si jo ydev pcspkr ipmi_devintf sg wmi ipmi_msghandler video acpi_power_meter acpi_pad mei_me i2c_i801 mei ip_tables ext4 mbcache jbd2 sr_mod cd rom sd_mod qla2xxx ast i2c_algo_bit drm_kms_helper nvme_fc syscopyarea sysfillrect uas sysimgblt fb_sys_fops nvme_fabrics ttm [ 70.314805] usb_storage nvme_core crc32c_intel scsi_transport_fc ahci drm libahci tg3 libata megaraid_sas pinctrl_cannonlake pinctrl_ intel [ 70.327335] CR2: 0000000000000040 Fixes: 9cf2bab630765 ("block: kill request ->cpu member") Signed-off-by: Himanshu Madhani <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-19scsi: qla2xxx: Fix FC-AL connection target discoveryQuinn Tran1-0/+7
Commit 7f147f9bfd44 ("scsi: qla2xxx: Fix N2N target discovery with Local loop") fixed N2N target discovery for local loop. However, same code is used for FC-AL discovery as well. Added check to make sure we are bypassing area and domain check only in N2N topology for target discovery. Fixes: 7f147f9bfd44 ("scsi: qla2xxx: Fix N2N target discovery with Local loop") Cc: [email protected] # 5.0+ Signed-off-by: Quinn Tran <[email protected]> Signed-off-by: Himanshu Madhani <[email protected]> Reviewed-by: Ewan D. Milne <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-19scsi: pm8001: clean up various indentation issuesColin Ian King3-28/+28
There are several lines of code where the indentation is at an incorrect level; fix these. Signed-off-by: Colin Ian King <[email protected]> Acked-by: Jack Wang <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-19scsi: core: Avoid that a kernel warning appears during system resumeBart Van Assche1-2/+4
Since scsi_device_quiesce() skips SCSI devices that have another state than RUNNING, OFFLINE or TRANSPORT_OFFLINE, scsi_device_resume() should not complain about SCSI devices that have been skipped. Hence this patch. This patch avoids that the following warning appears during resume: WARNING: CPU: 3 PID: 1039 at blk_clear_pm_only+0x2a/0x30 CPU: 3 PID: 1039 Comm: kworker/u8:49 Not tainted 5.0.0+ #1 Hardware name: LENOVO 4180F42/4180F42, BIOS 83ET75WW (1.45 ) 05/10/2013 Workqueue: events_unbound async_run_entry_fn RIP: 0010:blk_clear_pm_only+0x2a/0x30 Call Trace: ? scsi_device_resume+0x28/0x50 ? scsi_dev_type_resume+0x2b/0x80 ? async_run_entry_fn+0x2c/0xd0 ? process_one_work+0x1f0/0x3f0 ? worker_thread+0x28/0x3c0 ? process_one_work+0x3f0/0x3f0 ? kthread+0x10c/0x130 ? __kthread_create_on_node+0x150/0x150 ? ret_from_fork+0x1f/0x30 Cc: Christoph Hellwig <[email protected]> Cc: Hannes Reinecke <[email protected]> Cc: Ming Lei <[email protected]> Cc: Johannes Thumshirn <[email protected]> Cc: Oleksandr Natalenko <[email protected]> Cc: Martin Steigerwald <[email protected]> Cc: <[email protected]> Reported-by: Jisheng Zhang <[email protected]> Tested-by: Jisheng Zhang <[email protected]> Fixes: 3a0a529971ec ("block, scsi: Make SCSI quiesce and resume work reliably") # v4.15 Signed-off-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-19scsi: NCR5380: Remove set but unused variableFinn Thain1-2/+1
Cc: Michael Schmitz <[email protected]> Signed-off-by: Finn Thain <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-19scsi: NCR5380: Avoid compiler warning when -Wimplicit-fallthrough is enabledFinn Thain1-4/+4
Adjust comments accordingly. Cc: Gustavo A. R. Silva <[email protected]> Cc: Michael Schmitz <[email protected]> Signed-off-by: Finn Thain <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-19scsi: core: Also call destroy_rcu_head() for passthrough requestsBart Van Assche1-1/+8
cmd->rcu is initialized by scsi_initialize_rq(). For passthrough requests, blk_get_request() calls scsi_initialize_rq(). For filesystem requests, scsi_init_command() calls scsi_initialize_rq(). Make sure that destroy_rcu_head() is called for passthrough requests. Cc: Christoph Hellwig <[email protected]> Cc: Hannes Reinecke <[email protected]> Cc: Ewan D. Milne <[email protected]> Cc: Johannes Thumshirn <[email protected]> Reported-by: Ewan D. Milne <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
2019-03-19scsi: core: remove the scsi_ioctl_reset exportChristoph Hellwig1-1/+0
This function is only used inside the SCSI midlayer. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>