linux-2.6-block.git
5 years agoscsi: lpfc: Fix build error
James Bottomley [Thu, 21 Mar 2019 00:02:04 +0000 (20:02 -0400)]
scsi: lpfc: Fix build error

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 <James.Bottomley@HansenPartnership.com>
Acked-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: mvumi: Stop using plain integer as NULL pointer
YueHaibing [Sat, 16 Feb 2019 10:01:30 +0000 (18:01 +0800)]
scsi: mvumi: Stop using plain integer as NULL pointer

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 <yuehaibing@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qedi: Remove set but not used variable 'cls_sess'
YueHaibing [Sat, 16 Feb 2019 07:39:06 +0000 (07:39 +0000)]
scsi: qedi: Remove set but not used variable 'cls_sess'

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 <yuehaibing@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: be2iscsi: lpfc: fix typo
Matteo Croce [Fri, 4 Jan 2019 21:38:54 +0000 (22:38 +0100)]
scsi: be2iscsi: lpfc: fix typo

Fix spelling mistake: "lenght" -> "length"

Signed-off-by: Matteo Croce <mcroce@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Fix a small typo in qla_bsg.c
Milan P. Gandhi [Tue, 12 Mar 2019 12:53:15 +0000 (18:23 +0530)]
scsi: qla2xxx: Fix a small typo in qla_bsg.c

Fixed a typo for 'iiDMA' cmd in qla_bsg.c.

Signed-off-by: Milan P. Gandhi <mgandhi@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Fix comment alignment in qla_bsg.c
Milan P. Gandhi [Tue, 12 Mar 2019 12:51:11 +0000 (18:21 +0530)]
scsi: qla2xxx: Fix comment alignment in qla_bsg.c

Fixed a minor formatting issue with comment section in qla_bsg.c

Signed-off-by: Milan P. Gandhi <mgandhi@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: mptfusion: remove set, but not used, variables
YueHaibing [Wed, 20 Feb 2019 12:56:14 +0000 (12:56 +0000)]
scsi: mptfusion: remove set, but not used, variables

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/message/fusion/mptspi.c: In function 'mptspi_writeIOCPage4':
drivers/message/fusion/mptspi.c:262:9: warning:
 variable 'frameOffset' set but not used [-Wunused-but-set-variable]

drivers/message/fusion/mptspi.c:261:9: warning:
 variable 'req_idx' set but not used [-Wunused-but-set-variable]

They're never used and can be removed.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: mptfusion: mark expected switch fall-through
Gustavo A. R. Silva [Mon, 11 Feb 2019 22:45:30 +0000 (16:45 -0600)]
scsi: mptfusion: mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where
we are expecting to fall through.

This patch fixes the following warning:

drivers/message/fusion/mptbase.c: In function  mptbase_reply :
drivers/message/fusion/mptbase.c:643:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
   if (event != MPI_EVENT_EVENT_CHANGE)
      ^
drivers/message/fusion/mptbase.c:646:2: note: here
  case MPI_FUNCTION_CONFIG:
  ^~~~

Warning level 3 was used: -Wimplicit-fallthrough=3

Notice that, in this particular case, the code comment is modified in
accordance with what GCC is expecting to find.

This patch is part of the ongoing efforts to enable
-Wimplicit-fallthrough.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: mptfusion: fix indentation issues
Colin Ian King [Thu, 7 Feb 2019 12:44:07 +0000 (12:44 +0000)]
scsi: mptfusion: fix indentation issues

There are several statements and code blocks there are incorrectly
indented. Fix these.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: mvsas: clean up a few indentation issues
Colin Ian King [Sat, 2 Feb 2019 10:30:35 +0000 (10:30 +0000)]
scsi: mvsas: clean up a few indentation issues

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 <colin.king@canonical.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qlogicfas408: clean up a couple of indentation issues
Colin Ian King [Wed, 23 Jan 2019 13:10:04 +0000 (13:10 +0000)]
scsi: qlogicfas408: clean up a couple of indentation issues

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 <colin.king@canonical.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: dpt_i2o: clean up indentation issues, remove spaces
Colin Ian King [Wed, 23 Jan 2019 12:53:19 +0000 (12:53 +0000)]
scsi: dpt_i2o: clean up indentation issues, remove spaces

There are several lines where the indentation has an extra space, fix this
by removing the spaces.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: atp870u: clean up code style and indentation issues
Colin Ian King [Tue, 22 Jan 2019 15:10:30 +0000 (15:10 +0000)]
scsi: atp870u: clean up code style and indentation issues

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 <colin.king@canonical.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: ufs-mediatek: Add UFS support for Mediatek SoC chips
Stanley Chu [Sat, 16 Mar 2019 05:04:47 +0000 (13:04 +0800)]
scsi: ufs-mediatek: Add UFS support for Mediatek SoC chips

This patch adds UFS support for MediaTek SoC chips.

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: phy: mediatek: Add UFS M-PHY driver
Stanley Chu [Sat, 16 Mar 2019 05:04:46 +0000 (13:04 +0800)]
scsi: phy: mediatek: Add UFS M-PHY driver

Add UFS M-PHY driver on MediaTek chipsets.

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: dt-bindings: ufs: Add document for ufs-mediatek
Stanley Chu [Sat, 16 Mar 2019 05:04:45 +0000 (13:04 +0800)]
scsi: dt-bindings: ufs: Add document for ufs-mediatek

Add UFS and UFS PHY node document for Mediatek SoC chips.

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: dt-bindings: phy: Add document for phy-mtk-ufs
Stanley Chu [Sat, 16 Mar 2019 05:04:44 +0000 (13:04 +0800)]
scsi: dt-bindings: phy: Add document for phy-mtk-ufs

Add UFS M-PHY node document for MediaTek SoC chips.

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: ufs-hisi: Re-factor ufshcd_get_pwr_dev_param
Stanley Chu [Sat, 16 Mar 2019 05:04:43 +0000 (13:04 +0800)]
scsi: ufs-hisi: Re-factor ufshcd_get_pwr_dev_param

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 <stanley.chu@mediatek.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Acked-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: ufs-qcom: Re-factor ufshcd_get_pwr_dev_param
Stanley Chu [Sat, 16 Mar 2019 05:04:42 +0000 (13:04 +0800)]
scsi: ufs-qcom: Re-factor ufshcd_get_pwr_dev_param

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 <stanley.chu@mediatek.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Acked-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: ufs: Introduce ufshcd_get_pwr_dev_param
Stanley Chu [Sat, 16 Mar 2019 05:04:41 +0000 (13:04 +0800)]
scsi: ufs: Introduce ufshcd_get_pwr_dev_param

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 <stanley.chu@mediatek.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Acked-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: smartpqi: Use HCTX_TYPE_DEFAULT for blk_mq_tag_set->map
Dongli Zhang [Tue, 12 Mar 2019 01:00:31 +0000 (09:00 +0800)]
scsi: smartpqi: Use HCTX_TYPE_DEFAULT for blk_mq_tag_set->map

Use HCTX_TYPE_DEFAULT instead of 0 to avoid hardcoding.

Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Use HCTX_TYPE_DEFAULT for blk_mq_tag_set->map
Dongli Zhang [Tue, 12 Mar 2019 01:00:30 +0000 (09:00 +0800)]
scsi: qla2xxx: Use HCTX_TYPE_DEFAULT for blk_mq_tag_set->map

Use HCTX_TYPE_DEFAULT instead of 0 to avoid hardcoding.

Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: virtio_scsi: Use HCTX_TYPE_DEFAULT for blk_mq_tag_set->map
Dongli Zhang [Tue, 12 Mar 2019 01:00:29 +0000 (09:00 +0800)]
scsi: virtio_scsi: Use HCTX_TYPE_DEFAULT for blk_mq_tag_set->map

Use HCTX_TYPE_DEFAULT instead of 0 to avoid hardcoding.

Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: core: Use HCTX_TYPE_DEFAULT for blk_mq_tag_set->map
Dongli Zhang [Tue, 12 Mar 2019 01:00:28 +0000 (09:00 +0800)]
scsi: core: Use HCTX_TYPE_DEFAULT for blk_mq_tag_set->map

Use HCTX_TYPE_DEFAULT instead of 0 to avoid hardcoding.

Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: ufs: fix a missing check of devm_reset_control_get
Kangjie Lu [Fri, 15 Mar 2019 07:11:56 +0000 (02:11 -0500)]
scsi: ufs: fix a missing check of devm_reset_control_get

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 <kjlu@umn.edu>
Acked-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: pm8001: clean up various indentation issues
Colin Ian King [Sun, 17 Mar 2019 18:15:32 +0000 (18:15 +0000)]
scsi: pm8001: clean up various indentation issues

There are several lines of code where the indentation is at an incorrect
level; fix these.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: NCR5380: Remove set but unused variable
Finn Thain [Thu, 7 Mar 2019 21:49:02 +0000 (08:49 +1100)]
scsi: NCR5380: Remove set but unused variable

Cc: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: NCR5380: Avoid compiler warning when -Wimplicit-fallthrough is enabled
Finn Thain [Thu, 7 Mar 2019 21:49:02 +0000 (08:49 +1100)]
scsi: NCR5380: Avoid compiler warning when -Wimplicit-fallthrough is enabled

Adjust comments accordingly.

Cc: Gustavo A. R. Silva <gustavo@embeddedor.com>
Cc: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: core: Remove OSD include files
Bart Van Assche [Tue, 19 Mar 2019 03:06:42 +0000 (20:06 -0700)]
scsi: core: Remove OSD include files

All code from which the OSD include files were included has been removed.
Hence also remove the include files themselves. See also commit
19fcae3d4f2d ("scsi: remove the SCSI OSD library").

Cc: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: core: remove the scsi_ioctl_reset export
Christoph Hellwig [Fri, 15 Mar 2019 08:44:19 +0000 (09:44 +0100)]
scsi: core: remove the scsi_ioctl_reset export

This function is only used inside the SCSI midlayer.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: core: reshuffle no_scsi2_lun_in_cdb for better alignment
Hannes Reinecke [Tue, 26 Feb 2019 15:00:39 +0000 (16:00 +0100)]
scsi: core: reshuffle no_scsi2_lun_in_cdb for better alignment

no_scsi2_lun_in_cdb declares a new bitfield, but we should rather move
it to the existing bitfield for better alignment.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Update lpfc version to 12.2.0.1
James Smart [Tue, 12 Mar 2019 23:30:33 +0000 (16:30 -0700)]
scsi: lpfc: Update lpfc version to 12.2.0.1

Update lpfc version to 12.2.0.0

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Update Copyright in driver version
James Smart [Tue, 12 Mar 2019 23:30:32 +0000 (16:30 -0700)]
scsi: lpfc: Update Copyright in driver version

Revise driver copyright message to show 2019.  Update couple of files
modified by 12.2.0.1 patch set.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Enhance 6072 log string
James Smart [Tue, 12 Mar 2019 23:30:31 +0000 (16:30 -0700)]
scsi: lpfc: Enhance 6072 log string

Update the 6072 log message string to print the whole 32 bits of the
extended status.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Fix duplicate log message numbers
James Smart [Tue, 12 Mar 2019 23:30:30 +0000 (16:30 -0700)]
scsi: lpfc: Fix duplicate log message numbers

Driver had duplicated log message numbers making debug difficult.

Make all messages unique.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Specify node affinity for queue memory allocation
James Smart [Tue, 12 Mar 2019 23:30:29 +0000 (16:30 -0700)]
scsi: lpfc: Specify node affinity for queue memory allocation

Change the SLI4 queue creation code to use NUMA node based memory
allocation based on the cpu the queues will be related to.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Reduce memory footprint for lpfc_queue
James Smart [Tue, 12 Mar 2019 23:30:28 +0000 (16:30 -0700)]
scsi: lpfc: Reduce memory footprint for lpfc_queue

Currently the driver maintains a sideband structure which has a pointer for
each queue element. However, at 8 bytes per pointer, and up to 4k elements
per queue, and 100s of queues, this can take up a lot of memory.

Convert the driver to using an access routine that calculates the element
address based on its index rather than using the pointer table.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Add loopback testing to trunking mode
James Smart [Tue, 12 Mar 2019 23:30:27 +0000 (16:30 -0700)]
scsi: lpfc: Add loopback testing to trunking mode

When in trunking mode, the adapter can be placed into diagnostic mode and
each link in the trunk tested via loopback.

Add support to the driver to perform per-link loopback testing when in
trunking mode.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Fix link speed reporting for 4-link trunk
James Smart [Tue, 12 Mar 2019 23:30:26 +0000 (16:30 -0700)]
scsi: lpfc: Fix link speed reporting for 4-link trunk

Driver is using uint16_t and is encountering an overflow of the 16bits when
calculating link speed.

Fix by using a u32 type.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Fix handling of trunk links state reporting
James Smart [Tue, 12 Mar 2019 23:30:25 +0000 (16:30 -0700)]
scsi: lpfc: Fix handling of trunk links state reporting

If all the trunk links drop and a single link resumes, the link_state is
not properly reported. When trunked, the driver receives two async
cqes. One acqe reports the trunk link states, which the driver records.
The other cqe reports the overall state of the trunk. In the failing case,
the trunk link state acqe preceeds the overall trunk link state acqe. The
trunk link state acqe, as it's an "up" transition, calls a code path which
ensures a down transition before moving to the up state.  The down
transition had a side effect of clearing the just-saved trunk link states.

Fix by not clearing the trunk link states if we've already transitioned
to a down state.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Fix protocol support on G6 and G7 adapters
James Smart [Tue, 12 Mar 2019 23:30:24 +0000 (16:30 -0700)]
scsi: lpfc: Fix protocol support on G6 and G7 adapters

Invalid test is allowing Loop to be a supported topology on G6 and G7
adapters. The chips do not support loop as their link speeds prohibit loop
per standard.

Correct the conditional so that loop is not reported.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Correct boot bios information to FDMI registration
James Smart [Tue, 12 Mar 2019 23:30:23 +0000 (16:30 -0700)]
scsi: lpfc: Correct boot bios information to FDMI registration

The driver is currently reporting the firmware revision not the actual boot
bios version in FDMI data.

Modify the driver to obtain the boot bios version from the adapter and use
that data in the FMDI data sent to the switch.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Fix HDMI2 registration string for symbolic name
James Smart [Tue, 12 Mar 2019 23:30:22 +0000 (16:30 -0700)]
scsi: lpfc: Fix HDMI2 registration string for symbolic name

The switch is rejecting FDMI2 registration for symbolic name.  There is a
"\n" in the name string, which the switch dislikes thus rejects the
registration.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Fix fc4type information for FDMI
James Smart [Tue, 12 Mar 2019 23:30:21 +0000 (16:30 -0700)]
scsi: lpfc: Fix fc4type information for FDMI

The driver is reporting support for NVME even when not configured for NVME
operation.

Fix (and make more readable) when NVME protocol support is indicated.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Fix FDMI manufacturer attribute value
James Smart [Tue, 12 Mar 2019 23:30:20 +0000 (16:30 -0700)]
scsi: lpfc: Fix FDMI manufacturer attribute value

The FDMI manufacturer value being reported on Linux is inconsistent with
other OS's.

Set the value to "Emulex Corporation" for consistency.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Fix io lost on host resets
James Smart [Tue, 12 Mar 2019 23:30:19 +0000 (16:30 -0700)]
scsi: lpfc: Fix io lost on host resets

If the driver undergoes repeated host resets it starts losing exchange
structures and eventually returns SCSI_MLQUEUE_HOST_BUSY and does not
recover. The offline path is not reclaiming the outstanding ios on the fcp
pring txcmplq before calling lpfc_destroy_multixripool, which causes the
txmcplq to be reinit and the resources lost.

Flush the fcp rings before destroying the multixripools.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Fix mailbox hang on adapter init
James Smart [Tue, 12 Mar 2019 23:30:18 +0000 (16:30 -0700)]
scsi: lpfc: Fix mailbox hang on adapter init

The adapter initialization sequence enables interrupts, initializes the
adapter link_state to LINK_DOWN, then issues commands to initialize the
adapter. The interrupt handler on the adapter validates the link_state (has
to be at least LINK_DOWN) and if invalid, will discard the interrupting
event.

In most cases, there is not a command completion, thus an interrupt until
the initialization commands have been sent which is post the setting of
state to LINK_DOWN.  However, in cases of firmware reset, the reset will
modify the link_state to an invalid value (indicating a reset of the
adapter) and there occasionally are cases where the adapter will generate
an asynchronous event which shares the eq/cq used for mailbox commands. In
the failure case, an interrupt is generated immediately after enabling them
due to the async event.  As link_state is invalid, the eq is list and the
CQ not serviced.  At this point link_state is initialized and the mailbox
command sent.  As the CQ has not been serviced, it is not armed, so no
interrupt event is generated when the mailbox command completes.

Modify the initialization sequence so that interrupts are enabled after
link_state is properly initialized, which avoids the race condition with
the async event.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Fix driver crash in target reset handler
James Smart [Tue, 12 Mar 2019 23:30:17 +0000 (16:30 -0700)]
scsi: lpfc: Fix driver crash in target reset handler

It's possible for the scsi error handler to fire and call the target reset
handler simultaneously to the driver logging out and relogging into the
system.  If hit just right, the re-login may not have fully re-established
the remote port and the rdata->pnod structure may be null.

Check for NULL in the reset handler and return failure if NULL.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Correct localport timeout duration error
James Smart [Tue, 12 Mar 2019 23:30:16 +0000 (16:30 -0700)]
scsi: lpfc: Correct localport timeout duration error

Current code incorrectly specifies a completion wait timeout duration in 5
jiffies, when it should have been 5 seconds.

Fix the adjust for units for the completion timeout call.

[mkp: manual merge]

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Convert bootstrap mbx polling from msleep to udelay
James Smart [Tue, 12 Mar 2019 23:30:15 +0000 (16:30 -0700)]
scsi: lpfc: Convert bootstrap mbx polling from msleep to udelay

Current code is using msleep when polling for hw ready. Unfortunately the
msleep routine isn't very accurate on rescheduling. In fact, on a busy
systems which reset the adapter, it became 10s of seconds before it was
rescheduled.

Fix by busy waiting using udelay. As we're now busy waiting, significantly
reduce the wait time so that we can exit the pool loop as soon as possible.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Coordinate adapter error handling with offline handling
James Smart [Tue, 12 Mar 2019 23:30:14 +0000 (16:30 -0700)]
scsi: lpfc: Coordinate adapter error handling with offline handling

The driver periodically checks for adapter error in a background thread. If
the thread detects an error, the adapter will be reset including the
deletion and reallocation of workqueues on the adapter.  Simultaneously,
there may be a user-space request to offline the adapter which may try to
do many of the same steps, in parallel, on a different thread. As memory
was deallocated while unexpected, the parallel offline request hit a bad
pointer.

Add coordination between the two threads.  The error recovery thread has
precedence. So, when an error is detected, a flag is set on the adapter to
indicate the error thread is terminating the adapter. But, before doing
that work, it will look for a flag that is set by the offline flow, and if
set, will wait for it to complete before then processing the error handling
path.  Similarly, in the offline thread, it first checks for whether the
error thread is resetting the adapter, and if so, will then wait for the
error thread to finish. Only after it has finished, will it set its flag
and offline the adapter.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Stop adapter if pci errors detected
James Smart [Tue, 12 Mar 2019 23:30:13 +0000 (16:30 -0700)]
scsi: lpfc: Stop adapter if pci errors detected

In a couple of cases, the driver detected a pci error (via pci device state
or via failed register reads) but didn't take any action to disable the
device.  Additionally, the driver is ignoring the status of pci
configuration space reads.

Having the driver take the adapter offline whenever the pci error is
detected.  Pay attention to pci_config_space_read status and return failure
if an error is seen.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Fix deadlock due to nested hbalock call
James Smart [Tue, 12 Mar 2019 23:30:12 +0000 (16:30 -0700)]
scsi: lpfc: Fix deadlock due to nested hbalock call

If an adapter fails, causing a board reset, the board reset routine
lpfc_hba_down_s4() takes the hbalock out then calls
lpfc_nvmet_ctxbuf_post() who then tries to take out the same lock.  As the
context lists are now protected under the buf_list_locks, there is no need
for the hbalock to be held by the board reset routine.

Fix by no longer taking the hbalock in the board reset routine.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Fix nvmet handling of first burst cmd
James Smart [Tue, 12 Mar 2019 23:30:11 +0000 (16:30 -0700)]
scsi: lpfc: Fix nvmet handling of first burst cmd

With negative test injection, the driver is receiving a command with first
burst enabled, meaning Sequence initiative is not passed with the command
frame. The driver notes the condition and discards the frame.  However the
driver calls the incorrect buffer free routine, resulting in a NULL pointer
reference.

For hbq buffer free, convert to using lpfc_rq_buf_free().

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Fix lpfc_nvmet_mrq attribute handling when 0
James Smart [Tue, 12 Mar 2019 23:30:10 +0000 (16:30 -0700)]
scsi: lpfc: Fix lpfc_nvmet_mrq attribute handling when 0

Currently, when lpfc_nvmet_mrq is 0 it could mean 2 different things
depending on when its looked at. If at module load time it specifies the
default number of hardware queues to allocate, with 0 meaning default to
the number of CPUs. But post module load, a value of zero means to disable
mrq use.

Changed the driver so that enablement of mrq is based on whether nvme
target mode is enabled or not. When enabled, mrq is enabled.  Thus, the
cfg_nvemt_mrq field only specifies the number of mrq queues to enable, with
0 defaulting to the number of cpus.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Fix nvmet async receive buffer replenishment
James Smart [Tue, 12 Mar 2019 23:30:09 +0000 (16:30 -0700)]
scsi: lpfc: Fix nvmet async receive buffer replenishment

Under circustances with high load, the driver is running out of async
receive buffers which may result in one of the following messages:

0:6401 RQE Error x13, posted 226 err_cnt 0: 925c6050 925c604e 925c5d54

or

0:2885 Port Status Event: port status reg 0x81800000,
       port smphr reg 0xc000, error 1=0x52004a01, error 2=0x0

The driver is waiting for full io completion before returning receive
buffers to the adapter. There is no need for such a relationship.

Whenever a new command is received from the wire, the driver will have two
contexts - an io context (ctxp) and a receive buffer context.  In current
code, the receive buffer context stays 1:1 with the io and won't be
reposted to the hardware until the io completes. There is no need for such
a relationship.

Change the driver so that up on successful handing of the command to the
transport, where the transport has copied what it needed thus the buffer is
returned to the driver, have the driver immediately repost the buffer to
the hardware. If the command cannot be successfully handed to the transport
as transport resources are temporarily busy, have the driver allocate a new
and separate receive buffer and post it to the hardware so that hardware
can continue while the command is queued for the transport.

When an io is complete, the transport returns the io context to the driver,
and the driver may be waiting for more contexts, thus immediately reuse the
io context. In this path, there was a buffer posted when the receive buffer
was queued waiting for an io context so a replacement is not needed in the
new code additions. Thus, exempt this the context reuse case from the
buffer reposting.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Fix location of SCSI ktime counters
James Smart [Tue, 12 Mar 2019 23:30:08 +0000 (16:30 -0700)]
scsi: lpfc: Fix location of SCSI ktime counters

The debug ktime counters that trace an io were inadvertently not placed in
the common section of an io buffer. Thus, they generate an invalid opcode
error when accessed.

Move the ktime counters into the common area.

Fixes: 0794d601d174 ("scsi: lpfc: Implement common IO buffers between NVME and SCSI")
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Fix SLI3 commands being issued on SLI4 devices
James Smart [Tue, 12 Mar 2019 23:30:07 +0000 (16:30 -0700)]
scsi: lpfc: Fix SLI3 commands being issued on SLI4 devices

During debug, it was seen that the driver is issuing commands specific to
SLI3 on SLI4 devices. Although the adapter correctly rejected the command,
this should not be done.

Revise the code to stop sending these commands on a SLI4 adapter.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Fix use-after-free mailbox cmd completion
James Smart [Tue, 12 Mar 2019 23:30:06 +0000 (16:30 -0700)]
scsi: lpfc: Fix use-after-free mailbox cmd completion

When unloading the driver, mailbox commands may be sent without holding a
reference on the ndlp. By the time the mailbox command completes, the ndlp
may have reduced its ref counts and been freed.  The problem was reported
by KASAN.

While unregistering due to driver unload, have the completion noop'd by
setting the ndlp context NULL'd. Due to the unload, no further action was
necessary.  Also, while reviewing this path, the generic nulling of the
context after handling should be slightly moved.

Reported by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Resolve irq-unsafe lockdep heirarchy warning in lpfc_io_free
James Smart [Tue, 12 Mar 2019 23:30:05 +0000 (16:30 -0700)]
scsi: lpfc: Resolve irq-unsafe lockdep heirarchy warning in lpfc_io_free

A patch in the 12.2.0.0 set caused a new lockdep warning:

  WARNING: SOFTIRQ-safe -> SOFTIRQ-unsafe lock order detected
  5.0.0-rc8-next-20190301-dbg+ #1 Not tainted

  Possible interrupt unsafe locking scenario:
       CPU0                    CPU1
       ----                    ----
  lock(&(&qp->io_buf_list_put_lock)->rlock);
                               local_irq_disable();
                               lock(&(&phba->hbalock)->rlock);
                               lock(&(&qp->io_buf_list_put_lock)->rlock);
  <Interrupt>
    lock(&(&phba->hbalock)->rlock);

see: https://www.spinics.net/lists/linux-scsi/msg128389.html

In summary, the new patch added taking the io_buf_list_put_lock while under
an irq-disabled hbalock. This created a lock heirarchy dependent upon irq
being disabled, and there are paths that take the io_buf_list_put_lock
without disabling irq.

Looking at the lpfc_io_free routine, which is where the new heirarchy was
introduced, there is no reason to be taking out the hbalock and raising
irq, as the functionality is replaced by the io_buf_list_xxx locks.

Resolve by removing the hbalock/irq calls in lpfc_io_free.

Fixes: 5e5b511d8bfa ("scsi: lpfc: Partition XRI buffer list across Hardware Queues")
Reported-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Resolve inconsistent check of hdwq in lpfc_scsi_cmd_iocb_cmpl
James Smart [Tue, 12 Mar 2019 23:30:04 +0000 (16:30 -0700)]
scsi: lpfc: Resolve inconsistent check of hdwq in lpfc_scsi_cmd_iocb_cmpl

A prior patch which added support for non-uniform allocation of MSIX
vectors now causes a smatch complaint:

 drivers/scsi/lpfc/lpfc_scsi.c:3674 lpfc_scsi_cmd_iocb_cmpl()
   error: we previously assumed 'phba->sli4_hba.hdwq' could be
          null (see line 3667)

Resolve by removing the unnecessary check for a NULL hdwq table.

Fixes 6a828b0f6192: ("scsi: lpfc: Support non-uniform allocation of MSIX vectors to hardware queues")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Update driver version to 10.01.00.15-k
Himanshu Madhani [Tue, 12 Mar 2019 18:08:23 +0000 (11:08 -0700)]
scsi: qla2xxx: Update driver version to 10.01.00.15-k

This version includes support for ISP28XX.

Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Secure flash update support for ISP28XX
Michael Hernandez [Tue, 12 Mar 2019 18:08:22 +0000 (11:08 -0700)]
scsi: qla2xxx: Secure flash update support for ISP28XX

This patch adds support for Secure flash update with ISP28xx.

Signed-off-by: Michael Hernandez <mhernandez@marvell.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Add 28xx flash primary/secondary status/image mechanism
Joe Carnuccio [Tue, 12 Mar 2019 18:08:21 +0000 (11:08 -0700)]
scsi: qla2xxx: Add 28xx flash primary/secondary status/image mechanism

Includes the following:
- correction to 27xx image status struct;
- factoring of 27xx image status validating routines to make common;
- image status generation compare that works across zero wrap;
- bsg interface to report current active images (as loaded by driver).

Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Mike Hernandez <mhernandez@marvell.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Simplification of register address used in qla_tmpl.c
Joe Carnuccio [Tue, 12 Mar 2019 18:08:20 +0000 (11:08 -0700)]
scsi: qla2xxx: Simplification of register address used in qla_tmpl.c

Reduce stack space on each fwdt routine by eliminating local variable reg.

Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Correction and improvement to fwdt processing
Joe Carnuccio [Tue, 12 Mar 2019 18:08:19 +0000 (11:08 -0700)]
scsi: qla2xxx: Correction and improvement to fwdt processing

This patch cleans up and fixes firmware dump template processing. These
changes are added to support newer features for ISP27XX/ISP28XX.

Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Update flash read/write routine
Joe Carnuccio [Tue, 12 Mar 2019 18:08:18 +0000 (11:08 -0700)]
scsi: qla2xxx: Update flash read/write routine

This patch makes following changes to flash access routines:

- update return type for read_optrom
- use void instead of uint32_t * for buffer parameter in read
  and write optrom routines
- fix flash/nvram addressing

Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Add support for multiple fwdump templates/segments
Joe Carnuccio [Tue, 12 Mar 2019 18:08:17 +0000 (11:08 -0700)]
scsi: qla2xxx: Add support for multiple fwdump templates/segments

This patch adds multipe firmware dump template and segments support for
ISP27XX/28XX.

Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Cleanups for NVRAM/Flash read/write path
Joe Carnuccio [Tue, 12 Mar 2019 18:08:16 +0000 (11:08 -0700)]
scsi: qla2xxx: Cleanups for NVRAM/Flash read/write path

This patch does following:

 - Clean up NVRAM code.
 - Optimizes reading of primary/secondary flash image validation.
 - Remove 0xff mask and make correct width in FLT structure.
 - Use endian macros to assign static fields in fwdump header.
 - Correct fdwt checksum calculation.
 - Simplify ql_dump_buffer() interface usage.
 - Add endianizers to 27xx firmware image validator.
 - fixes compiler warnings for big endian architecture.

Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Correctly report max/min supported speeds
Joe Carnuccio [Tue, 12 Mar 2019 18:08:15 +0000 (11:08 -0700)]
scsi: qla2xxx: Correctly report max/min supported speeds

This patch fixes reported speed for min_link and max_supported speed. Also
rename sysfs nodes link_speed and max_supported to be consistent with
{min|max}_suuported_speed.

Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Mike Hernandez <mhernandez@marvell.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Add Serdes support for ISP28XX
Joe Carnuccio [Tue, 12 Mar 2019 18:08:14 +0000 (11:08 -0700)]
scsi: qla2xxx: Add Serdes support for ISP28XX

This patch adds sysfs node for serdes_version and also cleans up port_speed
display.

Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Add Device ID for ISP28XX
Joe Carnuccio [Tue, 12 Mar 2019 18:08:13 +0000 (11:08 -0700)]
scsi: qla2xxx: Add Device ID for ISP28XX

This patch adds PCI device ID ISP28XX for Gen7 support.  Also signature
determination for primary/secondary flash image for ISP27XX/28XX is aded as
part of Gen7 support.

Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Fix routine qla27xx_dump_{mpi|ram}()
Joe Carnuccio [Tue, 12 Mar 2019 18:08:12 +0000 (11:08 -0700)]
scsi: qla2xxx: Fix routine qla27xx_dump_{mpi|ram}()

This patch fixes qla27xx_dump_{mpi|ram} api for ISP27XX.

Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Remove FW default template
Joe Carnuccio [Tue, 12 Mar 2019 18:08:11 +0000 (11:08 -0700)]
scsi: qla2xxx: Remove FW default template

This patch removes FW default template as there will never be case where
the default template would be invoked.

Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Add fw_attr and port_no SysFS node
Joe Carnuccio [Tue, 12 Mar 2019 18:08:10 +0000 (11:08 -0700)]
scsi: qla2xxx: Add fw_attr and port_no SysFS node

This patch adds new sysfs node to display firmware attributes and port
number.

Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: mpt3sas: Update mpt3sas driver version to 28.100.00.00
Suganath Prabu [Fri, 15 Feb 2019 07:40:30 +0000 (02:40 -0500)]
scsi: mpt3sas: Update mpt3sas driver version to 28.100.00.00

Updated driver version to 28.100.00.00, which is equivalent to OOB Phase 9.

Signed-off-by: Suganath Prabu <suganath-prabu.subramani@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: mpt3sas: Improve the threshold value and introduce module param
Suganath Prabu [Fri, 15 Feb 2019 07:40:29 +0000 (02:40 -0500)]
scsi: mpt3sas: Improve the threshold value and introduce module param

* Reduce the threshold value to 1/4 of the queue depth.

* With this FW can find enough entries to post the Reply Descriptors in the
  reply descriptor post queue.

* With module param, user can play with threshold value, the same
  irqpoll_weight is used as the budget in processing of reply descriptor
  post queues in _base_process_reply_queue.

Signed-off-by: Suganath Prabu <suganath-prabu.subramani@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: mpt3sas: Load balance to improve performance and avoid soft lockups
Suganath Prabu [Fri, 15 Feb 2019 07:40:28 +0000 (02:40 -0500)]
scsi: mpt3sas: Load balance to improve performance and avoid soft lockups

Driver uses "reply descriptor post queues" in round robin fashion so that
IO's are distributed to all the available reply descriptor post queues
equally.  With this each reply descriptor post queue load is balanced.

This is enabled only if CPUs count to MSI-X vector count ratio is X:1
(where X > 1) This improves performance and also fixes soft lockups.

Signed-off-by: Suganath Prabu <suganath-prabu.subramani@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: mpt3sas: Irq poll to avoid CPU hard lockups
Suganath Prabu [Fri, 15 Feb 2019 07:40:27 +0000 (02:40 -0500)]
scsi: mpt3sas: Irq poll to avoid CPU hard lockups

Issue Description:
We have seen cpu lock up issue from fields if system has greater (more than
96) logical cpu count.  SAS3.0 controller (Invader series) supports at max
96 msix vector and SAS3.5 product (Ventura) supports at max 128 msix
vectors.

This may be a generic issue (if PCI device supports completion on multiple
reply queues).  Let me explain it w.r.t to mpt3sas supported h/w just to
simplify the problem and possible changes to handle such issues. IT HBA
(mpt3sas) supports multiple reply queues in completion path. Driver creates
MSI-x vectors for controller as "min of (FW supported Reply queue, Logical
CPUs)". If submitter is not interrupted via completion on same CPU, there
is a loop in the IO path. This behavior can cause hard/soft CPU lockups, IO
timeout, system sluggish etc.

Example - one CPU (e.g. CPU A) is busy submitting the IOs and another CPU
(e.g. CPU B) is busy with processing the corresponding IO's reply
descriptors from reply descriptor queue upon receiving the interrupts from
HBA.  If the CPU A is continuously pumping the IOs then always CPU B (which
is executing the ISR) will see the valid reply descriptors in the reply
descriptor queue and it will be continuously processing those reply
descriptor in a loop without quitting the ISR handler.

Mpt3sas driver will exit ISR handler if it finds unused reply descriptor in
the reply descriptor queue. Since CPU A will be continuously sending the
IOs, CPU B may always see a valid reply descriptor (posted by HBA Firmware
after processing the IO) in the reply descriptor queue. In worst case,
driver will not quit from this loop in the ISR handler. Eventually, CPU
lockup will be detected by watchdog.

Above mentioned behavior is not common if "rq_affinity" set to 2 or
affinity_hint is honored by irqbalance as "exact". If rq_affinity is set
to 2, submitter will be always interrupted via completion on same CPU.  If
irqbalance is using "exact" policy, interrupt will be delivered to
submitter CPU.

If CPU counts to MSI-X vectors (reply descriptor Queues) count ratio is not
1:1, we still have exposure of issue explained above and for that we don't
have any solution.

Exposure of soft/hard lockup if CPU count is more than MSI-x supported by
device.

If CPUs count to MSI-x vectors count ratio is not 1:1, (Other way, if CPU
counts to MSI-x vector count ratio is something like X:1, where X > 1) then
'exact' irqbalance policy OR rq_affinity = 2 won't help to avoid CPU
hard/soft lockups. There won't be any one to one mapping between CPU to
MSI-x vector instead one MSI-x interrupt (or reply descriptor queue) is
shared with group/set of CPUs and there is a possibility of having a loop
in the IO path within that CPU group and may observe lockups.

For example: Consider a system having two NUMA nodes and each node having
four logical CPUs and also consider that number of MSI-x vectors enabled on
the HBA is two, then CPUs count to MSI-x vector count ratio as 4:1.  e.g.
MSIx vector 0 is affinity to CPU 0, CPU 1, CPU 2 & CPU 3 of NUMA node 0 and
MSI-x vector 1 is affinity to CPU 4, CPU 5, CPU 6 & CPU 7 of NUMA node 1.

numactl --hardware
available: 2 nodes (0-1)
node 0 cpus: 0 1 2 3                 --> MSI-x 0
node 0 size: 65536 MB
node 0 free: 63176 MB
node 1 cpus: 4 5 6 7                 -->MSI-x 1
node 1 size: 65536 MB
node 1 free: 63176 MB

Assume that user started an application which uses all the CPUs of NUMA
node 0 for issuing the IOs.  Only one CPU from affinity list (it can be any
cpu since this behavior depends upon irqbalance) CPU0 will receive the
interrupts from MSIx vector 0 for all the IOs. Eventually, CPU 0 IO
submission percentage will be decreasing and ISR processing percentage will
be increasing as it is more busy with processing the interrupts.  Gradually
IO submission percentage on CPU 0 will be zero and it's ISR processing
percentage will be 100 percentage as IO loop has already formed within the
NUMA node 0, i.e. CPU 1, CPU 2 & CPU 3 will be continuously busy with
submitting the heavy IOs and only CPU 0 is busy in the ISR path as it
always find the valid reply descriptor in the reply descriptor
queue. Eventually, we will observe the hard lockup here.

Chances of occurring of hard/soft lockups are directly proportional to
value of X. If value of X is high, then chances of observing CPU lockups is
high.

Solution: Use IRQ poll interface defined in " irq_poll.c".  mpt3sas driver
will execute ISR routine in Softirq context and it will always quit the
loop based on budget provided in IRQ poll interface.

In these scenarios (i.e. where CPUs count to MSI-X vectors count ratio is
X:1 (where X > 1)), IRQ poll interface will avoid CPU hard lockups due to
voluntary exit from the reply queue processing based on budget.  Note -
Only one MSI-x vector is busy doing processing.

Irqstat output:

IRQs / 1 second(s)
IRQ#  TOTAL  NODE0   NODE1   NODE2   NODE3  NAME
  44    122871   122871   0       0       0  IR-PCI-MSI-edge mpt3sas0-msix0
  45        0              0           0       0       0  IR-PCI-MSI-edge mpt3sas0-msix1

We use this approach only if cpu count is more than FW supported MSI-x
vector

Signed-off-by: Suganath Prabu <suganath-prabu.subramani@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: mpt3sas: simplify interrupt handler
Suganath Prabu [Fri, 15 Feb 2019 07:40:25 +0000 (02:40 -0500)]
scsi: mpt3sas: simplify interrupt handler

Separate out processing of reply descriptor post queue from _base_interrupt
to _base_process_reply_queue.

Signed-off-by: Suganath Prabu <suganath-prabu.subramani@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: mpt3sas: Fix typo in request_desript_type
Suganath Prabu [Fri, 15 Feb 2019 07:40:24 +0000 (02:40 -0500)]
scsi: mpt3sas: Fix typo in request_desript_type

Fixed typo in request_desript_type.
request_desript_type --> request_descript_type.

Signed-off-by: Suganath Prabu <suganath-prabu.subramani@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target: Add device product id and revision configfs attributes
Alan Adamson [Fri, 1 Mar 2019 22:44:20 +0000 (14:44 -0800)]
scsi: target: Add device product id and revision configfs attributes

The product_id and revision attributes will allow for the modification of
the T10 Model and Revision strings returned in inquiry responses.  Its
value can be viewed and modified via the ConfigFS path at:

target/core/$backstore/$name/wwn/product_id
target/core/$backstore/$name/wwn/revision

[mkp: dropped parentheses as requested by Bart]

Signed-off-by: Alan Adamson <alan.adamson@oracle.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: smartpqi: bump driver version
Don Brace [Thu, 14 Mar 2019 21:58:16 +0000 (16:58 -0500)]
scsi: smartpqi: bump driver version

Reviewed-by: Gerry Morong <gerry.morong@microsemi.com>
Reviewed-by: David Carroll <david.carroll@microsemi.com>
Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: smartpqi: add spdx
Don Brace [Thu, 14 Mar 2019 21:58:09 +0000 (16:58 -0500)]
scsi: smartpqi: add spdx

Reviewed-by: David Carroll <david.carroll@microsemi.com>
Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: smartpqi: update copyright
Don Brace [Thu, 14 Mar 2019 21:58:02 +0000 (16:58 -0500)]
scsi: smartpqi: update copyright

Reviewed-by: Gerry Morong <gerry.morong@microsemi.com>
Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: David Carroll <david.carroll@microsemi.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: smartpqi: add H3C controller IDs
Ajish Koshy [Thu, 14 Mar 2019 21:57:55 +0000 (16:57 -0500)]
scsi: smartpqi: add H3C controller IDs

Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Reviewed-by: David Carroll <david.carroll@microsemi.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Ajish Koshy <ajish.koshy@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: smartpqi: increase LUN reset timeout
Kevin Barnett [Thu, 14 Mar 2019 21:57:49 +0000 (16:57 -0500)]
scsi: smartpqi: increase LUN reset timeout

Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Reviewed-by: David Carroll <david.carroll@microsemi.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hpsa: bump driver version
Don Brace [Tue, 12 Mar 2019 18:11:52 +0000 (13:11 -0500)]
scsi: hpsa: bump driver version

Reviewed-by: Gerry Morong <gerry.morong@microsemi.com>
Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hpsa: remove timeout from TURs
Don Brace [Tue, 12 Mar 2019 18:11:45 +0000 (13:11 -0500)]
scsi: hpsa: remove timeout from TURs

There are times when a TUR can take longer than the DEFAULT_TIMEOUT
value. The timeout code is not correct as the function exits with an
automatic as the completion variable...To be fixed later.

Remove the TUR timeout.

Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hpsa: correct device id issues
Don Brace [Tue, 12 Mar 2019 18:11:39 +0000 (13:11 -0500)]
scsi: hpsa: correct device id issues

Correct a 'rare' race condition where a disk is failed after a device list
has been obtained from the controller and before attempting to get the
device id.

Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hpsa: check for lv removal
Don Brace [Tue, 12 Mar 2019 18:11:33 +0000 (13:11 -0500)]
scsi: hpsa: check for lv removal

Multipath failures are normally detected at the frequency of the event
thread. Detect LUN failures earlier by checking request completion status.

Reviewed-by: Bader Ali-saleh <bader.ali-saleh@microsemi.com>
Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Prasad Munirathnam <Prasad.Munirathnam@microsemi.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoLinux 5.1-rc1 v5.1-rc1
Linus Torvalds [Sun, 17 Mar 2019 21:22:26 +0000 (14:22 -0700)]
Linux 5.1-rc1

5 years agoMerge tag 'kbuild-v5.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy...
Linus Torvalds [Sun, 17 Mar 2019 20:25:26 +0000 (13:25 -0700)]
Merge tag 'kbuild-v5.1-2' of git://git./linux/kernel/git/masahiroy/linux-kbuild

Pull more Kbuild updates from Masahiro Yamada:

 - add more Build-Depends to Debian source package

 - prefix header search paths with $(srctree)/

 - make modpost show verbose section mismatch warnings

 - avoid hard-coded CROSS_COMPILE for h8300

 - fix regression for Debian make-kpkg command

 - add semantic patch to detect missing put_device()

 - fix some warnings of 'make deb-pkg'

 - optimize NOSTDINC_FLAGS evaluation

 - add warnings about redundant generic-y

 - clean up Makefiles and scripts

* tag 'kbuild-v5.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
  kconfig: remove stale lxdialog/.gitignore
  kbuild: force all architectures except um to include mandatory-y
  kbuild: warn redundant generic-y
  Revert "modsign: Abort modules_install when signing fails"
  kbuild: Make NOSTDINC_FLAGS a simply expanded variable
  kbuild: deb-pkg: avoid implicit effects
  coccinelle: semantic code search for missing put_device()
  kbuild: pkg: grep include/config/auto.conf instead of $KCONFIG_CONFIG
  kbuild: deb-pkg: introduce is_enabled and if_enabled_echo to builddeb
  kbuild: deb-pkg: add CONFIG_ prefix to kernel config options
  kbuild: add workaround for Debian make-kpkg
  kbuild: source include/config/auto.conf instead of ${KCONFIG_CONFIG}
  unicore32: simplify linker script generation for decompressor
  h8300: use cc-cross-prefix instead of hardcoding h8300-unknown-linux-
  kbuild: move archive command to scripts/Makefile.lib
  modpost: always show verbose warning for section mismatch
  ia64: prefix header search path with $(srctree)/
  libfdt: prefix header search paths with $(srctree)/
  deb-pkg: generate correct build dependencies

5 years agoMerge branch 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sun, 17 Mar 2019 16:21:48 +0000 (09:21 -0700)]
Merge branch 'x86-asm-for-linus' of git://git./linux/kernel/git/tip/tip

Pull x86 asm updates from Thomas Gleixner:
 "Two cleanup patches removing dead conditionals and unused code"

* 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/asm: Remove unused __constant_c_x_memset() macro and inlines
  x86/asm: Remove dead __GNUC__ conditionals

5 years agoMerge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 17 Mar 2019 16:19:22 +0000 (09:19 -0700)]
Merge branch 'perf-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull perf fixes from Thomas Gleixner:
 "Three fixes for the fallout from the TSX errata workaround:

   - Prevent memory corruption caused by a unchecked out of bound array
     index.

   - Two trivial fixes to address compiler warnings"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf/x86/intel: Make dev_attr_allow_tsx_force_abort static
  perf/x86: Fixup typo in stub functions
  perf/x86/intel: Fix memory corruption

5 years agoMerge tag 'for-linus-5.1b-rc1b-tag' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 17 Mar 2019 16:16:22 +0000 (09:16 -0700)]
Merge tag 'for-linus-5.1b-rc1b-tag' of git://git./linux/kernel/git/xen/tip

Pull xen fix from Juergen Gross:
 "A fix for a Xen bug introduced by David's series for excluding
  ballooned pages in vmcores"

* tag 'for-linus-5.1b-rc1b-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
  xen/balloon: Fix mapping PG_offline pages to user space

5 years agoMerge tag '9p-for-5.1' of git://github.com/martinetd/linux
Linus Torvalds [Sun, 17 Mar 2019 16:10:56 +0000 (09:10 -0700)]
Merge tag '9p-for-5.1' of git://github.com/martinetd/linux

Pull 9p updates from Dominique Martinet:
 "Here is a 9p update for 5.1; there honestly hasn't been much.

  Two fixes (leak on invalid mount argument and possible deadlock on
  i_size update on 32bit smp) and a fall-through warning cleanup"

* tag '9p-for-5.1' of git://github.com/martinetd/linux:
  9p/net: fix memory leak in p9_client_create
  9p: use inode->i_lock to protect i_size_write() under 32-bit
  9p: mark expected switch fall-through

5 years agoperf/x86/intel: Make dev_attr_allow_tsx_force_abort static
kbuild test robot [Wed, 13 Mar 2019 18:42:43 +0000 (02:42 +0800)]
perf/x86/intel: Make dev_attr_allow_tsx_force_abort static

Fixes: 400816f60c54 ("perf/x86/intel: Implement support for TSX Force Abort")
Signed-off-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org>
Cc: kbuild-all@01.org
Cc: Borislav Petkov <bp@alien8.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/20190313184243.GA10820@lkp-sb-ep06
5 years agokconfig: remove stale lxdialog/.gitignore
Masahiro Yamada [Sun, 17 Mar 2019 06:05:03 +0000 (15:05 +0900)]
kconfig: remove stale lxdialog/.gitignore

When this .gitignore was added, lxdialog was an independent hostprogs-y.

Now that all objects in lxdialog/ are directly linked to mconf, the
lxdialog is no longer generated.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
5 years agokbuild: force all architectures except um to include mandatory-y
Masahiro Yamada [Sun, 17 Mar 2019 02:01:09 +0000 (11:01 +0900)]
kbuild: force all architectures except um to include mandatory-y

Currently, every arch/*/include/uapi/asm/Kbuild explicitly includes
the common Kbuild.asm file. Factor out the duplicated include directives
to scripts/Makefile.asm-generic so that no architecture would opt out
of the mandatory-y mechanism.

um is not forced to include mandatory-y since it is a very exceptional
case which does not support UAPI.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>