platform/kernel/linux-starfive.git
4 years agoscsi: lpfc: Remove unneeded variable 'status' in lpfc_fcp_cpu_map_store()
Ye Bin [Wed, 16 Sep 2020 02:28:59 +0000 (10:28 +0800)]
scsi: lpfc: Remove unneeded variable 'status' in lpfc_fcp_cpu_map_store()

Fixes coccicheck warning:
drivers/scsi/lpfc/lpfc_attr.c:5341:5-11: Unneeded variable: "status". Return "- EINVAL" on line 5342

Link: https://lore.kernel.org/r/20200916022859.349089-1-yebin10@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Ye Bin <yebin10@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: snic: Convert to use DEFINE_SEQ_ATTRIBUTE macro
Liu Shixin [Wed, 16 Sep 2020 02:50:30 +0000 (10:50 +0800)]
scsi: snic: Convert to use DEFINE_SEQ_ATTRIBUTE macro

Use DEFINE_SEQ_ATTRIBUTE macro to simplify the code.

Link: https://lore.kernel.org/r/20200916025030.3992991-1-liushixin2@huawei.com
Signed-off-by: Liu Shixin <liushixin2@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla4xxx: Delete unneeded variable 'status' in qla4xxx_process_ddb_changed
Ye Bin [Wed, 16 Sep 2020 02:27:49 +0000 (10:27 +0800)]
scsi: qla4xxx: Delete unneeded variable 'status' in qla4xxx_process_ddb_changed

Fixes coccicheck warning:
drivers/scsi/qla4xxx/ql4_init.c:1173:5-11: Unneeded variable: "status". Return "QLA_ERROR" on line 1195

Link: https://lore.kernel.org/r/20200916022749.348923-1-yebin10@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Ye Bin <yebin10@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: sun_esp: Use module_platform_driver to simplify the code
Liu Shixin [Mon, 14 Sep 2020 06:54:03 +0000 (14:54 +0800)]
scsi: sun_esp: Use module_platform_driver to simplify the code

Use module_platform_driver() to eliminate boilerplate code.

Link: https://lore.kernel.org/r/20200914065403.3726462-1-liushixin2@huawei.com
Signed-off-by: Liu Shixin <liushixin2@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: sun3x_esp: Use module_platform_driver to simplify the code
Liu Shixin [Mon, 14 Sep 2020 06:54:03 +0000 (14:54 +0800)]
scsi: sun3x_esp: Use module_platform_driver to simplify the code

Use module_platform_driver() to eliminate boilerplate code.

Link: https://lore.kernel.org/r/20200914065403.3726462-1-liushixin2@huawei.com
Signed-off-by: Liu Shixin <liushixin2@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: sni_53c710: Use module_platform_driver to simplify the code
Liu Shixin [Mon, 14 Sep 2020 06:54:03 +0000 (14:54 +0800)]
scsi: sni_53c710: Use module_platform_driver to simplify the code

Use module_platform_driver() to eliminate boilerplate code.

Link: https://lore.kernel.org/r/20200914065403.3726462-1-liushixin2@huawei.com
Signed-off-by: Liu Shixin <liushixin2@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qlogicpti: Use module_platform_driver to simplify the code
Liu Shixin [Mon, 14 Sep 2020 06:54:03 +0000 (14:54 +0800)]
scsi: qlogicpti: Use module_platform_driver to simplify the code

Use module_platform_driver() to eliminate boilerplate code.

Link: https://lore.kernel.org/r/20200914065403.3726462-1-liushixin2@huawei.com
Signed-off-by: Liu Shixin <liushixin2@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: mac_esp: Use module_platform_driver to simplify the code
Liu Shixin [Mon, 14 Sep 2020 06:54:03 +0000 (14:54 +0800)]
scsi: mac_esp: Use module_platform_driver to simplify the code

Use module_platform_driver() to eliminate boilerplate code.

Link: https://lore.kernel.org/r/20200914065403.3726462-1-liushixin2@huawei.com
Signed-off-by: Liu Shixin <liushixin2@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: jazz_esp: Use module_platform_driver to simplify the code
Liu Shixin [Mon, 14 Sep 2020 06:54:03 +0000 (14:54 +0800)]
scsi: jazz_esp: Use module_platform_driver to simplify the code

Use module_platform_driver() to eliminate boilerplate code.

Link: https://lore.kernel.org/r/20200914065403.3726462-1-liushixin2@huawei.com
Signed-off-by: Liu Shixin <liushixin2@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: mvumi: Fix error return in mvumi_io_attach()
Jing Xiangfeng [Thu, 10 Sep 2020 12:38:48 +0000 (20:38 +0800)]
scsi: mvumi: Fix error return in mvumi_io_attach()

Return PTR_ERR() from the error handling case instead of 0.

Link: https://lore.kernel.org/r/20200910123848.93649-1-jingxiangfeng@huawei.com
Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: lpfc: Drop nodelist reference on error in lpfc_gen_req()
Hannes Reinecke [Thu, 10 Sep 2020 08:40:59 +0000 (10:40 +0200)]
scsi: lpfc: Drop nodelist reference on error in lpfc_gen_req()

If we fail to issue the iocb in lpfc_gen_req() we need to drop the nodelist
reference.

Link: https://lore.kernel.org/r/20200910084059.138507-1-hare@suse.de
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: be2iscsi: Fix a theoretical leak in beiscsi_create_eqs()
Dan Carpenter [Mon, 28 Sep 2020 09:13:00 +0000 (12:13 +0300)]
scsi: be2iscsi: Fix a theoretical leak in beiscsi_create_eqs()

The be_fill_queue() function can only fail when "eq_vaddress" is NULL and
since it's non-NULL here that means the function call can't fail.  But
imagine if it could, then in that situation we would want to store the
"paddr" so that dma memory can be released.

Link: https://lore.kernel.org/r/20200928091300.GD377727@mwanda
Fixes: bfead3b2cb46 ("[SCSI] be2iscsi: Adding msix and mcc_rings V3")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: aacraid: Add a missing iounmap call
Tomas Henzl [Sat, 26 Sep 2020 15:00:15 +0000 (17:00 +0200)]
scsi: aacraid: Add a missing iounmap call

Add a missing resource cleanup in _aac_reset_adapter.

Link: https://lore.kernel.org/r/20200926150015.6187-1-thenzl@redhat.com
Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qedi: Add schedule_hw_err_handler callback for fan failure
Manish Rangankar [Thu, 24 Sep 2020 07:03:38 +0000 (00:03 -0700)]
scsi: qedi: Add schedule_hw_err_handler callback for fan failure

On fan failure event from MFW, bring down active connections and unload
the firmware context.

Link: https://lore.kernel.org/r/20200924070338.8270-1-mrangankar@marvell.com
Signed-off-by: Manish Rangankar <mrangankar@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: target: tcmu: Fix warning: 'page' may be used uninitialized
John Donnelly [Thu, 24 Sep 2020 00:19:20 +0000 (17:19 -0700)]
scsi: target: tcmu: Fix warning: 'page' may be used uninitialized

Corrects drivers/target/target_core_user.c:688:6: warning: 'page' may be
used uninitialized.

Link: https://lore.kernel.org/r/20200924001920.43594-1-john.p.donnelly@oracle.com
Fixes: 3c58f737231e ("scsi: target: tcmu: Optimize use of flush_dcache_page")
Cc: Mike Christie <michael.christie@oracle.com>
Acked-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: John Donnelly <john.p.donnelly@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: fnic: Fix inconsistent format argument type in fnic_debugfs.c
Ye Bin [Wed, 30 Sep 2020 02:19:19 +0000 (10:19 +0800)]
scsi: fnic: Fix inconsistent format argument type in fnic_debugfs.c

Fix the following warnings:

[drivers/scsi/fnic/fnic_debugfs.c:123]: (warning) %u in format string (no. 1)
requires 'unsigned int' but the argument type is 'int'.
[drivers/scsi/fnic/fnic_debugfs.c:125]: (warning) %u in format string (no. 1)
requires 'unsigned int' but the argument type is 'int'.
[drivers/scsi/fnic/fnic_debugfs.c:127]: (warning) %u in format string (no. 1)
requires 'unsigned int' but the argument type is 'int'.

Link: https://lore.kernel.org/r/20200930021919.2832860-2-yebin10@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Acked-by: Karan Tilak Kumar <kartilak@cisco.com>
Signed-off-by: Ye Bin <yebin10@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: snic: Remove unnecessary condition
Jing Xiangfeng [Fri, 25 Sep 2020 06:07:54 +0000 (14:07 +0800)]
scsi: snic: Remove unnecessary condition

ret is always zero or error so the assignment is redundant.

Link: https://lore.kernel.org/r/20200925060754.156599-1-jingxiangfeng@huawei.com
Acked-by: Karan Tilak Kumar <kartilak@cisco.com>
Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: fnic: Do not call 'scsi_done()' for unhandled commands
Hannes Reinecke [Fri, 15 May 2020 11:26:47 +0000 (13:26 +0200)]
scsi: fnic: Do not call 'scsi_done()' for unhandled commands

The fnic drivers assigns an ioreq structure to each command and severs this
assignment once scsi_done() has been called and the command has been
completed.

When traversing commands to terminate outstanding I/O we should not call
scsi_done() on commands which do not have a corresponding ioreq structure;
these commands have either never entered the driver or have already been
completed.

[mkp: fixed unused label warning]

Link: https://lore.kernel.org/r/20200515112647.49260-1-hare@suse.de
Reported-by: kbuild test robot <lkp@intel.com>
Reviewed-by: Laurence Oberman <loberman@redhat.com>
Acked-by: Satish Kharat <satishkh@cisco.com>
Acked-by: Karan Tilak Kumar <kartilak@cisco.com>
Signed-off-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: ufs: Fix missing brace warning for old compilers
Pujin Shi [Fri, 2 Oct 2020 06:35:38 +0000 (14:35 +0800)]
scsi: ufs: Fix missing brace warning for old compilers

For older versions of gcc, the array = {0}; will cause warnings:

drivers/scsi/ufs/ufshcd-crypto.c: In function 'ufshcd_crypto_keyslot_program':
drivers/scsi/ufs/ufshcd-crypto.c:62:8: warning: missing braces around initializer [-Wmissing-braces]
  union ufs_crypto_cfg_entry cfg = { 0 };
        ^
drivers/scsi/ufs/ufshcd-crypto.c:62:8: warning: (near initialization for 'cfg.reg_val') [-Wmissing-braces]
drivers/scsi/ufs/ufshcd-crypto.c: In function 'ufshcd_clear_keyslot':
drivers/scsi/ufs/ufshcd-crypto.c:103:8: warning: missing braces around initializer [-Wmissing-braces]
  union ufs_crypto_cfg_entry cfg = { 0 };
        ^
2 warnings generated

Link: https://lore.kernel.org/r/20201002063538.1250-1-shipujin.t@gmail.com
Fixes: 70297a8ac7a7 ("scsi: ufs: UFS crypto API")
Reviewed-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Pujin Shi <shipujin.t@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Fix inconsistent format argument type in qla_dbg.c
Ye Bin [Wed, 30 Sep 2020 02:25:15 +0000 (10:25 +0800)]
scsi: qla2xxx: Fix inconsistent format argument type in qla_dbg.c

Fix the following warning:

[drivers/scsi/qla2xxx/qla_dbg.c:2451]: (warning) %ld in format string (no. 4)
requires 'long' but the argument type is 'unsigned long'.

Link: https://lore.kernel.org/r/20200930022515.2862532-4-yebin10@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Ye Bin <yebin10@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Fix inconsistent format argument type in qla_os.c
Ye Bin [Wed, 30 Sep 2020 02:25:14 +0000 (10:25 +0800)]
scsi: qla2xxx: Fix inconsistent format argument type in qla_os.c

Fix the following warnings:

[drivers/scsi/qla2xxx/qla_os.c:4882]: (warning) %ld in format string (no. 2)
requires 'long' but the argument type is 'unsigned long'.
[drivers/scsi/qla2xxx/qla_os.c:5011]: (warning) %ld in format string (no. 1)
requires 'long' but the argument type is 'unsigned long'.

Link: https://lore.kernel.org/r/20200930022515.2862532-3-yebin10@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Ye Bin <yebin10@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Fix inconsistent format argument type in tcm_qla2xxx.c
Ye Bin [Wed, 30 Sep 2020 02:25:13 +0000 (10:25 +0800)]
scsi: qla2xxx: Fix inconsistent format argument type in tcm_qla2xxx.c

Fix the following warnings:

[drivers/scsi/qla2xxx/tcm_qla2xxx.c:884]: (warning) %u in format string (no. 1)
requires 'unsigned int' but the argument type is 'signed int'.
[drivers/scsi/qla2xxx/tcm_qla2xxx.c:885]: (warning) %u in format string (no. 1)
requires 'unsigned int' but the argument type is 'signed int'.
[drivers/scsi/qla2xxx/tcm_qla2xxx.c:886]: (warning) %u in format string (no. 1)
requires 'unsigned int' but the argument type is 'signed int'.
[drivers/scsi/qla2xxx/tcm_qla2xxx.c:887]: (warning) %u in format string (no. 1)
requires 'unsigned int' but the argument type is 'signed int'.
[drivers/scsi/qla2xxx/tcm_qla2xxx.c:888]: (warning) %u in format string (no. 1)
requires 'unsigned int' but the argument type is 'signed int'.

Link: https://lore.kernel.org/r/20200930022515.2862532-2-yebin10@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Ye Bin <yebin10@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: sd: Allow user to configure command retries
Mike Christie [Thu, 1 Oct 2020 15:35:54 +0000 (10:35 -0500)]
scsi: sd: Allow user to configure command retries

Some iSCSI targets went with the traditional "export N ports" approach and
then allowed the initiator to multipath over them. Other targets went the
opposite direction and export a single port, and then software on the
target side performs load balancing and failover to other targets via an
iSCSI specific feature or IP takover.

The problem for the 2nd type of config is we quickly run out of our five
retries and get I/O errors. In these setups we want to reduce resource use
on the initiator side so we only wanted the one session and no
dm-multipath.  To handle traditional multipath operations like failover we
do IP takover on the target side. So we would have an iSCSI target running
on node1. Some monitoring software decides it's dead or the node is
overloaded so it starts the iSCSI target on node2. The problem is for the
failover case where we might have the equivalent of a dm-multipath
temporary all paths down, or we just have to try more than 5 nodes before
finding a good one.

To handle this type of issue allow the user to configure the disk cmd
retries from -1 to the current max of 5. -1 means infinite retries and
should be used for setups where some other setting is going to control when
to fail. For example iSCSI has the replacement/recovery timeout and fc
(some users have used FC with NPIV and done something similar as IP
takover) has dev_loss_tmo/fast_io_fail which will eventually expire and
fail I/O.

Link: https://lore.kernel.org/r/1601566554-26752-3-git-send-email-michael.christie@oracle.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: core: Add limitless cmd retry support
Mike Christie [Thu, 1 Oct 2020 15:35:53 +0000 (10:35 -0500)]
scsi: core: Add limitless cmd retry support

Add infinite retry support to SCSI midlayer by combining common checks for
retries into some helper functions, and then checking for the
-1/SCSI_CMD_RETRIES_NO_LIMIT.

Link: https://lore.kernel.org/r/1601566554-26752-2-git-send-email-michael.christie@oracle.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: target: core: Add CONTROL field for trace events
Roman Bolshakov [Tue, 29 Sep 2020 12:59:57 +0000 (15:59 +0300)]
scsi: target: core: Add CONTROL field for trace events

trace-cmd report doesn't show events from target subsystem because
scsi_command_size() leaks through event format string:

  [target:target_sequencer_start] function scsi_command_size not defined
  [target:target_cmd_complete] function scsi_command_size not defined

Addition of scsi_command_size() to plugin_scsi.c in trace-cmd doesn't
help because an expression is used inside TP_printk(). trace-cmd event
parser doesn't understand minus sign inside [ ]:

  Error: expected ']' but read '-'

Rather than duplicating kernel code in plugin_scsi.c, provide a dedicated
field for CONTROL byte.

Link: https://lore.kernel.org/r/20200929125957.83069-1-r.bolshakov@yadro.com
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Update version to 10.02.00.103-k
Nilesh Javali [Tue, 29 Sep 2020 10:21:52 +0000 (03:21 -0700)]
scsi: qla2xxx: Update version to 10.02.00.103-k

Link: https://lore.kernel.org/r/20200929102152.32278-8-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Fix point-to-point (N2N) device discovery issue
Arun Easi [Tue, 29 Sep 2020 10:21:51 +0000 (03:21 -0700)]
scsi: qla2xxx: Fix point-to-point (N2N) device discovery issue

Driver was using a shorter timeout waiting for PLOGI from the peer in
point-to-point configurations. Some devices takes some time (~4 seconds) to
initiate the PLOGI. This peer initiating PLOGI is when the peer has a
higher P-WWN.

Increase the wait time based on N2N R_A_TOV.

Link: https://lore.kernel.org/r/20200929102152.32278-7-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.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>
4 years agoscsi: qla2xxx: Fix crash on session cleanup with unload
Quinn Tran [Tue, 29 Sep 2020 10:21:50 +0000 (03:21 -0700)]
scsi: qla2xxx: Fix crash on session cleanup with unload

On unload, session cleanup prematurely gave the signal for driver unload
path to advance.

Link: https://lore.kernel.org/r/20200929102152.32278-6-njavali@marvell.com
Fixes: 726b85487067 ("qla2xxx: Add framework for async fabric discovery")
Cc: stable@vger.kernel.org
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Fix reset of MPI firmware
Arun Easi [Tue, 29 Sep 2020 10:21:49 +0000 (03:21 -0700)]
scsi: qla2xxx: Fix reset of MPI firmware

Normally, the MPI firmware is reset when an MPI dump is collected.  If an
unsaved MPI dump exists in the driver, though, an alternate mechanism is
used. This mechanism, which was not fully correct, is not recommended and
instead an MPI dump template walk is suggested to perform the MPI reset.

To allow for the MPI dump template walk, extra space is reserved in the MPI
dump buffer which gets used only when there is already an MPI dump in
place.

Link: https://lore.kernel.org/r/20200929102152.32278-5-njavali@marvell.com
Fixes: cbb01c2f2f63 ("scsi: qla2xxx: Fix MPI failure AEN (8200) handling")
Cc: stable@vger.kernel.org
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.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>
4 years agoscsi: qla2xxx: Fix MPI reset needed message
Arun Easi [Tue, 29 Sep 2020 10:21:48 +0000 (03:21 -0700)]
scsi: qla2xxx: Fix MPI reset needed message

When printing the message:

  "MPI Heartbeat stop. MPI reset is not needed.."

..the wrong register was checked leading to always printing that MPI reset
is not needed, even when it is needed. Fix the MPI reset message.

Link: https://lore.kernel.org/r/20200929102152.32278-4-njavali@marvell.com
Fixes: cbb01c2f2f63 ("scsi: qla2xxx: Fix MPI failure AEN (8200) handling")
Cc: stable@vger.kernel.org
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.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>
4 years agoscsi: qla2xxx: Fix buffer-buffer credit extraction error
Quinn Tran [Tue, 29 Sep 2020 10:21:47 +0000 (03:21 -0700)]
scsi: qla2xxx: Fix buffer-buffer credit extraction error

Current code uses wrong mailbox option to extract bbc from firmware. This
field is nested inside of PLOGI payload.  Extract bbc from PLOGI template
payload.

Link: https://lore.kernel.org/r/20200929102152.32278-3-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Correct the check for sscanf() return value
Saurav Kashyap [Tue, 29 Sep 2020 10:21:46 +0000 (03:21 -0700)]
scsi: qla2xxx: Correct the check for sscanf() return value

Since the version string has been modified, sscanf() returns 4 instead of
6.

Link: https://lore.kernel.org/r/20200929102152.32278-2-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: ufs: ufs-exynos: Use devm_platform_ioremap_resource_byname()
Bean Huo [Wed, 16 Sep 2020 08:40:17 +0000 (10:40 +0200)]
scsi: ufs: ufs-exynos: Use devm_platform_ioremap_resource_byname()

Use devm_platform_ioremap_resource_byname() to simplify the code.

Link: https://lore.kernel.org/r/20200916084017.14086-1-huobean@gmail.com
Acked-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>
4 years agoscsi: ufs-mediatek: dt-bindings: Add mt8192-ufshci compatible string
Stanley Chu [Mon, 14 Sep 2020 05:00:52 +0000 (13:00 +0800)]
scsi: ufs-mediatek: dt-bindings: Add mt8192-ufshci compatible string

Add "mediatek,mt8192-ufshci" compatible string to for MediaTek UFS host
controller present on MT8192 chipsets.

Link: https://lore.kernel.org/r/20200914050052.3974-3-stanley.chu@mediatek.com
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: ufs-mediatek: Support performance mode for inline encryption engine
Stanley Chu [Mon, 14 Sep 2020 05:00:51 +0000 (13:00 +0800)]
scsi: ufs-mediatek: Support performance mode for inline encryption engine

Some MediaTek UFS platforms support high-performance mode that inline
encryption engine can be boosted while UFS is not clock-gated.

The high-performance mode will be enabled if all below conditions are
well-declaired in device tree,

 - Proper platform-specific compatible string which enables the host
   capability "UFS_MTK_CAP_BOOST_CRYPT_ENGINE".

 - "dvfsrc-vcore" node is available in this platform.

 - Required minimum vcore voltage for high-performance mode.

 - Clock mux and clock parents of inline encryption engine for both
   "low-power mode" and "high-performance mode".

Link: https://lore.kernel.org/r/20200914050052.3974-2-stanley.chu@mediatek.com
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: libsas: Simplify the return expression of sas_discover_* functions
Liu Shixin [Mon, 21 Sep 2020 13:45:58 +0000 (21:45 +0800)]
scsi: libsas: Simplify the return expression of sas_discover_* functions

Simplify the return expression.

Link: https://lore.kernel.org/r/20200921134558.3478922-1-liushixin2@huawei.com
Reviewed-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Liu Shixin <liushixin2@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: oak: Remove redundant initialization of variable ret
Jing Xiangfeng [Fri, 18 Sep 2020 09:07:47 +0000 (17:07 +0800)]
scsi: oak: Remove redundant initialization of variable ret

No point in initializing ret with -ENOMEM.

Link: https://lore.kernel.org/r/20200918090747.44645-1-jingxiangfeng@huawei.com
Acked-by: Finn Thain <fthain@telegraphics.com.au>
Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: bnx2i: Remove unnecessary mutex_init()
Qinglang Miao [Wed, 16 Sep 2020 06:21:33 +0000 (14:21 +0800)]
scsi: bnx2i: Remove unnecessary mutex_init()

The mutex bnx2i_dev_lock is initialized statically. It is unnecessary to
initialize by mutex_init().

Link: https://lore.kernel.org/r/20200916062133.191000-1-miaoqinglang@huawei.com
Acked-by: Manish Rangankar <mrangankar@marvell.com>
Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Update version to 10.02.00.102-k
Nilesh Javali [Fri, 4 Sep 2020 04:51:28 +0000 (21:51 -0700)]
scsi: qla2xxx: Update version to 10.02.00.102-k

Update internal driver version and remove module version macro.

Link: https://lore.kernel.org/r/20200904045128.23631-14-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Add SLER and PI control support
Saurav Kashyap [Fri, 4 Sep 2020 04:51:27 +0000 (21:51 -0700)]
scsi: qla2xxx: Add SLER and PI control support

BIT_13 of extended FW attribute informs about NVMe-2 support.  Set BIT_15
of special feature control block for enabling SLER in FW.  Set bit 8 (SLER
supported) to 1 for the service parameter information when sending NVMe
PRLI request.  Set BIT_14 of special feature control block for enabling PI
Control in FW.  Driver should set bit 9 (PI Control supported) to 1 for the
service parameter information when sending NVMe PRLI request.  Set BIT_13
for NVMe Async events.

Link: https://lore.kernel.org/r/20200904045128.23631-13-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Add IOCB resource tracking
Quinn Tran [Fri, 4 Sep 2020 04:51:26 +0000 (21:51 -0700)]
scsi: qla2xxx: Add IOCB resource tracking

This patch tracks number of IOCB resources used in the I/O fast path. If
the number of used IOCBs reach a high water limit, driver would return the
I/O as busy and let upper layer retry. This prevents over subscription of
IOCB resources where any future error recovery command is unable to cut
through.  Enable IOCB throttling by default.

Link: https://lore.kernel.org/r/20200904045128.23631-12-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Quinn Tran <qutran@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>
4 years agoscsi: qla2xxx: Add rport fields in debugfs
Arun Easi [Fri, 4 Sep 2020 04:51:25 +0000 (21:51 -0700)]
scsi: qla2xxx: Add rport fields in debugfs

This patch adds rport fields in debugfs.

Link: https://lore.kernel.org/r/20200904045128.23631-11-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.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>
4 years agoscsi: qla2xxx: Make tgt_port_database available in initiator mode
Arun Easi [Fri, 4 Sep 2020 04:51:24 +0000 (21:51 -0700)]
scsi: qla2xxx: Make tgt_port_database available in initiator mode

tgt_port_database data is today exported only in target mode, allow it to
be shown in initiator mode as well.

Link: https://lore.kernel.org/r/20200904045128.23631-10-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.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>
4 years agoscsi: qla2xxx: Fix I/O errors during LIP reset tests
Arun Easi [Fri, 4 Sep 2020 04:51:23 +0000 (21:51 -0700)]
scsi: qla2xxx: Fix I/O errors during LIP reset tests

In .fcp_io(), returning ENODEV as soon as remote port delete has started
can cause I/O errors. Fix this by returning EBUSY until the remote port
delete finishes.

Link: https://lore.kernel.org/r/20200904045128.23631-9-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.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>
4 years agoscsi: qla2xxx: Performance tweak
Quinn Tran [Fri, 4 Sep 2020 04:51:22 +0000 (21:51 -0700)]
scsi: qla2xxx: Performance tweak

Move statistics fields from vha struct to qpair to reduce memory thrashing.

Link: https://lore.kernel.org/r/20200904045128.23631-8-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Fix memory size truncation
Quinn Tran [Fri, 4 Sep 2020 04:51:21 +0000 (21:51 -0700)]
scsi: qla2xxx: Fix memory size truncation

Memory size calculations for Extended Login used in hardware offload got
truncated. Fix this by changing definition of exlogin_size to use uint32_t.

Link: https://lore.kernel.org/r/20200904045128.23631-7-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Reduce duplicate code in reporting speed
Quinn Tran [Fri, 4 Sep 2020 04:51:20 +0000 (21:51 -0700)]
scsi: qla2xxx: Reduce duplicate code in reporting speed

Indicate correct speed for 16G Mezz card.

Link: https://lore.kernel.org/r/20200904045128.23631-6-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Honor status qualifier in FCP_RSP per spec
Arun Easi [Fri, 4 Sep 2020 04:51:19 +0000 (21:51 -0700)]
scsi: qla2xxx: Honor status qualifier in FCP_RSP per spec

FCP-4 (referred FCP-4 rev-2b) identifies the earlier known "retry delay
timer" field as "status qualifier", which is described in SAM-5 and later
specs. This fix makes appropriate driver side modifications to honor the
new definition. The SAM document referred was SAM-6 rev-5.

Link: https://lore.kernel.org/r/20200904045128.23631-5-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Allow dev_loss_tmo setting for FC-NVMe devices
Arun Easi [Fri, 4 Sep 2020 04:51:18 +0000 (21:51 -0700)]
scsi: qla2xxx: Allow dev_loss_tmo setting for FC-NVMe devices

Add a remote port debugfs entry to get/set dev_loss_tmo for NVMe devices.

Link: https://lore.kernel.org/r/20200904045128.23631-4-njavali@marvell.com
Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Setup debugfs entries for remote ports
Arun Easi [Fri, 4 Sep 2020 04:51:17 +0000 (21:51 -0700)]
scsi: qla2xxx: Setup debugfs entries for remote ports

Create a base for adding remote port related entries in debugfs.

Link: https://lore.kernel.org/r/20200904045128.23631-3-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Fix I/O failures during remote port toggle testing
Arun Easi [Fri, 4 Sep 2020 04:51:16 +0000 (21:51 -0700)]
scsi: qla2xxx: Fix I/O failures during remote port toggle testing

Driver was using a lower value for dev_loss_tmo making it more prone to I/O
failures during remote port toggle testing. Set dev_loss_tmo to zero during
remote port registration to allow nvme-fc default dev_loss_tmo to be used,
which is higher than what driver was using.

Link: https://lore.kernel.org/r/20200904045128.23631-2-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: ibmvfc: Protect vhost->task_set increment by the host lock
Brian King [Wed, 16 Sep 2020 20:09:59 +0000 (15:09 -0500)]
scsi: ibmvfc: Protect vhost->task_set increment by the host lock

In the discovery thread, ibmvfc does a vhost->task_set++ without any lock
held. This could result in two targets getting the same cancel key, which
could have strange effects in error recovery.  The actual probability of
this occurring should be extremely small, since this should all be done in
a single threaded loop from the discovery thread, but let's fix it up
anyway to be safe.

Link: https://lore.kernel.org/r/1600286999-22059-1-git-send-email-brking@linux.vnet.ibm.com
Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: target: tcmu: Optimize scatter_data_area()
Bodo Stroesser [Thu, 10 Sep 2020 15:50:41 +0000 (17:50 +0200)]
scsi: target: tcmu: Optimize scatter_data_area()

scatter_data_area() has two purposes:

 1) Create the iovs for the data area buffer of a SCSI cmd.

 2) If there is data in DMA_TO_DEVICE direction, copy
    the data from sg_list to data area buffer.

Both are done in a common loop.

In case of DMA_FROM_DEVICE data transfer, scatter_data_area() is called
with parameter copy_data = false. But this flag is just used to skip
memcpy() for data, while radix_tree_lookup still is called for every dbi of
the area area buffer, and kmap and kunmap are called for every page from
sg_list and data_area as well as flush_dcache_page() for the data area
pages.  Since the only thing to do with copy_data = false would be to set
up the iovs, this is a noticeable overhead.  Rework the iov creation in the
main loop of scatter_data_area() providing the new function
new_block_to_iov().  Based on this, create the short new function
tcmu_setup_iovs() that only writes the iovs with no overhead.  This new
function is now called instead of scatter_data_area() for bidi buffers and
for data buffers in those cases where memcpy() would have been skipped.

Link: https://lore.kernel.org/r/20200910155041.17654-4-bstroesser@ts.fujitsu.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>
4 years agoscsi: target: tcmu: Optimize queue_cmd_ring()
Bodo Stroesser [Thu, 10 Sep 2020 15:50:40 +0000 (17:50 +0200)]
scsi: target: tcmu: Optimize queue_cmd_ring()

queue_cmd_ring() needs to check whether there is enough space in cmd ring
and data area for the cmd to queue.

Currently the sequence is:

 1) Calculate size the cmd will occupy on the ring based on estimation of
    needed iovs.

 2) Check whether there is enough space on the ring based on size from 1)

 3) Allocate buffers in data area.

 4) Calculate number of iovs the command really needs while copying
    incoming data (if any) to data area.

 5) Re-calculate real size of cmd on ring based on real number of iovs.

 6) Set up possible padding and cmd on the ring.

Step 1) must not underestimate the cmd size so use max possible number of
iovs for the given I/O data size. The resulting overestimation can be
really high so this sequence is not ideal. The earliest the real number of
iovs can be calculated is after data buffer allocation. Therefore rework
the code to implement the following sequence:

 A) Allocate buffers on data area and calculate number of necessary iovs
    during this.

 B) Calculate real size of cmd on ring based on number of iovs.

 C) Check whether there is enough space on the ring.

 D) Set up possible padding and cmd on the ring.

The new sequence enforces the split of new function tcmu_alloc_data_space()
from is_ring_space_avail(). Using this function, change queue_cmd_ring()
according to the new sequence.

Change routines called by tcmu_alloc_data_space() to allow calculating and
returning the iov count. Remove counting of iovs in scatter_data_area().

Link: https://lore.kernel.org/r/20200910155041.17654-3-bstroesser@ts.fujitsu.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>
4 years agoscsi: target: tcmu: Join tcmu_cmd_get_data_length() and tcmu_cmd_get_block_cnt()
Bodo Stroesser [Thu, 10 Sep 2020 15:50:39 +0000 (17:50 +0200)]
scsi: target: tcmu: Join tcmu_cmd_get_data_length() and tcmu_cmd_get_block_cnt()

Simplify code by joining tcmu_cmd_get_data_length() and
tcmu_cmd_get_block_cnt() into tcmu_cmd_set_block_cnts().  The new function
sets tcmu_cmd->dbi_cnt and also the new field tcmu_cmd->dbi_bidi_cnt which
is needed for further enhancements in following patches.  Simplify some
code by using tcmu_cmd->dbi(_bidi)_cnt instead of calculation from length.

Please note: The calculation of the number of dbis needed for bidi was
wrong. It was based on the length of the first bidi sg only. I changed it
to correctly sum up entire length of all bidi sgs.

Link: https://lore.kernel.org/r/20200910155041.17654-2-bstroesser@ts.fujitsu.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>
4 years agoscsi: core: Only re-run queue in scsi_end_request() if device queue is busy
Ming Lei [Thu, 10 Sep 2020 07:50:56 +0000 (15:50 +0800)]
scsi: core: Only re-run queue in scsi_end_request() if device queue is busy

The request queue is currently run unconditionally in scsi_end_request() if
both target queue and host queue are ready.

Recently Long Li reported that cost of a queue run can be very heavy in
case of high queue depth. Improve this situation by only running the
request queue when this LUN is busy.

Link: https://lore.kernel.org/r/20200910075056.36509-1-ming.lei@redhat.com
Reported-by: Long Li <longli@microsoft.com>
Tested-by: Long Li <longli@microsoft.com>
Tested-by: Kashyap Desai <kashyap.desai@broadcom.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Reviewed-by: John Garry <john.garry@huawei.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: aic7xxx: Use kmemdup() in two places
Alex Dewar [Wed, 9 Sep 2020 18:58:55 +0000 (19:58 +0100)]
scsi: aic7xxx: Use kmemdup() in two places

kmemdup() can be used instead of kmalloc()+memcpy(). Replace two
occurrences of this pattern.

Issue identified with Coccinelle.

Link: https://lore.kernel.org/r/20200909185855.151964-1-alex.dewar90@gmail.com
Signed-off-by: Alex Dewar <alex.dewar90@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: virtio_scsi: Rescan the entire target on transport reset when LUN is 0
Matej Genci [Fri, 28 Aug 2020 12:21:35 +0000 (12:21 +0000)]
scsi: virtio_scsi: Rescan the entire target on transport reset when LUN is 0

VirtIO 1.0 spec says:

    The removed and rescan events ... when sent for LUN 0, they MAY
    apply to the entire target so the driver can ask the initiator
    to rescan the target to detect this.

This change introduces the behaviour described above by scanning the entire
SCSI target when LUN is set to 0. This is both a functional and a
performance fix. It aligns the driver with the spec and allows control
planes to hotplug targets with large numbers of LUNs without having to
request a RESCAN for each one of them.

Link: https://lore.kernel.org/r/CY4PR02MB33354370E0A81E75DD9DFE74FB520@CY4PR02MB3335.namprd02.prod.outlook.com
Suggested-by: Felipe Franciosi <felipe@nutanix.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Matej Genci <matej.genci@nutanix.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: myrb: Make some symblos static
Jason Yan [Tue, 15 Sep 2020 08:40:18 +0000 (16:40 +0800)]
scsi: myrb: Make some symblos static

This addresses the following sparse warning:

drivers/scsi/myrb.c:2229:27: warning: symbol 'myrb_template' was not
declared. Should it be static?
drivers/scsi/myrb.c:2318:31: warning: symbol 'myrb_raid_functions' was
not declared. Should it be static?
drivers/scsi/myrb.c:2492:6: warning: symbol 'myrb_err_status' was not
declared. Should it be static?

Link: https://lore.kernel.org/r/20200915084018.2826922-1-yanaijie@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: myrs: Make some symbols static
Jason Yan [Tue, 15 Sep 2020 08:40:08 +0000 (16:40 +0800)]
scsi: myrs: Make some symbols static

This addresses the following sparse warning:

drivers/scsi/myrs.c:1532:5: warning: symbol 'myrs_host_reset' was not
declared. Should it be static?
drivers/scsi/myrs.c:1922:27: warning: symbol 'myrs_template' was not
declared. Should it be static?
drivers/scsi/myrs.c:2036:31: warning: symbol 'myrs_raid_functions' was
not declared. Should it be static?
drivers/scsi/myrs.c:2046:6: warning: symbol 'myrs_flush_cache' was not
declared. Should it be static?

Link: https://lore.kernel.org/r/20200915084008.2826835-1-yanaijie@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: isci: Make scu_link_layer_set_txcomsas_timeout() static
Jason Yan [Tue, 15 Sep 2020 08:40:00 +0000 (16:40 +0800)]
scsi: isci: Make scu_link_layer_set_txcomsas_timeout() static

This addresses the following sparse warning:

drivers/scsi/isci/phy.c:672:6: warning: symbol
'scu_link_layer_set_txcomsas_timeout' was not declared. Should it be
static?

Link: https://lore.kernel.org/r/20200915084000.2826741-1-yanaijie@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: bnx2fc: Make a bunch of symbols static in bnx2fc_fcoe.c
Jason Yan [Sat, 12 Sep 2020 03:37:58 +0000 (11:37 +0800)]
scsi: bnx2fc: Make a bunch of symbols static in bnx2fc_fcoe.c

This eliminates the following sparse warning:

drivers/scsi/bnx2fc/bnx2fc_fcoe.c:53:1: warning: symbol
'bnx2fc_global_lock' was not declared. Should it be static?
drivers/scsi/bnx2fc/bnx2fc_fcoe.c:111:6: warning: symbol
'bnx2fc_devloss_tmo' was not declared. Should it be static?
drivers/scsi/bnx2fc/bnx2fc_fcoe.c:116:6: warning: symbol
'bnx2fc_max_luns' was not declared. Should it be static?
drivers/scsi/bnx2fc/bnx2fc_fcoe.c:121:6: warning: symbol
'bnx2fc_queue_depth' was not declared. Should it be static?
drivers/scsi/bnx2fc/bnx2fc_fcoe.c:126:6: warning: symbol
'bnx2fc_log_fka' was not declared. Should it be static?

Link: https://lore.kernel.org/r/20200912033758.142601-1-yanaijie@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: isci: Make isci_host_attrs static
Jason Yan [Sat, 12 Sep 2020 03:37:41 +0000 (11:37 +0800)]
scsi: isci: Make isci_host_attrs static

This eliminates the following sparse warning:

drivers/scsi/isci/init.c:145:25: warning: symbol 'isci_host_attrs' was
not declared. Should it be static?

Link: https://lore.kernel.org/r/20200912033741.142415-1-yanaijie@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: aacraid: Make some symbols static in aachba.c
Jason Yan [Sat, 12 Sep 2020 03:37:49 +0000 (11:37 +0800)]
scsi: aacraid: Make some symbols static in aachba.c

This eliminates the following sparse warning:

drivers/scsi/aacraid/aachba.c:245:5: warning: symbol 'aac_convert_sgl'
was not declared. Should it be static?
drivers/scsi/aacraid/aachba.c:293:5: warning: symbol 'acbsize' was not
declared. Should it be static?
drivers/scsi/aacraid/aachba.c:324:5: warning: symbol 'aac_wwn' was not
declared. Should it be static?

Link: https://lore.kernel.org/r/20200912033749.142488-1-yanaijie@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: sym53c8xx_2: Delete unnecessary else-if in sym_xerr_cam_status()
Ye Bin [Wed, 2 Sep 2020 06:16:46 +0000 (14:16 +0800)]
scsi: sym53c8xx_2: Delete unnecessary else-if in sym_xerr_cam_status()

If (x_status & XE_PARITY_ERR) is true we set cam_status = DID_PARITY,
othervise cam_status always ends up being DID_ERROR. Delete superfluous
else-if statements.

Link: https://lore.kernel.org/r/20200902061646.576966-1-yebin10@huawei.com
Signed-off-by: Ye Bin <yebin10@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: ibmvfc: Avoid link down on FS9100 canister reboot
Brian King [Fri, 11 Sep 2020 21:28:26 +0000 (16:28 -0500)]
scsi: ibmvfc: Avoid link down on FS9100 canister reboot

When a canister on a FS9100, or similar storage, running in NPIV mode, is
rebooted, its WWPNs will fail over to another canister. When this occurs,
we see a WWPN going away from the fabric at one N-Port ID, and, a short
time later, the same WWPN appears at a different N-Port ID.  When the
canister is fully operational again, the WWPNs fail back to the original
canister. If there is any I/O outstanding to the target when this occurs,
it will result in the implicit logout the ibmvfc driver issues before
removing the rport to fail. When the WWPN then shows up at a different
N-Port ID, and we issue a PLOGI to it, the VIOS will see that it still has
a login for this WWPN at the old N-Port ID, which results in the VIOS
simulating a link down / link up sequence to the client, in order to get
the VIOS and client LPAR in sync.

The patch below improves the way we handle this scenario so as to avoid the
link bounce, which affects all targets under the virtual host adapter. The
change is to utilize the Move Login MAD, which will work even when I/O is
outstanding to the target. The change only alters the target state machine
for the case where the implicit logout fails prior to deleting the rport.
If this implicit logout fails, we defer deleting the ibmvfc_target object
after calling fc_remote_port_delete. This enables us to later retry the
implicit logout after terminate_rport_io occurs, or to issue the Move Login
request if a WWPN shows up at a new N-Port ID prior to this occurring.

This has been tested by IBM's storage interoperability team on a FS9100,
forcing the failover to occur. With debug tracing enabled in the ibmvfc
driver, we confirmed the move login was sent in this scenario and confirmed
the link bounce no longer occurred.

[mkp: fix checkpatch warnings]

Link: https://lore.kernel.org/r/1599859706-8505-1-git-send-email-brking@linux.vnet.ibm.com
Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: core: Update additional sense codes list
Damien Le Moal [Thu, 10 Sep 2020 07:48:42 +0000 (16:48 +0900)]
scsi: core: Update additional sense codes list

Add missing Additional Sense Codes listed in
http://www.t10.org/lists/asc-num.txt.

Link: https://lore.kernel.org/r/20200910074843.217661-3-damien.lemoal@wdc.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: core: Clean up scsi_noretry_cmd()
Damien Le Moal [Thu, 10 Sep 2020 07:48:41 +0000 (16:48 +0900)]
scsi: core: Clean up scsi_noretry_cmd()

No need for else after return.

Link: https://lore.kernel.org/r/20200910074843.217661-2-damien.lemoal@wdc.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: target: tcmu: Add missing newline when printing parameters
Xiongfeng Wang [Thu, 3 Sep 2020 11:29:33 +0000 (19:29 +0800)]
scsi: target: tcmu: Add missing newline when printing parameters

The tcmu 'global_max_data_area_mb' parameter in sysfs is missing a
newline. Add it.

Link: https://lore.kernel.org/r/1599132573-33818-1-git-send-email-wangxiongfeng2@huawei.com
Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: ufs: Fix NOP OUT timeout value
Daejun Park [Wed, 2 Sep 2020 02:58:52 +0000 (11:58 +0900)]
scsi: ufs: Fix NOP OUT timeout value

Boot occasionally fails with some Samsung low-power UFS devices. The reason
is that these devices have a little bit higher latency for NOP OUT
responses. This causes boot to fail because the NOP OUT command is issued
during initialization to check whether the device transport protocol is
ready or not. Increase NOP_OUT_TIMEOUT value from 30 to 50ms.

Link: https://lore.kernel.org/r/231786897.01599016081767.JavaMail.epsvc@epcpadp2
Acked-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Daejun Park <daejun7.park@samsung.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: mpt3sas: A small correction in _base_process_reply_queue
Tomas Henzl [Fri, 11 Sep 2020 18:00:57 +0000 (20:00 +0200)]
scsi: mpt3sas: A small correction in _base_process_reply_queue

There is no need to compute modulo. A simple comparison is good enough.

Link: https://lore.kernel.org/r/20200911180057.14633-1-thenzl@redhat.com
Acked-by: sreekanth reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: mpt3sas: Fix sync irqs
Tomas Henzl [Thu, 10 Sep 2020 14:21:26 +0000 (16:21 +0200)]
scsi: mpt3sas: Fix sync irqs

_base_process_reply_queue() called from _base_interrupt() may schedule a
new irq poll. Fix this by calling synchronize_irq() first.

Also ensure that enable_irq() is called only when necessary to avoid
"Unbalanced enable for IRQ..." errors.

Link: https://lore.kernel.org/r/20200910142126.8147-1-thenzl@redhat.com
Fixes: 320e77acb327 ("scsi: mpt3sas: Irq poll to avoid CPU hard lockups")
Acked-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: mpt3sas: Detect tampered Aero and Sea adapters
Sreekanth Reddy [Fri, 14 Aug 2020 13:04:26 +0000 (13:04 +0000)]
scsi: mpt3sas: Detect tampered Aero and Sea adapters

The driver will throw an error message when a tampered type controller
is detected. The intent is to avoid interacting with any firmware
which is not secured/signed by Broadcom. Any tampering on firmware
component will be detected by hardware and it will be communicated to
the driver to avoid any further interaction with that component.

[mkp: switched back to dev_err]

Link: https://lore.kernel.org/r/20200814130426.2741171-1-sreekanth.reddy@broadcom.com
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: megaraid: Make smp_affinity_enable static
Jason Yan [Tue, 15 Sep 2020 08:39:48 +0000 (16:39 +0800)]
scsi: megaraid: Make smp_affinity_enable static

This addresses the following sparse warning:

drivers/scsi/megaraid/megaraid_sas_base.c:80:5: warning: symbol
'smp_affinity_enable' was not declared. Should it be static?

Link: https://lore.kernel.org/r/20200915083948.2826598-1-yanaijie@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: target: Remove redundant assignment to variable 'ret'
Jing Xiangfeng [Mon, 14 Sep 2020 02:32:07 +0000 (10:32 +0800)]
scsi: target: Remove redundant assignment to variable 'ret'

The variable ret has been initialized with a value '0'. The assignment in
switch-case is redundant. Remove it.

Link: https://lore.kernel.org/r/20200914023207.113792-1-jingxiangfeng@huawei.com
Reviewed-by: Maurizio Lombardi <mlombard@redhat.com>
Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: zfcp: Clarify access to erp_action in zfcp_fsf_req_complete()
Julian Wiedmann [Thu, 10 Sep 2020 19:49:16 +0000 (21:49 +0200)]
scsi: zfcp: Clarify access to erp_action in zfcp_fsf_req_complete()

While reviewing commit 936e6b85da04 ("scsi: zfcp: Fix panic on ERP timeout
for previously dismissed ERP action"), I stumbled over
zfcp_fsf_req_complete() and wondered whether it has similar issues wrt
concurrent modification of req->erp_action by
zfcp_erp_strategy_check_fsfreq().

But a closer look shows that both its two callers [zfcp_fsf_reqid_check(),
zfcp_fsf_req_dismiss_all()] remove the request from the adapter's req_list
under the req_list's lock.  Hence we can trust that if
zfcp_erp_strategy_check_fsfreq() concurrently looks up the corresponding
req_id, it won't find this request and is thus unable to modify it while
it's being processed by zfcp_fsf_req_complete().

Add a code comment that hopefully makes this easier for future readers, and
condense the two accesses to ->erp_action that made me trip over this code
path in the first place.

Link: https://lore.kernel.org/r/c500eac301fcbba5af942bbd200f2d6b14e46994.1599765652.git.bblock@linux.ibm.com
Reviewed-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: zfcp: Use list_first_entry_or_null() in zfcp_erp_thread()
Julian Wiedmann [Thu, 10 Sep 2020 19:49:15 +0000 (21:49 +0200)]
scsi: zfcp: Use list_first_entry_or_null() in zfcp_erp_thread()

Use the right helper to avoid poking around in the list's internals.

Link: https://lore.kernel.org/r/ed669555c73aab95b29444c10066f492c0c43391.1599765652.git.bblock@linux.ibm.com
Reviewed-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: aic94xx: Remove unused inline function
YueHaibing [Wed, 9 Sep 2020 13:57:11 +0000 (21:57 +0800)]
scsi: aic94xx: Remove unused inline function

There is no caller in tree. Remove it.

Link: https://lore.kernel.org/r/20200909135711.35728-1-yuehaibing@huawei.com
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: libfc: Fix passing zero to 'PTR_ERR' warning
YueHaibing [Wed, 9 Sep 2020 13:54:32 +0000 (21:54 +0800)]
scsi: libfc: Fix passing zero to 'PTR_ERR' warning

drivers/scsi/libfc/fc_disc.c:304
 fc_disc_error() warn: passing zero to 'PTR_ERR'

fp may be NULL in fc_disc_error(), use PTR_ERR_OR_ZERO to handle this.

Link: https://lore.kernel.org/r/20200909135432.36772-1-yuehaibing@huawei.com
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: fnic: Remove unneeded semicolon
Jason Yan [Fri, 11 Sep 2020 09:10:57 +0000 (17:10 +0800)]
scsi: fnic: Remove unneeded semicolon

This addresses the following coccinelle warning:

drivers/scsi/fnic/fnic_main.c:446:2-3: Unneeded semicolon

Link: https://lore.kernel.org/r/20200911091057.2938685-1-yanaijie@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: nsp32: Remove unneeded semicolon
Jason Yan [Fri, 11 Sep 2020 09:10:49 +0000 (17:10 +0800)]
scsi: nsp32: Remove unneeded semicolon

This addresses the following coccinelle warning:

drivers/scsi/nsp32.c:1250:4-5: Unneeded semicolon
drivers/scsi/nsp32.c:1842:2-3: Unneeded semicolon

Link: https://lore.kernel.org/r/20200911091049.2938158-1-yanaijie@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: sym53c8xx_2: Remove unneeded semicolon
Jason Yan [Fri, 11 Sep 2020 09:10:31 +0000 (17:10 +0800)]
scsi: sym53c8xx_2: Remove unneeded semicolon

This addresses the following coccinelle warning:

drivers/scsi/sym53c8xx_2/sym_fw.c:372:3-4: Unneeded semicolon
drivers/scsi/sym53c8xx_2/sym_fw.c:480:3-4: Unneeded semicolon
drivers/scsi/sym53c8xx_2/sym_fw.c:536:2-3: Unneeded semicolon

Link: https://lore.kernel.org/r/20200911091031.2937834-1-yanaijie@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Remove unneeded variable 'rval'
Jason Yan [Fri, 11 Sep 2020 09:10:21 +0000 (17:10 +0800)]
scsi: qla2xxx: Remove unneeded variable 'rval'

This addresses the following coccinelle warning:

drivers/scsi/qla2xxx/qla_init.c:7112:5-9: Unneeded variable: "rval".
Return "QLA_SUCCESS" on line 7115

Link: https://lore.kernel.org/r/20200911091021.2937708-1-yanaijie@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: ufs-pci: Add LTR support for Intel controllers
Adrian Hunter [Thu, 27 Aug 2020 07:20:30 +0000 (10:20 +0300)]
scsi: ufs-pci: Add LTR support for Intel controllers

Intel host controllers support the setting of latency tolerance.
Accordingly, implement the PM QoS ->set_latency_tolerance() callback. The
raw register values are also exposed via debugfs.

Link: https://lore.kernel.org/r/20200827072030.24655-1-adrian.hunter@intel.com
Fixes: 8c09d7527697 ("scsi: ufshdc-pci: Add Intel PCI IDs for EHL")
Fixes: 1ab27c9cf8b6 ("ufs: Add support for clock gating")
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Acked-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoMerge branch '5.9/scsi-fixes' into 5.10/scsi-ufs
Martin K. Petersen [Tue, 15 Sep 2020 15:24:32 +0000 (11:24 -0400)]
Merge branch '5.9/scsi-fixes' into 5.10/scsi-ufs

Resolve UFS discrepancies between fixes and queue.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: lpfc: Remove set but not used 'qp'
Ye Bin [Wed, 9 Sep 2020 08:27:16 +0000 (16:27 +0800)]
scsi: lpfc: Remove set but not used 'qp'

This addresses the following gcc warning with "make W=1":

not used [-Wunused-but-set-variable]
  struct lpfc_sli4_hdw_queue *qp;
                                ^

Link: https://lore.kernel.org/r/20200909082716.37787-1-yebin10@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Ye Bin <yebin10@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc_debugfs.c: In function ‘lpfc_debugfs_hdwqstat_data’:
drivers/scsi/lpfc/lpfc_debugfs.c:1699:30: warning: variable ‘qp’ set but

4 years agoscsi: gdth: Remove set but used 'cmd_index'
Ye Bin [Wed, 9 Sep 2020 08:26:26 +0000 (16:26 +0800)]
scsi: gdth: Remove set but used 'cmd_index'

This addresses the following gcc warning with "make W=1":

drivers/scsi/gdth.c: In function ‘gdth_async_event’:
drivers/scsi/gdth.c:3010:9: warning: variable ‘cmd_index’ set but not
used [-Wunused-but-set-variable]
     int cmd_index;

Link: https://lore.kernel.org/r/20200909082627.101984-1-yebin10@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Ye Bin <yebin10@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: pmcraid: Remove set but not used 'res'
Ye Bin [Wed, 9 Sep 2020 08:26:27 +0000 (16:26 +0800)]
scsi: pmcraid: Remove set but not used 'res'

This addresses the following gcc warning with "make W=1":

 drivers/scsi/pmcraid.c: In function ‘pmcraid_abort_cmd’:
 drivers/scsi/pmcraid.c:2863:33: warning: variable ‘res’ set but not
 used [-Wunused-but-set-variable]
   struct pmcraid_resource_entry *res;
                                    ^

Link: https://lore.kernel.org/r/20200909082627.101984-2-yebin10@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Ye Bin <yebin10@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla1280: Remove set but not used variable in qla1280_status_entry()
Jason Yan [Mon, 7 Sep 2020 07:45:18 +0000 (15:45 +0800)]
scsi: qla1280: Remove set but not used variable in qla1280_status_entry()

This addresses the following gcc warning with "make W=1":

drivers/scsi/qla1280.c: In function ‘qla1280_status_entry’:
drivers/scsi/qla1280.c:3607:28: warning: variable ‘lun’ set but not used
[-Wunused-but-set-variable]
 3607 |  unsigned int bus, target, lun;
      |                            ^~~
drivers/scsi/qla1280.c:3607:20: warning: variable ‘target’ set but not
used [-Wunused-but-set-variable]
 3607 |  unsigned int bus, target, lun;
      |                    ^~~~~~
drivers/scsi/qla1280.c:3607:15: warning: variable ‘bus’ set but not used
[-Wunused-but-set-variable]
 3607 |  unsigned int bus, target, lun;
      |               ^~~

Link: https://lore.kernel.org/r/20200907074518.2326360-5-yanaijie@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla1280: Remove set but not used variable in qla1280_mailbox_command()
Jason Yan [Mon, 7 Sep 2020 07:45:17 +0000 (15:45 +0800)]
scsi: qla1280: Remove set but not used variable in qla1280_mailbox_command()

This addresses the following gcc warning with "make W=1":

drivers/scsi/qla1280.c: In function ‘qla1280_mailbox_command’:
drivers/scsi/qla1280.c:2430:11: warning: variable ‘data’ set but not
used [-Wunused-but-set-variable]
 2430 |  uint16_t data;
      |           ^~~~

Link: https://lore.kernel.org/r/20200907074518.2326360-4-yanaijie@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla1280: Remove set but not used variable in qla1280_nvram_config()
Jason Yan [Mon, 7 Sep 2020 07:45:16 +0000 (15:45 +0800)]
scsi: qla1280: Remove set but not used variable in qla1280_nvram_config()

This addresses the following gcc warning with "make W=1":

drivers/scsi/qla1280.c: In function ‘qla1280_nvram_config’:
drivers/scsi/qla1280.c:2188:36: warning: variable ‘ddma_conf’ set but
not used [-Wunused-but-set-variable]
 2188 |   uint16_t hwrev, cfg1, cdma_conf, ddma_conf;
      |                                    ^~~~~~~~~

Link: https://lore.kernel.org/r/20200907074518.2326360-3-yanaijie@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla1280: Remove set but not used variable in qla1280_done()
Jason Yan [Mon, 7 Sep 2020 07:45:15 +0000 (15:45 +0800)]
scsi: qla1280: Remove set but not used variable in qla1280_done()

This addresses the following gcc warning with "make W=1":

drivers/scsi/qla1280.c: In function ‘qla1280_done’:
drivers/scsi/qla1280.c:1244:19: warning: variable ‘lun’ set but not used
[-Wunused-but-set-variable]
 1244 |  int bus, target, lun;
      |                   ^~~

Link: https://lore.kernel.org/r/20200907074518.2326360-2-yanaijie@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: ufs: Fix 'unmet direct dependencies' config warning
Alim Akhtar [Tue, 21 Jul 2020 17:20:21 +0000 (22:50 +0530)]
scsi: ufs: Fix 'unmet direct dependencies' config warning

With !CONFIG_OF and SCSI_UFS_EXYNOS selected, the below warning is given:

WARNING: unmet direct dependencies detected for PHY_SAMSUNG_UFS
  Depends on [n]: OF [=n] && (ARCH_EXYNOS || COMPILE_TEST [=y])
  Selected by [y]:
  - SCSI_UFS_EXYNOS [=y] && SCSI_LOWLEVEL [=y] && SCSI [=y] && SCSI_UFSHCD_PLATFORM [=y] && (ARCH_EXYNOS || COMPILE_TEST [=y])

Fix it by removing PHY_SAMSUNG_UFS dependency.

Link: https://lore.kernel.org/r/20200721172021.28922-1-alim.akhtar@samsung.com
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: ibmvfc: Fix error return in ibmvfc_probe()
Jing Xiangfeng [Mon, 7 Sep 2020 08:39:49 +0000 (16:39 +0800)]
scsi: ibmvfc: Fix error return in ibmvfc_probe()

Fix to return error code PTR_ERR() from the error handling case instead of
0.

Link: https://lore.kernel.org/r/20200907083949.154251-1-jingxiangfeng@huawei.com
Acked-by: Tyrel Datwyler <tyreld@linux.ibm.com>
Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: ufs: ufs-mediatek: Fix build warnings with make W=1
Stanley Chu [Thu, 10 Sep 2020 01:37:56 +0000 (09:37 +0800)]
scsi: ufs: ufs-mediatek: Fix build warnings with make W=1

Fix build warnings with make W=1 as below,

1.
>> drivers/scsi/ufs/ufs-mediatek.c:116:22: warning: format '%d' expects
>> argument of type 'int', but argument 4 has type 'long int'

2.
  CC [M]  drivers/scsi/ufs/ufs-mediatek.o
../drivers/scsi/ufs/ufs-mediatek.c:749: error: Cannot parse struct or union!

/** is used specifically with kernel-doc tool.
As a quick fix by removing dubious /** in the comment block of
struct ufs_hba_variant_ops ufs_hba_mtk_vops.

Link: https://lore.kernel.org/r/20200910013756.11385-1-stanley.chu@mediatek.com
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Handle incorrect entry_type entries
Daniel Wagner [Tue, 8 Sep 2020 08:15:16 +0000 (10:15 +0200)]
scsi: qla2xxx: Handle incorrect entry_type entries

It was observed on an ISP8324 16Gb HBA with fw=8.08.203 (d0d5) in a
PowerPC64 machine that pkt->entry_type was MBX_IOCB_TYPE/0x39 with an
sp->type SRB_SCSI_CMD which is invalid and should not be possible.

Reading the entry_type from the crash dump shows the expected value of
STATUS_TYPE/0x03 but the call trace shows that qla24xx_mbx_iocb_entry() is
used.

Add a check to verify for consistency and reset the HBA if an invalid state
is reached. Obviously, this is only a workaround until the real problem is
solved.

Link: https://lore.kernel.org/r/20200908081516.8561-5-dwagner@suse.de
Reviewed-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Log calling function name in qla2x00_get_sp_from_handle()
Daniel Wagner [Tue, 8 Sep 2020 08:15:15 +0000 (10:15 +0200)]
scsi: qla2xxx: Log calling function name in qla2x00_get_sp_from_handle()

Commit 7c3df1320e5e ("[SCSI] qla2xxx: Code changes to support new dynamic
logging infrastructure.") removed the use of the func argument. Let's add
it back.

Link: https://lore.kernel.org/r/20200908081516.8561-4-dwagner@suse.de
Reviewed-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Simplify return value logic in qla2x00_get_sp_from_handle()
Daniel Wagner [Tue, 8 Sep 2020 08:15:14 +0000 (10:15 +0200)]
scsi: qla2xxx: Simplify return value logic in qla2x00_get_sp_from_handle()

Refactor qla2x00_get_sp_from_handle() to avoid the unnecessary goto if
early returns are used. With this we can also avoid preinitialzing the sp
pointer.

Link: https://lore.kernel.org/r/20200908081516.8561-3-dwagner@suse.de
Reviewed-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: qla2xxx: Warn if done() or free() are called on an already freed srb
Daniel Wagner [Tue, 8 Sep 2020 08:15:13 +0000 (10:15 +0200)]
scsi: qla2xxx: Warn if done() or free() are called on an already freed srb

Emit a warning when ->done or ->free are called on an already freed
srb. There is a hidden use-after-free bug in the driver which corrupts
the srb memory pool which originates from the cleanup callbacks.

An extensive search didn't bring any lights on the real problem. The
initial fix was to set both pointers to NULL and try to catch invalid
accesses. But instead the memory corruption was gone and the driver
didn't crash. Since not all calling places check for NULL pointer, add
explicitly default handlers. With this we workaround the memory
corruption and add a debug help.

Link: https://lore.kernel.org/r/20200908081516.8561-2-dwagner@suse.de
Reviewed-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
4 years agoscsi: libsas: Fix error path in sas_notify_lldd_dev_found()
Dan Carpenter [Sat, 5 Sep 2020 12:58:36 +0000 (15:58 +0300)]
scsi: libsas: Fix error path in sas_notify_lldd_dev_found()

In sas_notify_lldd_dev_found(), if we can't allocate the necessary
resources, then it seems like the wrong thing to mark the device as found
and to increment the reference count.  None of the callers ever drop the
reference in that situation.

[mkp: tweaked commit desc based on feedback from John]

Link: https://lore.kernel.org/r/20200905125836.GF183976@mwanda
Fixes: 735f7d2fedf5 ("[SCSI] libsas: fix domain_device leak")
Reviewed-by: Jason Yan <yanaijie@huawei.com>
Acked-by: John Garry <john.garry@huawei.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>