Douglas Gilbert [Sun, 12 Jul 2020 18:29:27 +0000 (14:29 -0400)]
scsi: scsi_debug: Update documentation url and bump version
This driver maintains a version number which is cross-referenced in the
documentation (e.g. to indicate when features are added or changed) and
exposed through the responses to various SCSI commands. For example the
version number is use as the Product Revision number in standard SCSI
INQUIRY responses issued by this driver. The version date string is placed
in a vendor specific area in each standard SCSI INQUIRY response. This
patch bumps both.
Update the driver documentation URL that appears at the top of the driver
source file.
Link: https://lore.kernel.org/r/20200712182927.72044-3-dgilbert@interlog.com
Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Douglas Gilbert [Sun, 12 Jul 2020 18:29:26 +0000 (14:29 -0400)]
scsi: scsi_debug: every_nth triggered error injection
This patch simplifies, or at least makes more consistent, the way setting
the every_nth parameter injects errors. Here is a list of 'opts' flags and
in which cases they inject errors when abs(every_nth)%command_count == 0 is
reached:
- OPT_RECOVERED_ERR: issued on READ(*)s, WRITE(*)s and
WRITE_SCATTEREDs
- OPT_DIF_ERR: issued on READ(*)s, WRITE(*)s and
WRITE_SCATTEREDs
- OPT_DIX_ERR: issued on READ(*)s, WRITE(*)s and
WRITE_SCATTEREDs
- OPT_SHORT_TRANSFER: issued on READ(*)s
- OPT_TRANSPORT_ERR: issued on all commands
- OPT_CMD_ABORT: issued on all commands
The other uses of every_nth were not modified.
Previously if, for example, OPT_SHORT_TRANSFER was armed then if
(abs(every_nth) % command_count == 0) occurred during a command that was
_not_ a READ, then no error injection occurred. This behaviour puzzled
several testers. Now a global "inject_pending" flag is set and the _next_
READ will get hit and that flag is cleared. OPT_RECOVERED_ERR, OPT_DIF_ERR
and OPT_DIX_ERR have similar behaviour. A downside of this is that there
might be a hang-over pending injection that gets triggered by a following
test.
Also expand the every_nth runtime parameter so that it can take hex value
(i.e. with a leading '0x') as well as a decimal value. Now both the 'opts'
and the 'every_nth' runtime parameters can take hexadecimal values.
Link: https://lore.kernel.org/r/20200712182927.72044-2-dgilbert@interlog.com
Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Thu, 9 Jul 2020 12:23:20 +0000 (20:23 +0800)]
scsi: scsi_debug: Support hostwide tags
Many SCSI HBAs support a hostwide tagset, whereby each command submitted to
the HW from all submission queues must have a unique tag identifier.
Normally this unique tag will be in the range [0, max queue], where "max
queue" is the depth of each of the submission queues.
Add support for this hostwide tag feature, via module parameter
"host_max_queue". A non-zero value means that the feature is enabled. In
this case, the submission queues are not exposed to upper layer, i.e. from
blk-mq prespective, the device has a single hw queue. There are 2 reasons
for this:
a. It is assumed that the host can support nr_hw_queues * can_queue
commands, but this is not true for hostwide tags
b. For nr_hw_queues != 0, the request tag is not unique over all HW
queues, and some HBA drivers want to use this tag for the hostwide tag
However, like many SCSI HBA drivers today - megaraid sas being an example -
the full set of HW submission queues are still used in the LLDD driver. So
instead of using a complicated "reply_map" to create a per-CPU submission
queue mapping like megaraid_sas (as it depends on a PCI device + MSIs) -
use a simple algorithm:
hwq = cpu % queue count
If the host_max_queue param is set non-zero, then the max queue depth is
fixed at this value also.
If and when hostwide shared tags are supported in blk-mq/scsi mid-layer,
then the policy to set nr_hw_queues = 0 for hostwide tags can be revised.
Link: https://lore.kernel.org/r/1594297400-24756-3-git-send-email-john.garry@huawei.com
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Thu, 9 Jul 2020 12:23:19 +0000 (20:23 +0800)]
scsi: scsi_debug: Add check for sdebug_max_queue during module init
sdebug_max_queue should not exceed SDEBUG_CANQUEUE, otherwise crashes like
this can be triggered by passing an out-of-range value:
Hardware name: Huawei D06 /D06, BIOS Hisilicon D06 UEFI RC0 - V1.16.01 03/15/2019
pstate:
20400009 (nzCv daif +PAN -UAO BTYPE=--)
pc : schedule_resp+0x2a4/0xa70 [scsi_debug]
lr : schedule_resp+0x52c/0xa70 [scsi_debug]
sp :
ffff800022ab36f0
x29:
ffff800022ab36f0 x28:
ffff0023a935a610
x27:
ffff800008e0a648 x26:
0000000000000003
x25:
ffff0023e84f3200 x24:
00000000003d0900
x23:
0000000000000000 x22:
0000000000000000
x21:
ffff0023be60a320 x20:
ffff0023be60b538
x19:
ffff800008e13000 x18:
0000000000000000
x17:
0000000000000000 x16:
0000000000000000
x15:
0000000000000000 x14:
0000000000000000
x13:
0000000000000000 x12:
0000000000000000
x11:
0000000000000000 x10:
0000000000000000
x9 :
0000000000000001 x8 :
0000000000000000
x7 :
0000000000000000 x6 :
00000000000000c1
x5 :
0000020000200000 x4 :
dead0000000000ff
x3 :
0000000000000200 x2 :
0000000000000200
x1 :
ffff800008e13d88 x0 :
0000000000000000
Call trace:
schedule_resp+0x2a4/0xa70 [scsi_debug]
scsi_debug_queuecommand+0x2c4/0x9e0 [scsi_debug]
scsi_queue_rq+0x698/0x840
__blk_mq_try_issue_directly+0x108/0x228
blk_mq_request_issue_directly+0x58/0x98
blk_mq_try_issue_list_directly+0x5c/0xf0
blk_mq_sched_insert_requests+0x18c/0x200
blk_mq_flush_plug_list+0x11c/0x190
blk_flush_plug_list+0xdc/0x110
blk_finish_plug+0x38/0x210
blkdev_direct_IO+0x450/0x4d8
generic_file_read_iter+0x84/0x180
blkdev_read_iter+0x3c/0x50
aio_read+0xc0/0x170
io_submit_one+0x5c8/0xc98
__arm64_sys_io_submit+0x1b0/0x258
el0_svc_common.constprop.3+0x68/0x170
do_el0_svc+0x24/0x90
el0_sync_handler+0x13c/0x1a8
el0_sync+0x158/0x180
Code:
528847e0 72a001e0 6b00003f 540018cd (
3941c340)
In addition, it should not be less than 1.
So add checks for these, and fail the module init for those cases.
[mkp: changed if condition to match error message]
Link: https://lore.kernel.org/r/1594297400-24756-2-git-send-email-john.garry@huawei.com
Fixes:
c483739430f1 ("scsi_debug: add multiple queue support")
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
John Garry [Mon, 13 Jul 2020 08:04:31 +0000 (16:04 +0800)]
scsi: hisi_sas: Remove one kerneldoc comment
The comment for interrupt_init_v2_hw() should not be a kerneldoc
comment. Remove it.
Link: https://lore.kernel.org/r/1594627471-235395-3-git-send-email-john.garry@huawei.com
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Luo Jiaxing [Mon, 13 Jul 2020 08:04:30 +0000 (16:04 +0800)]
scsi: hisi_sas: Directly trigger SCSI error handling for completion errors
Abort failed commands in completion path. This avoids having to wait for
block layer timeouts and triggering the SCSI error handling thread.
Link: https://lore.kernel.org/r/1594627471-235395-2-git-send-email-john.garry@huawei.com
Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Stanley Chu [Sun, 12 Jul 2020 00:32:26 +0000 (08:32 +0800)]
scsi: ufs-mediatek: Add inline encryption support
Add inline encryption support to ufs-mediatek.
The standards-compliant parts, such as querying the crypto capabilities and
enabling crypto for individual UFS requests, are already handled by
ufshcd-crypto.c, which itself is wired into the blk-crypto framework.
However MediaTek UFS host requires a vendor-specific hce_enable operation
to allow crypto-related registers being accessed normally in kernel. After
this step, MediaTek UFS host can work as standard-compliant host for
inline-encryption related functions.
Link: https://lore.kernel.org/r/20200712003226.7593-1-stanley.chu@mediatek.com
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dan Carpenter [Mon, 13 Jul 2020 10:51:00 +0000 (10:51 +0000)]
scsi: cxgb4i: Clean up a debug printk
The pr_fmt() at the top of the file already includes the __func__ so we can
remove the duplicative "cxgbi_conn_init_pdu:" from the string here. Now it
all fits on one line as well.
Link: https://lore.kernel.org/r/20200713105100.GA251988@mwanda
Acked-by: Varun Prakash <varun@chelsio.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Xianting Tian [Thu, 9 Jul 2020 15:06:07 +0000 (11:06 -0400)]
scsi: virtio_scsi: Remove unnecessary condition check
kmem_cache_destroy() and mempool_destroy() both correctly handle null
pointer parameters. There is no need to check if the parameter is null
before calling these functions.
Link: https://lore.kernel.org/r/1594307167-8807-1-git-send-email-xianting_tian@126.com
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Xianting Tian <xianting_tian@126.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Colin Ian King [Thu, 9 Jul 2020 13:52:17 +0000 (14:52 +0100)]
scsi: cxgb4i: Fix dereference of pointer tdata before it is null checked
Currently pointer tdata is being dereferenced on the initialization of
pointer skb before tdata is null checked. This could lead to a potential
null pointer dereference. Fix this by dereferencing tdata after tdata has
been null pointer sanity checked.
Link: https://lore.kernel.org/r/20200709135217.1408105-1-colin.king@canonical.com
Fixes:
e33c2482289b ("scsi: cxgb4i: Add support for iSCSI segmentation offload")
Addresses-Coverity: ("Dereference before null check")
Acked-by: Varun Prakash <varun@chelsio.com>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Wei Yongjun [Thu, 9 Jul 2020 11:46:36 +0000 (19:46 +0800)]
scsi: target: Remove unused variable 'tpg'
Gcc reports warning as follows:
drivers/target/target_core_pr.c:1162:26: warning:
variable 'tpg' set but not used [-Wunused-but-set-variable]
1162 | struct se_portal_group *tpg;
| ^~~
After commit
63c9ffe473d3 ("scsi: target: Check enforce_pr_isids during
registration"), 'tpg' is never used. Remove it to avoid build warning.
Link: https://lore.kernel.org/r/20200709114636.69256-1-weiyongjun1@huawei.com
Reported-by: Hulk Robot <hulkci@huawei.com>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Stanley Chu [Mon, 6 Jul 2020 06:07:07 +0000 (14:07 +0800)]
scsi: ufs: Fix and simplify setup_xfer_req variant operation
Add missing setup_xfer_req() call in ufshcd_issue_devman_upiu_cmd() in
ufs-bsg path. Relocate existing setup_xfer_req() calls to a common place,
i.e., ufshcd_send_command(), to simplify the driver.
Link: https://lore.kernel.org/r/20200706060707.32608-3-stanley.chu@mediatek.com
Acked-by: Avri Altman <Avri.Altman@wdc.com>
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Stanley Chu [Mon, 6 Jul 2020 06:07:06 +0000 (14:07 +0800)]
scsi: ufs: Simplify completion timestamp for SCSI and query commands
Simplify recording command completion time in __ufshcd_transfer_req_compl()
by assigning lrbp->compl_time_stamp in a unified location.
Link: https://lore.kernel.org/r/20200706060707.32608-2-stanley.chu@mediatek.com
Acked-by: Avri Altman <Avri.Altman@wdc.com>
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Varun Prakash [Wed, 1 Jul 2020 16:47:12 +0000 (22:17 +0530)]
scsi: target: cxgbit: Remove tx flow control code
Firmware does tx flow control so remove tx flow control code from the
driver.
Signed-off-by: Varun Prakash <varun@chelsio.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Varun Prakash [Wed, 1 Jul 2020 16:46:10 +0000 (22:16 +0530)]
scsi: target: cxgbit: Check connection state before issuing hardware command
Current code does not check connection state before issuing
header/data digest offload and DDP page size setup hardware command.
Add a connection state check to issue hardware command only
if connection is in established state.
Signed-off-by: Varun Prakash <varun@chelsio.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Varun Prakash [Mon, 29 Jun 2020 16:41:11 +0000 (22:11 +0530)]
scsi: cxgb4i: Add support for iSCSI segmentation offload
T5/T6 adapters support iSCSI segmentation offload.
To transmit iSCSI PDUs using ISO driver provides iSCSI header and data
scatterlist to the adapter, adapter forms multiple iSCSI PDUs and transmits
them.
[mkp: checkpatch]
Link: https://lore.kernel.org/r/1593448871-2972-1-git-send-email-varun@chelsio.com
Signed-off-by: Varun Prakash <varun@chelsio.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Andres Beltran [Mon, 6 Jul 2020 16:09:28 +0000 (12:09 -0400)]
scsi: storvsc: Add validation for untrusted Hyper-V values
For additional robustness in the face of Hyper-V errors or malicious
behavior, validate all values that originate from packets that Hyper-V has
sent to the guest. Ensure that invalid values cannot cause data being
copied out of the bounds of the source buffer when calling memcpy. Ensure
that outgoing packets do not have any leftover guest memory that has not
been zeroed out.
Link: https://lore.kernel.org/r/20200706160928.53049-1-lkmlabelt@gmail.com
Cc: James E.J. Bottomley <jejb@linux.ibm.com>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Signed-off-by: Andres Beltran <lkmlabelt@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Randy Dunlap [Tue, 7 Jul 2020 18:04:11 +0000 (11:04 -0700)]
scsi: advansys: docs: Eliminate duplicated word
Drop the doubled word "be".
Link: https://lore.kernel.org/r/20200707180414.10467-18-rdunlap@infradead.org
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: linux-doc@vger.kernel.org
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Hannes Reinecke <hare@suse.com>
Cc: linux-scsi@vger.kernel.org
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dick Kennedy [Mon, 6 Jul 2020 20:42:46 +0000 (13:42 -0700)]
scsi: lpfc: Fix less-than-zero comparison of unsigned value
The expression start_idx - dbg_cnt is evaluated using unsigned int
arthithmetic (since these variables are unsigned ints) and hence can never
be less than zero, so the less than comparison is never true. Rewrite the
expression to check for start_idx being less than dbg_cnt.
After the logic was corrected, temp_idx wasn't working correctly. So fix it
as well.
Link: https://lore.kernel.org/r/20200706204246.130416-1-jsmart2021@gmail.com
Fixes:
372c187b8a70 ("scsi: lpfc: Add an internal trace log buffer")
CC: Colin Ian King <colin.king@canonical.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>
Addresses-Coverity: ("Unsigned compared against 0")
Dick Kennedy [Mon, 6 Jul 2020 20:42:30 +0000 (13:42 -0700)]
scsi: lpfc: Fix interrupt assignments when multiple vectors are supported on same CPU
With certain platforms its possible pci_alloc_irq_vectors() may affinitize
irq vectors to multiple (all?) CPUs. The driver is currently assuming
exclusivity and vectors being doled out to different CPUs and is assigning
primary ownership of each vector to the first CPU in the mask. The code
doesn't bother to check if the CPU already owns a vector and will
unconditionally overwrite the CPU to vector mapping. This causes the
relationships between eq's and cq's to get confused and gets worse when
CPUs start to offline. The net results are interrupts are skipped resulting
in mailbox timeouts and there are oopses in CPU offling flows.
Fix this changing up the primary vector assignment. Now assign the eq to a
CPU only if it is the CPU in the mask that does not have a prior
assignment. And once the primary ownership is assigned, break from the
loop. For CPUs that may have been set before but not the primary owner, the
lpfc_cpu_affinity_check() routine will balance the CPU to eq assignment.
Link: https://lore.kernel.org/r/20200706204230.130363-1-jsmart2021@gmail.com
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Satya Tangirala [Mon, 6 Jul 2020 20:04:14 +0000 (20:04 +0000)]
scsi: ufs: Add inline encryption support to UFS
Wire up ufshcd.c with the UFS Crypto API, the block layer inline encryption
additions and the keyslot manager.
Many existing inline crypto devices require some additional behaviour not
specified in the UFSHCI v2.1 specification - as such the vendor specific
drivers will need to be updated where necessary to make it possible to use
those devices. Some of these changes have already been proposed upstream,
such as for the Qualcomm 845 SoC at
https://lkml.kernel.org/linux-scsi/
20200501045111.665881-1-ebiggers@kernel.org/
and for ufs-mediatek at
https://lkml.kernel.org/linux-scsi/
20200304022101.14165-1-stanley.chu@mediatek.com/
This patch has been tested on the db845c, sm8150-mtp and sm8250-mtp
(which have Qualcomm chipsets) and on some mediatek chipsets using these
aforementioned vendor specific driver updates.
Link: https://lore.kernel.org/r/20200706200414.2027450-4-satyat@google.com
Reviewed-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Satya Tangirala <satyat@google.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Satya Tangirala [Mon, 6 Jul 2020 20:04:13 +0000 (20:04 +0000)]
scsi: ufs: UFS crypto API
Introduce functions to manipulate UFS inline encryption hardware in line
with the JEDEC UFSHCI v2.1 specification and to work with the block keyslot
manager.
The UFS crypto API will assume by default that a vendor driver doesn't
support UFS crypto, even if the hardware advertises the capability, because
a lot of hardware requires some special handling that's not specified in
the aforementioned JEDEC spec. Each vendor driver must explicitly set
hba->caps |= UFSHCD_CAP_CRYPTO before ufshcd_hba_init_crypto_capabilities()
is called to opt-in to UFS crypto support.
Link: https://lore.kernel.org/r/20200706200414.2027450-3-satyat@google.com
Reviewed-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Satya Tangirala <satyat@google.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Satya Tangirala [Mon, 6 Jul 2020 20:04:12 +0000 (20:04 +0000)]
scsi: ufs: UFS driver v2.1 spec crypto additions
Add the crypto registers and structs defined in v2.1 of the JEDEC UFSHCI
specification in preparation to add support for inline encryption to UFS.
Link: https://lore.kernel.org/r/20200706200414.2027450-2-satyat@google.com
Reviewed-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Satya Tangirala <satyat@google.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Colin Ian King [Tue, 7 Jul 2020 15:00:18 +0000 (16:00 +0100)]
scsi: lpfc: Fix inconsistent indenting
Fix smatch warning:
drivers/scsi/lpfc/lpfc_sli.c:15156 lpfc_cq_poll_hdler() warn:
inconsistent indenting
Link: https://lore.kernel.org/r/20200707150018.823350-1-colin.king@canonical.com
Reviewed-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Lee Jones [Tue, 7 Jul 2020 14:00:54 +0000 (15:00 +0100)]
scsi: libfc: fc_disc: Fix-up some incorrectly referenced function parameters
Fixes the following W=1 kernel build warning(s):
drivers/scsi/libfc/fc_disc.c:343: warning: Function parameter or member 'disc' not described in 'fc_disc_gpn_ft_req'
drivers/scsi/libfc/fc_disc.c:343: warning: Excess function parameter 'lport' description in 'fc_disc_gpn_ft_req'
drivers/scsi/libfc/fc_disc.c:380: warning: Function parameter or member 'disc' not described in 'fc_disc_gpn_ft_parse'
drivers/scsi/libfc/fc_disc.c:380: warning: Excess function parameter 'lport' description in 'fc_disc_gpn_ft_parse'
drivers/scsi/libfc/fc_disc.c:498: warning: Function parameter or member 'disc_arg' not described in 'fc_disc_gpn_ft_resp'
drivers/scsi/libfc/fc_disc.c:498: warning: Excess function parameter 'lp_arg' description in 'fc_disc_gpn_ft_resp'
Link: https://lore.kernel.org/r/20200707140055.2956235-10-lee.jones@linaro.org
Cc: Hannes Reinecke <hare@suse.de>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Lee Jones [Tue, 7 Jul 2020 14:00:53 +0000 (15:00 +0100)]
scsi: pcmcia: nsp_cs: Remove unused variable 'dummy'
There is no need to populate an unused variable, even if the read is
required.
Fixes the following W=1 kernel build warning(s):
drivers/scsi/pcmcia/nsp_cs.c: In function ‘nsp_cs_message’:
drivers/scsi/pcmcia/nsp_cs.c:143:2: warning: function ‘nsp_cs_message’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
drivers/scsi/pcmcia/nsp_cs.c: In function ‘nsp_fifo_count’:
drivers/scsi/pcmcia/nsp_cs.c:692:24: warning: variable ‘dummy’ set but not used [-Wunused-but-set-variable]
Link: https://lore.kernel.org/r/20200707140055.2956235-9-lee.jones@linaro.org
Cc: YOKOTA Hiroshi <yokota@netlab.is.tsukuba.ac.jp>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Lee Jones [Tue, 7 Jul 2020 14:00:52 +0000 (15:00 +0100)]
scsi: pcmcia: nsp_cs: Use new __printf() format notation
Fixes the following W=1 kernel build warning(s):
drivers/scsi/pcmcia/nsp_cs.c: In function ‘nsp_cs_message’:
drivers/scsi/pcmcia/nsp_cs.c:143:2: warning: function ‘nsp_cs_message’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
drivers/scsi/pcmcia/nsp_cs.c: In function ‘nsp_fifo_count’:
drivers/scsi/pcmcia/nsp_cs.c:692:24: warning: variable ‘dummy’ set but not used [-Wunused-but-set-variable]
Link: https://lore.kernel.org/r/20200707140055.2956235-8-lee.jones@linaro.org
Cc: YOKOTA Hiroshi <yokota@netlab.is.tsukuba.ac.jp>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Lee Jones [Tue, 7 Jul 2020 14:00:51 +0000 (15:00 +0100)]
scsi: aha152x: Remove unused variable 'ret'
Looks to be unused since 2014.
Fixes the following W=1 kernel build warning(s):
drivers/scsi/aha152x.c: In function ‘datai_run’:
drivers/scsi/aha152x.c:2033:9: warning: variable ‘data’ set but not used [-Wunused-but-set-variable]
2033 | int data;
| ^~~~
Link: https://lore.kernel.org/r/20200707140055.2956235-7-lee.jones@linaro.org
Cc: "Juergen E. Fischer" <fischer@norbit.de>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Lee Jones [Tue, 7 Jul 2020 14:00:48 +0000 (15:00 +0100)]
scsi: fdomain: Mark 'fdomain_pm_ops' as __maybe_unused
Not all source files which include 'fdomain.h' make use of 'fdomain_pm_ops'
leaving them defined but unused. Mark it as __maybe_unused to tell the
compiler this is not only acceptable, but expected.
Fixes the following W=1 kernel build warning(s):
In file included from drivers/scsi/pcmcia/fdomain_cs.c:16:
drivers/scsi/fdomain.h:106:32: warning: ‘fdomain_pm_ops’ defined but not used [-Wunused-const-variable=]
106 | static const struct dev_pm_ops fdomain_pm_ops;
| ^~~~~~~~~~~~~~
Link: https://lore.kernel.org/r/20200707140055.2956235-4-lee.jones@linaro.org
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Bean Huo [Mon, 6 Jul 2020 12:39:36 +0000 (14:39 +0200)]
scsi: ufs: Change upiu_flags to be u8
According to the UFS Spec, the Flags field in the UPIU is one byte in size,
not 4. Change it to be u8.
Link: https://lore.kernel.org/r/20200706123936.24799-1-huobean@gmail.com
Tested-by: Alim Akhtar <alim.akhtar@samsung.com>
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Damien Le Moal [Mon, 6 Jul 2020 12:33:58 +0000 (21:33 +0900)]
scsi: mpt3sas: Fix kdoc comments format
Fix kdoc comments format to avoid compiler warnings when compiling with
W=1.
No functional changes.
Link: https://lore.kernel.org/r/20200706123358.452180-1-damien.lemoal@wdc.com
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Damien Le Moal [Mon, 6 Jul 2020 12:33:56 +0000 (21:33 +0900)]
scsi: mpt3sas: Fix set but unused variable
In _config_request(), the variable issue_reset is set using the macro
mpt3sas_check_cmd_timeout() but otherwise unused, causing a compiler
warning when compiling with W=1. Avoid this warning by removing this
variable, using the function mpt3sas_base_check_cmd_timeout() directly
instead of the mpt3sas_check_cmd_timeout() macro.
Link: https://lore.kernel.org/r/20200706123356.452135-1-damien.lemoal@wdc.com
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Damien Le Moal [Mon, 6 Jul 2020 12:33:55 +0000 (21:33 +0900)]
scsi: sd_zbc: Fix kdoc comment format
Fix the kdoc comment of the function sd_zbc_check_capacity() to avoid a
compiler warning when compiling with W=1.
No functional changes.
Link: https://lore.kernel.org/r/20200706123355.452091-1-damien.lemoal@wdc.com
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Damien Le Moal [Mon, 6 Jul 2020 12:33:54 +0000 (21:33 +0900)]
scsi: sd: Fix kdoc comment format
Fix the kdoc comment of the function sd_ioctl_common() to avoid a compiler
warning when compiling with W=1.
No functional changes.
Link: https://lore.kernel.org/r/20200706123354.452047-1-damien.lemoal@wdc.com
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Damien Le Moal [Mon, 6 Jul 2020 12:33:52 +0000 (21:33 +0900)]
scsi: megaraid: Remove set but unused variable
In mega_is_bios_enabled(), the variable ret is set but unused. Remove it to
avoid a compiler warning.
Link: https://lore.kernel.org/r/20200706123352.452003-1-damien.lemoal@wdc.com
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Damien Le Moal [Mon, 6 Jul 2020 12:33:51 +0000 (21:33 +0900)]
scsi: megaraid: Fix set but unused variable
In megadev_ioctl(), if MEGA_HAVE_STATS is not defined, the variables
num_ldrv and ustats are unused. Conditionally define them to avoid compiler
warnings.
Link: https://lore.kernel.org/r/20200706123351.451959-1-damien.lemoal@wdc.com
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Damien Le Moal [Mon, 6 Jul 2020 12:33:49 +0000 (21:33 +0900)]
scsi: megaraid: Remove set but unused variable
In mega_build_cmd(), the variable epthru is set but not used. Remove it to
avoid a compiler warning.
Link: https://lore.kernel.org/r/20200706123349.451915-1-damien.lemoal@wdc.com
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Damien Le Moal [Mon, 6 Jul 2020 12:33:48 +0000 (21:33 +0900)]
scsi: megaraid: Remove set but unused variable
The variable remainder is unused in mega_div64_32(). Remove it to avoid a
compiler warning. While at it, also fix the function documentation
comments.
Link: https://lore.kernel.org/r/20200706123348.451871-1-damien.lemoal@wdc.com
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Damien Le Moal [Mon, 6 Jul 2020 12:33:46 +0000 (21:33 +0900)]
scsi: megaraid: Fix compilation warnings
Move function declarations to megaraid_sas.h to avoid warnings such as:
warning: no previous prototype for ‘xxx'
No functional changes.
Link: https://lore.kernel.org/r/20200706123346.451827-1-damien.lemoal@wdc.com
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Damien Le Moal [Mon, 6 Jul 2020 12:33:45 +0000 (21:33 +0900)]
scsi: megaraid: Fix kdoc comments format
Fix kernel documentation comments to avoid various warnings when compiling
with W=1.
No functional changes.
Link: https://lore.kernel.org/r/20200706123345.451783-1-damien.lemoal@wdc.com
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Julian Wiedmann [Fri, 3 Jul 2020 13:20:03 +0000 (15:20 +0200)]
scsi: zfcp: Avoid benign overflow of the Request Queue's free-level
zfcp_qdio_send() and zfcp_qdio_int_req() run concurrently, adding and
completing SBALs on the Request Queue. There's a theoretical race where
zfcp_qdio_int_req() completes a number of SBALs & increments the queue's
free-level _before_ zfcp_qdio_send() was able to decrement it.
This can cause ->req_q_free to momentarily hold a value larger than
QDIO_MAX_BUFFERS_PER_Q. Luckily zfcp_qdio_send() is always called under
->req_q_lock, and all readers of the free-level also take this lock. So we
can trust that zfcp_qdio_send() will clean up such a temporary overflow
before anyone can actually observe it.
But it's still confusing and annoying to worry about. So adjust the code to
avoid this race.
Link: https://lore.kernel.org/r/7f61f59a1f8db270312e64644f9173b8f1ac895f.1593780621.git.bblock@linux.ibm.com
Reviewed-by: Steffen Maier <maier@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>
Julian Wiedmann [Fri, 3 Jul 2020 13:20:02 +0000 (15:20 +0200)]
scsi: zfcp: Replace open-coded list move
Instead of manually moving each element of the unit and port lists into our
temporary on-stack lists, splice them over in one go.
Link: https://lore.kernel.org/r/cacb179f49ece50fd4dce119c61252d632cdc1d4.1593780621.git.bblock@linux.ibm.com
Reviewed-by: Steffen Maier <maier@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>
Julian Wiedmann [Fri, 3 Jul 2020 13:20:01 +0000 (15:20 +0200)]
scsi: zfcp: Clean up zfcp_erp_action_ready()
We already maintain a pointer to act->adapter. Use it consistently to avoid
any confusion about whose ->erp_ready_head and ->erp_ready_wq we are
accessing.
Link: https://lore.kernel.org/r/d1bb04322f240dee32f4c4a551bc93bc736f4b01.1593780621.git.bblock@linux.ibm.com
Reviewed-by: Steffen Maier <maier@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>
Benjamin Block [Fri, 3 Jul 2020 13:20:00 +0000 (15:20 +0200)]
scsi: docs: Remove invalid link and update text for zfcp kernel config
IBM decided to retire a lot of the content that was previously hosted on
"developerworks", and so some of the links we've used for documentation are
now dead or redirect to some general landing page with no correlation to
what the links were meant to provide.
Change the provided link in the Kconfig file for zfcp to rather refer to
our device drivers book that we regularly update and publish for free, and
whose name hasn't been changed since it was first published.
Our hardware is also not called "IBM eServer zSeries" anymore - in fact, it
hasn't been called like that since 2006. Use a broader term that covers
different server names over time.
Lastly, add a short paragraph about how our HBAs are typically named, to
have some more tangible references.
Link: https://lore.kernel.org/r/96069b9f4c4f056a515b37e89b2bdfccc282e3d3.1593780621.git.bblock@linux.ibm.com
Reviewed-by: Julian Wiedmann <jwi@linux.ibm.com>
Reviewed-by: Steffen Maier <maier@linux.ibm.com>
Signed-off-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Benjamin Block [Fri, 3 Jul 2020 13:19:59 +0000 (15:19 +0200)]
scsi: docs: Update outdated link to IBM developerworks
IBM decided to retire a lot of the content that was previously hosted on
"developerworks", and so some of the links we've used for documentation are
now dead or redirect to some general landing page with no correlation to
what the links were meant to provide.
The s390-tools package is meanwhile also hosted on github, so we can link
to the script directly instead of to the archive.
Link: https://lore.kernel.org/r/9ab0341d6ddca46cfc885e4cd9dc38f535969b02.1593780621.git.bblock@linux.ibm.com
Reviewed-by: Julian Wiedmann <jwi@linux.ibm.com>
Reviewed-by: Steffen Maier <maier@linux.ibm.com>
Signed-off-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Julian Wiedmann [Fri, 3 Jul 2020 13:19:58 +0000 (15:19 +0200)]
scsi: zfcp: Fix an outdated comment for zfcp_qdio_send()
zfcp no longer uses the qdio PCI flag, update the comment.
Link: https://lore.kernel.org/r/6717c26fc986bff8776d110e27c199b523684c63.1593780621.git.bblock@linux.ibm.com
Fixes:
21ddaa53f92d ("[SCSI] zfcp: Remove PCI flag")
Reviewed-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Fedor Loshakov <loshakov@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>
George Spelvin [Fri, 3 Jul 2020 13:19:57 +0000 (15:19 +0200)]
scsi: zfcp: Use prandom_u32_max() for backoff
We don't need crypto-grade random numbers for randomized backoffs. Instead
use prandom_u32_max(ep_ro) which generates a pseudo-random number uniformly
distributed in the interval [0, ep_ro).
Link: https://lore.kernel.org/r/8fc7c4c4069ff1783f4a9ccd84a923f581a09ec5.1593780621.git.bblock@linux.ibm.com
Reviewed-by: Steffen Maier <maier@linux.ibm.com>
Signed-off-by: George Spelvin <lkml@sdf.org>
Signed-off-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Bob Liu [Fri, 3 Jul 2020 05:16:03 +0000 (13:16 +0800)]
scsi: iscsi: Register sysfs for workqueue iscsi_destroy
Register sysfs for workqueue iscsi_destroy so that users can set CPU
affinity through "cpumask" for this workqueue to get better isolation in
cloud multi-tenant scenario.
This patch unfolded create_singlethread_workqueue(), added WQ_SYSFS and
drop __WQ_ORDERED_EXPLICIT since __WQ_ORDERED_EXPLICIT workqueue isn't
allowed to change "cpumask".
Link: https://lore.kernel.org/r/20200703051603.1473-1-bob.liu@oracle.com
Suggested-by: Mike Christie <michael.christie@oracle.com>
Reviewed-by: Lee Duncan <lduncan@suse.com>
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Bob Liu <bob.liu@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Mike Christie [Thu, 2 Jul 2020 01:43:23 +0000 (20:43 -0500)]
scsi: target: Handle short iSIDs
SPC4 has:
The first ISCSI INITIATOR SESSION ID field byte containing an ASCII null
character terminates the ISCSI INITIATOR SESSION ID field without regard
for the specified length of the iSCSI TransportID or the contents of the
ADDITIONAL LENGTH field.
----------------------------------------
which sounds like we can get an iSID shorter than 12 chars. SPC and the
iSCSI RFC do not say how to handle that case other than just cutting off
the iSID. This patch just makes sure that if we get an iSID like that, we
only copy/send that string.
There is no OS that does this right now, so there was no test case. I did
test with sg utils to check it works as expected and nothing breaks.
Link: https://lore.kernel.org/r/1593654203-12442-8-git-send-email-michael.christie@oracle.com
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Mike Christie [Thu, 2 Jul 2020 01:43:22 +0000 (20:43 -0500)]
scsi: target: Fix iscsi transport id buf len calculation
The isid returned to the initiator is in string format which is 12
bytes. We also only add 1 terminating NULL and not one after the initiator
name and another one after the isid.
Link: https://lore.kernel.org/r/1593654203-12442-7-git-send-email-michael.christie@oracle.com
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Mike Christie [Thu, 2 Jul 2020 01:43:21 +0000 (20:43 -0500)]
scsi: target: Fix iscsi transport id buffer setup
This fixes the following bugs with the transport id setup for iscsi:
1. Incorrectly adding NULL after initiator name for TPID format 1.
2. For TPID format 1 buffer setup we are doing off+len, off++ and then
also len+=some_value. This results in the isid going past buffer
boundaries when we then do buf[off+len]
3. The pr_reg_isid is the isid in string format which is 12 bytes, but we
are only copying 6 bytes.
Link: https://lore.kernel.org/r/1593654203-12442-6-git-send-email-michael.christie@oracle.com
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Mike Christie [Thu, 2 Jul 2020 01:43:20 +0000 (20:43 -0500)]
scsi: target: Fix iscsi transport id parsing
The length passed in the ADDITIONAL LENGTH field includes padding and the
terminating NULL for the last field (name or isid depending on the format),
so we should not also try to calculate that and then double add that to the
returned length.
Link: https://lore.kernel.org/r/1593654203-12442-5-git-send-email-michael.christie@oracle.com
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Mike Christie [Thu, 2 Jul 2020 01:43:19 +0000 (20:43 -0500)]
scsi: target: Fix crash during SPEC_I_PT handling
__core_scsi3_add_registration clears the t10_pr_registration pr_reg_deve
and does a core_scsi3_lunacl_undepend_item which does an undepend and also
does a kref_put from the get done in __core_scsi3_alloc_registration. So
when we get to the bottom of core_scsi3_decode_spec_i_port the pr_reg_deve
is NULL and we crash when trying to access the local_pr_reg's pr_reg_deve.
We've also done an extra undepend for local_pr_reg and if we didn't crash
on the NULL we would have done an extra kref_put too.
This patch has us do a core_scsi3_lunacl_depend_item for local_pr_reg and
then let __core_scsi3_add_registration handle the cleanup for the
pr_reg_deve. We then just skip the undepend for the acl and tpg for the
local pr_reg.
The error path then works in a similar way, but we always do the
core_scsi3_lunacl_undepend_item since we never call
__core_scsi3_add_registration in that code path.
Link: https://lore.kernel.org/r/1593654203-12442-4-git-send-email-michael.christie@oracle.com
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Mike Christie [Thu, 2 Jul 2020 01:43:18 +0000 (20:43 -0500)]
scsi: target: Fix xcopy sess release leak
transport_init_session can allocate memory via percpu_ref_init, and
target_xcopy_release_pt never frees it. This adds a
transport_uninit_session function to handle cleanup of resources allocated
in the init function.
Link: https://lore.kernel.org/r/1593654203-12442-3-git-send-email-michael.christie@oracle.com
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Mike Christie [Thu, 2 Jul 2020 01:43:17 +0000 (20:43 -0500)]
scsi: target: Check enforce_pr_isids during registration
Move the check for enforce_pr_isids to the registration code where we can
fail at the time an initiator tries to register a path without an isid. In
its current place in __core_scsi3_locate_pr_reg, it is too late because it
can be registered and be reported in PR in commands and it is stuck in this
state because we cannot unregister it.
[mkp: applied by hand]
Link: https://lore.kernel.org/r/1593654203-12442-2-git-send-email-michael.christie@oracle.com
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Lee Duncan <lduncan@suse.com>
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Christophe JAILLET [Fri, 26 Jun 2020 04:05:53 +0000 (06:05 +0200)]
scsi: eesox: Fix different dev_id between request_irq() and free_irq()
The dev_id used in request_irq() and free_irq() should match. Use 'info' in
both cases.
Link: https://lore.kernel.org/r/20200626040553.944352-1-christophe.jaillet@wanadoo.fr
Fixes:
1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Christophe JAILLET [Fri, 26 Jun 2020 03:59:48 +0000 (05:59 +0200)]
scsi: powertec: Fix different dev_id between request_irq() and free_irq()
The dev_id used in request_irq() and free_irq() should match. Use 'info' in
both cases.
Link: https://lore.kernel.org/r/20200626035948.944148-1-christophe.jaillet@wanadoo.fr
Fixes:
1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Douglas Gilbert [Thu, 2 Jul 2020 14:53:55 +0000 (10:53 -0400)]
scsi: scsi_debug: Fix in_use bitmap corruption
Heavy testing indicates the irqsave() spinlock around the __set_bit() is
insufficient to stop following clear_bit() calls being rarely applied
out-of-order. Also the nearby failed kzalloc() path leading to
SCSI_MLQUEUE_HOST_BUSY does not properly undo the in_use bitmap and
num_in_q, fix.
Link: https://lore.kernel.org/r/20200702145355.522283-1-dgilbert@interlog.com
Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Mike Christie [Wed, 1 Jul 2020 19:47:48 +0000 (14:47 -0500)]
scsi: iscsi: Remove sessdestroylist
Just delete the sess from the session list instead of adding it to some
list we never use.
Link: https://lore.kernel.org/r/1593632868-6808-4-git-send-email-michael.christie@oracle.com
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Mike Christie [Wed, 1 Jul 2020 19:47:47 +0000 (14:47 -0500)]
scsi: iscsi: Optimize work queue flush use
There is no need for one session to flush the entire iscsi_eh_timer_workq
when removing/unblocking a session. During removal we need to make sure our
works are not running anymore. And iscsi_unblock_session only needs to make
sure its work is done. The unblock work function will flush/cancel the
works it has conflicts with.
Link: https://lore.kernel.org/r/1593632868-6808-3-git-send-email-michael.christie@oracle.com
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Mike Christie [Wed, 1 Jul 2020 19:47:46 +0000 (14:47 -0500)]
scsi: iscsi: Delay freeing target_id
If we are doing async removal of the session, we could be doing a
scsi_remove_target from the removal workqueue, and for the offload case we
could be doing a new session addition and scan to the same host. The
add/scan might then end up trying to use the target_id of the target we are
removing.
This patch just has a delay the freeing of the target_id until after the
scsi_remove_target has completed, so we know it's no longer in use.
Link: https://lore.kernel.org/r/1593632868-6808-2-git-send-email-michael.christie@oracle.com
Reviewed-by: Lee Duncan <lduncan@suse.com>
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Bob Liu [Wed, 1 Jul 2020 03:07:45 +0000 (11:07 +0800)]
scsi: core: Register sysfs for SCSI workqueue
Permit scsi_wq_xxx and scsi_tmf_xxx to be bound to different CPUs to get
better isolation.
Use alloc_workqueue with WQ_SYSFS and drop __WQ_ORDERED_EXPLICIT since a
__WQ_ORDERED_EXPLICIT workqueue isn't allowed to change the CPU mask.
Link: https://lore.kernel.org/r/20200701030745.16897-2-bob.liu@oracle.com
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Bob Liu <bob.liu@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dick Kennedy [Tue, 30 Jun 2020 21:50:01 +0000 (14:50 -0700)]
scsi: lpfc: Update lpfc version to 12.8.0.2
Update lpfc version to 12.8.0.2
Link: https://lore.kernel.org/r/20200630215001.70793-15-jsmart2021@gmail.com
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dick Kennedy [Tue, 30 Jun 2020 21:50:00 +0000 (14:50 -0700)]
scsi: lpfc: Add an internal trace log buffer
The current logging methods typically end up requesting a reproduction with
a different logging level set to figure out what happened. This was mainly
by design to not clutter the kernel log messages with things that were
typically not interesting and the messages themselves could cause other
issues.
When looking to make a better system, it was seen that in many cases when
more data was wanted was when another message, usually at KERN_ERR level,
was logged. And in most cases, what the additional logging that was then
enabled was typically. Most of these areas fell into the discovery machine.
Based on this summary, the following design has been put in place: The
driver will maintain an internal log (256 elements of 256 bytes). The
"additional logging" messages that are usually enabled in a reproduction
will be changed to now log all the time to the internal log. A new logging
level is defined - LOG_TRACE_EVENT. When this level is set (it is not by
default) and a message marked as KERN_ERR is logged, all the messages in
the internal log will be dumped to the kernel log before the KERN_ERR
message is logged.
There is a timestamp on each message added to the internal log. However,
this timestamp is not converted to wall time when logged. The value of the
timestamp is solely to give a crude time reference for the messages.
Link: https://lore.kernel.org/r/20200630215001.70793-14-jsmart2021@gmail.com
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dick Kennedy [Tue, 30 Jun 2020 21:49:59 +0000 (14:49 -0700)]
scsi: lpfc: Add blk_io_poll support for latency improvment
Although the existing implementation is very good at high I/O load, on
tests involving light load, especially on only a few hardware queues,
latency was a little higher than it can be due to using workqueue
scheduling. Other tasks in the system can delay handling.
Change the lower level to use irq_poll by default which uses a softirq for
I/O completion. This gives better latency as variance in when the cq is
processed is reduced over the workqueue interface. However, as high load is
better served by not being in softirq when the CPU is loaded, work queues
are still used under high I/O load.
Link: https://lore.kernel.org/r/20200630215001.70793-13-jsmart2021@gmail.com
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dick Kennedy [Tue, 30 Jun 2020 21:49:58 +0000 (14:49 -0700)]
scsi: lpfc: Add support to display if adapter dumps are available
Currently, if there has been an issue whereby an adapter dump was taken,
there is nothing displayed to hint that it is present. Utilities must be
run and they must query for the status in order to then download the dump.
Add a message to the driver to query dump image presence when initializing
the SLI Port.
Link: https://lore.kernel.org/r/20200630215001.70793-12-jsmart2021@gmail.com
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dick Kennedy [Tue, 30 Jun 2020 21:49:57 +0000 (14:49 -0700)]
scsi: lpfc: Allow applications to issue Common Set Features mailbox command
Currently the driver validates command codes received from the
application. COMMON_SET_FEATURES is not currently being approved.
Add definition of the missing command and allow it to be issued by
applications.
Link: https://lore.kernel.org/r/20200630215001.70793-11-jsmart2021@gmail.com
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dick Kennedy [Tue, 30 Jun 2020 21:49:56 +0000 (14:49 -0700)]
scsi: lpfc: Fix language in 0373 message to reflect non-error message
Change vocabulary of 0373 log msg from "error" to "cmpl" The current
language of the 0373 message contains the word "error" which caused a
number of customers to inquire about the "error" and if it should be a
concern. It isn't an error, it's simply an io completion status.
Revise the message to replace the word "error" with "cmpl" for completion.
Link: https://lore.kernel.org/r/20200630215001.70793-10-jsmart2021@gmail.com
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dick Kennedy [Tue, 30 Jun 2020 21:49:55 +0000 (14:49 -0700)]
scsi: lpfc: Fix kdump hang on PPC
When the kdump kernel shuts down lpfc calls flush_work_queue on an
interrupt to schedule the cq handler. When there is only one CPU active on
the kdump kernel, it is possible for the work_on to get scheduled on a
non-active CPU causing it to never be scheduled.
When in the kdump environment, per-CPU affinity of cq's to cpus is not
necessary. In those cases, use a general queue_work rather than a
queue_work_on().
Link: https://lore.kernel.org/r/20200630215001.70793-9-jsmart2021@gmail.com
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dick Kennedy [Tue, 30 Jun 2020 21:49:54 +0000 (14:49 -0700)]
scsi: lpfc: Fix shost refcount mismatch when deleting vport
When vports are deleted, it is observed that there is memory/kthread
leakage as the vport isn't fully being released.
There is a shost reference taken in scsi_add_host_dma that is not released
during scsi_remove_host. It was noticed that other drivers resolve this by
doing a scsi_host_put after calling scsi_remove_host.
The vport_delete routine is taking two references one that corresponds to
an access to the scsi_host in the vport_delete routine and another that is
released after the adapter mailbox command completes that destroys the VPI
that corresponds to the vport.
Remove one of the references taken such that the second reference that is
put will complete the missing scsi_add_host_dma reference and the shost
will be terminated.
Link: https://lore.kernel.org/r/20200630215001.70793-8-jsmart2021@gmail.com
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dick Kennedy [Tue, 30 Jun 2020 21:49:53 +0000 (14:49 -0700)]
scsi: lpfc: Fix stack trace seen while setting rrq active
Call traces have been observed running different tests that involve aborts
and setting the rrq active flag. The lpfc_set_rrq_active routine is doing
a mempool_alloc under the soft_irq processing level. When the mempool needs
to get a new buffer from the free pool and has to wait for memory to become
free it will check the flags passed in on the alloc and dump the stack if
the thread is running in interrupt context.
Replace the GFP_KERNEL flag with GFP_ATOMIC so that the memory allocation
will not attempt to sleep if there is no mem available.
Link: https://lore.kernel.org/r/20200630215001.70793-7-jsmart2021@gmail.com
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dick Kennedy [Tue, 30 Jun 2020 21:49:52 +0000 (14:49 -0700)]
scsi: lpfc: Fix oops due to overrun when reading SLI3 data
When using DUMP on SLI3 to read VPD and Port status data (config region
23), the adapter is overruning the kmalloc'd buffer causing havoc on other
consumers of the allocation pools.
Rework the loops processing the dump data and validate/size memory lengths
before performing bcopy.
Link: https://lore.kernel.org/r/20200630215001.70793-6-jsmart2021@gmail.com
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dick Kennedy [Tue, 30 Jun 2020 21:49:51 +0000 (14:49 -0700)]
scsi: lpfc: Fix NVMe rport deregister and registration during ADISC
During driver unload/reload testing, the NVMe initiator would not
re-establish connectivity to NVMe controllers on reload.
The failing NVMe array supports concurrent FCP and NVMe operation via
different nport_id's. The array was repeatedly sending an ADISC every 2
seconds after PLOGI completed and while NVMe subsystems were executing
discovery. The target would continue this state for roughly 45 seconds.
The driver's current behavior on ADISC receipt is to validate a the ADISC
vs the device and issue a RESUME_RPI to restore transmission. The receipt
of the ADISC effectively caused a driver to take actions similar to a
logout and login for the remote port, causing the deregistration of the
nvme rport and a subsequent re-registration. This caused a constant reset
and re-connect of the NVMe controller while this 45s window occurred. There
was no need for the state changes as ADISC does not change login state.
This patch corrects this behavior by validating if the remoteport is
already logged in (MAPPED) and when true, avoids the call to set the ndlp
state to MAPPED, which triggers the unreg/re-reg. Thus ADISC does not
change the login state of the node.
Link: https://lore.kernel.org/r/20200630215001.70793-5-jsmart2021@gmail.com
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dick Kennedy [Tue, 30 Jun 2020 21:49:49 +0000 (14:49 -0700)]
scsi: lpfc: Fix missing MDS functionality
Visual code inspection of the MDS implementation revealed two errors in
the driver:
- The set features Feature Code had an incorrect value
- The routine that classifies command type for cmd completions was missing
the Send Frame definition. Send Frame is used for MDS driver loopback.
Link: https://lore.kernel.org/r/20200630215001.70793-3-jsmart2021@gmail.com
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dick Kennedy [Tue, 30 Jun 2020 21:49:48 +0000 (14:49 -0700)]
scsi: lpfc: Fix unused assignment in lpfc_sli4_bsg_link_diag_test
Coverity reported the following error:
Assigned value that is never used may represent unnecessary computation.
The rc variable was initially assigned a value but in several cases, when
an error case is detected, it is reassigned a new value. The initial value
had little use.
In code-reviewing this routine, it could use some cleanup:
- Setting the initialization value to -ENODEV is a much better choice and
lessens code in the routine.
- The wasn't tracking logic errors vs no error and mailbox failure.
Better to resolve by adding a status to track the mailbox failure
and merge it with the logic error when the routine returns.
Link: https://lore.kernel.org/r/20200630215001.70793-2-jsmart2021@gmail.com
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Shyam Sundar [Tue, 30 Jun 2020 10:22:29 +0000 (03:22 -0700)]
scsi: qla2xxx: SAN congestion management implementation
* Firmware Initialization with SCM enabled based on NVRAM setting and
firmware support (About Firmware).
* Enable PUREX and add support for fabric performance impact
notification (FPIN) handling.
* Allocate a default PUREX item for each vha to handle memory allocation
failures in ISR.
Link: https://lore.kernel.org/r/20200630102229.29660-3-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Shyam Sundar <ssundar@marvell.com>
Signed-off-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Shyam Sundar [Tue, 30 Jun 2020 10:22:28 +0000 (03:22 -0700)]
scsi: qla2xxx: Change in PUREX to handle FPIN ELS requests
SAN Congestion Management generates ELS pkts whose size can vary and be >
64 bytes. Change the PUREX handling code to support non-standard ELS pkt
size.
Link: https://lore.kernel.org/r/20200630102229.29660-2-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Shyam Sundar <ssundar@marvell.com>
Signed-off-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Bart Van Assche [Mon, 29 Jun 2020 22:54:54 +0000 (15:54 -0700)]
scsi: qla2xxx: Introduce a function for computing the debug message prefix
Instead of repeating the code for generating a debug message prefix six
times, introduce a function for computing the debug message prefix.
Link: https://lore.kernel.org/r/20200629225454.22863-10-bvanassche@acm.org
Cc: Nilesh Javali <njavali@marvell.com>
Cc: Quinn Tran <qutran@marvell.com>
Cc: Himanshu Madhani <himanshu.madhani@oracle.com>
Cc: Martin Wilck <mwilck@suse.com>
Cc: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Bart Van Assche [Mon, 29 Jun 2020 22:54:53 +0000 (15:54 -0700)]
scsi: qla2xxx: Make qla2x00_restart_isp() easier to read
Instead of using complicated control flow to only have one return statement
at the end of qla2x00_restart_isp(), return an error status as soon as it
is known that this function will fail.
Link: https://lore.kernel.org/r/20200629225454.22863-9-bvanassche@acm.org
Cc: Nilesh Javali <njavali@marvell.com>
Cc: Quinn Tran <qutran@marvell.com>
Cc: Himanshu Madhani <himanshu.madhani@oracle.com>
Cc: Martin Wilck <mwilck@suse.com>
Cc: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Bart Van Assche [Mon, 29 Jun 2020 22:54:52 +0000 (15:54 -0700)]
scsi: qla2xxx: Fix a Coverity complaint in qla2100_fw_dump()
'cnt' can exceed the size of the risc_ram[] array. Prevent that Coverity
complains by rewriting an address calculation expression. This patch fixes
the following Coverity complaint:
CID 337803 (#1 of 1): Out-of-bounds read (OVERRUN)
109. overrun-local: Overrunning array of 122880 bytes at byte offset 122880
by dereferencing pointer &fw->risc_ram[cnt].
Link: https://lore.kernel.org/r/20200629225454.22863-8-bvanassche@acm.org
Cc: Nilesh Javali <njavali@marvell.com>
Cc: Quinn Tran <qutran@marvell.com>
Cc: Himanshu Madhani <himanshu.madhani@oracle.com>
Cc: Martin Wilck <mwilck@suse.com>
Cc: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Bart Van Assche [Mon, 29 Jun 2020 22:54:51 +0000 (15:54 -0700)]
scsi: qla2xxx: Make __qla2x00_alloc_iocbs() initialize 32 bits of request_t.handle
The request_t 'handle' member is 32-bits wide, hence use wrt_reg_dword().
Change the cast in the wrt_reg_byte() call to make it clear that a regular
pointer is casted to an __iomem pointer.
Note: 'pkt' points to I/O memory for the qlafx00 adapter family and to
coherent memory for all other adapter families.
This patch fixes the following Coverity complaint:
CID 358864 (#1 of 1): Reliance on integer endianness (INCOMPATIBLE_CAST)
incompatible_cast: Pointer &pkt->handle points to an object whose effective
type is unsigned int (32 bits, unsigned) but is dereferenced as a narrower
unsigned short (16 bits, unsigned). This may lead to unexpected results
depending on machine endianness.
Link: https://lore.kernel.org/r/20200629225454.22863-7-bvanassche@acm.org
Fixes:
8ae6d9c7eb10 ("[SCSI] qla2xxx: Enhancements to support ISPFx00.")
Cc: Nilesh Javali <njavali@marvell.com>
Cc: Quinn Tran <qutran@marvell.com>
Cc: Himanshu Madhani <himanshu.madhani@oracle.com>
Cc: Martin Wilck <mwilck@suse.com>
Cc: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Bart Van Assche [Mon, 29 Jun 2020 22:54:50 +0000 (15:54 -0700)]
scsi: qla2xxx: Remove a superfluous cast
Remove an unnecessary cast because it prevents the compiler to perform type
checking.
Link: https://lore.kernel.org/r/20200629225454.22863-6-bvanassche@acm.org
Cc: Nilesh Javali <njavali@marvell.com>
Cc: Quinn Tran <qutran@marvell.com>
Cc: Himanshu Madhani <himanshu.madhani@oracle.com>
Cc: Martin Wilck <mwilck@suse.com>
Cc: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Shyam Sundar <ssundar@marvell.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Bart Van Assche [Mon, 29 Jun 2020 22:54:49 +0000 (15:54 -0700)]
scsi: qla2xxx: Initialize 'n' before using it
The following code:
qla82xx_rom_fast_read(ha, 0, &n)
only initializes 'n' if it succeeds. Since 'n' may be reported in a debug
message even if no ROM reads succeeded, initialize 'n' to zero.
This patch fixes the following sparse warning:
qla_nx.c:1218: qla82xx_pinit_from_rom() error: uninitialized symbol 'n'.
Link: https://lore.kernel.org/r/20200629225454.22863-5-bvanassche@acm.org
Cc: Nilesh Javali <njavali@marvell.com>
Cc: Quinn Tran <qutran@marvell.com>
Cc: Himanshu Madhani <himanshu.madhani@oracle.com>
Cc: Martin Wilck <mwilck@suse.com>
Cc: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Shyam Sundar <ssundar@marvell.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Bart Van Assche [Mon, 29 Jun 2020 22:54:48 +0000 (15:54 -0700)]
scsi: qla2xxx: Make qla82xx_flash_wait_write_finish() easier to read
Return early instead of having a single return statement at the end of this
function. This patch fixes the following sparse warning:
qla_nx.c:1018: qla82xx_flash_wait_write_finish() error: uninitialized symbol 'val'.
Link: https://lore.kernel.org/r/20200629225454.22863-4-bvanassche@acm.org
Cc: Nilesh Javali <njavali@marvell.com>
Cc: Quinn Tran <qutran@marvell.com>
Cc: Himanshu Madhani <himanshu.madhani@oracle.com>
Cc: Martin Wilck <mwilck@suse.com>
Cc: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Bart Van Assche [Mon, 29 Jun 2020 22:54:47 +0000 (15:54 -0700)]
scsi: qla2xxx: Remove the __packed annotation from struct fcp_hdr and fcp_hdr_le
Remove the __packed annotation from struct fcp_hdr* because that annotation
is not necessary for these data structures.
Link: https://lore.kernel.org/r/20200629225454.22863-3-bvanassche@acm.org
Cc: Nilesh Javali <njavali@marvell.com>
Cc: Quinn Tran <qutran@marvell.com>
Cc: Himanshu Madhani <himanshu.madhani@oracle.com>
Cc: Martin Wilck <mwilck@suse.com>
Cc: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Bart Van Assche [Mon, 29 Jun 2020 22:54:46 +0000 (15:54 -0700)]
scsi: qla2xxx: Check the size of struct fcp_hdr at compile time
Since struct fcp_hdr is used to exchange data with the firmware, check its
size at compile time.
Link: https://lore.kernel.org/r/20200629225454.22863-2-bvanassche@acm.org
Cc: Nilesh Javali <njavali@marvell.com>
Cc: Quinn Tran <qutran@marvell.com>
Cc: Himanshu Madhani <himanshu.madhani@oracle.com>
Cc: Martin Wilck <mwilck@suse.com>
Cc: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Bodo Stroesser [Mon, 29 Jun 2020 09:37:56 +0000 (11:37 +0200)]
scsi: target: tcmu: Fix crash on ARM during cmd completion
If tcmu_handle_completions() has to process a padding shorter than
sizeof(struct tcmu_cmd_entry), the current call to
tcmu_flush_dcache_range() with sizeof(struct tcmu_cmd_entry) as length
param is wrong and causes crashes on e.g. ARM, because
tcmu_flush_dcache_range() in this case calls
flush_dcache_page(vmalloc_to_page(start)); with start being an invalid
address above the end of the vmalloc'ed area.
The fix is to use the minimum of remaining ring space and sizeof(struct
tcmu_cmd_entry) as the length param.
The patch was tested on kernel 4.19.118.
See https://bugzilla.kernel.org/show_bug.cgi?id=208045#c10
Link: https://lore.kernel.org/r/20200629093756.8947-1-bstroesser@ts.fujitsu.com
Tested-by: JiangYu <lnsyyj@hotmail.com>
Acked-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Bodo Stroesser <bstroesser@ts.fujitsu.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Dan Carpenter [Fri, 26 Jun 2020 10:51:33 +0000 (13:51 +0300)]
scsi: ufs: ufs-exynos: Remove an unnecessary NULL check
The "head" pointer can't be NULL because it points to an address in the
middle of a ufs_hba struct. Looking at this code, probably someone would
wonder if the intent was to check whether "hba" is NULL, but "hba" isn't
NULL and the check can just be removed.
Link: https://lore.kernel.org/r/20200626105133.GF314359@mwanda
Acked-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Flavio Suligoi [Wed, 24 Jun 2020 13:56:00 +0000 (15:56 +0200)]
scsi: storvsc: Fix spelling mistake
Fix typo: "trigerred" --> "triggered"
Link: https://lore.kernel.org/r/20200624135600.14274-1-f.suligoi@asem.it
Signed-off-by: Flavio Suligoi <f.suligoi@asem.it>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Stanley Chu [Thu, 25 Jun 2020 03:04:30 +0000 (11:04 +0800)]
scsi: ufs: Disable WriteBooster capability for non-supported UFS devices
If a UFS device is not qualified to use WriteBooster, either due to wrong
UFS version or device-specific quirks, then the capability in host shall be
disabled to prevent any WriteBooster operations in the future.
Link: https://lore.kernel.org/r/20200625030430.25048-1-stanley.chu@mediatek.com
Fixes:
3d17b9b5ab11 ("scsi: ufs: Add write booster feature support")
Tested-by: Steev Klimaszewski <steev@kali.org>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Reviewed-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Javed Hasan [Mon, 22 Jun 2020 09:38:14 +0000 (02:38 -0700)]
scsi: bnx2fc: Removal of unused variables
Removed all the unused variables.
Link: https://lore.kernel.org/r/20200622093814.3250-1-jhasan@marvell.com
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Javed Hasan <jhasan@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Christophe JAILLET [Thu, 25 Jun 2020 20:47:30 +0000 (22:47 +0200)]
scsi: cumana_2: Fix different dev_id between request_irq() and free_irq()
The dev_id used in request_irq() and free_irq() should match. Use 'info'
in both cases.
Link: https://lore.kernel.org/r/20200625204730.943520-1-christophe.jaillet@wanadoo.fr
Fixes:
1da177e4c3f4 ("Linux-2.6.12-rc2")
Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Alim Akhtar [Thu, 25 Jun 2020 15:44:05 +0000 (21:14 +0530)]
scsi: ufs: ufs-exynos: Fix build warning
While building for x86_64 allmodconfig, the following warning was reported:
WARNING: modpost: missing MODULE_LICENSE() in drivers/scsi/ufs/ufs-exynos.o
Add the missing license/author/description tags.
Link: https://lore.kernel.org/r/20200625154405.60448-1-alim.akhtar@samsung.com
Fixes:
55f4b1f73631 ("scsi: ufs: ufs-exynos: Add UFS host support for Exynos SoCs")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Wei Yongjun [Thu, 18 Jun 2020 13:38:37 +0000 (13:38 +0000)]
scsi: ufs: ufs-exynos: Fix return value check in exynos_ufs_init()
In case of error, the function devm_ioremap_resource() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check should be
replaced with IS_ERR().
Link: https://lore.kernel.org/r/20200618133837.127274-1-weiyongjun1@huawei.com
Fixes:
55f4b1f73631 ("scsi: ufs: ufs-exynos: Add UFS host support for Exynos SoCs")
Reported-by: Hulk Robot <hulkci@huawei.com>
Acked-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Alim Akhtar [Sat, 20 Jun 2020 17:32:32 +0000 (23:02 +0530)]
scsi: ufs: Allow exynos ufs driver to build as module
Allow Exynos UFS driver to build as a module. This patch fixes the
followin build issue reported by kernel build robot.
drivers/scsi/ufs/ufs-exynos.o: in function `exynos_ufs_probe':
drivers/scsi/ufs/ufs-exynos.c:1231: undefined reference to `ufshcd_pltfrm_init'
drivers/scsi/ufs/ufs-exynos.o: in function `exynos_ufs_pre_pwr_mode':
drivers/scsi/ufs/ufs-exynos.c:635: undefined reference to `ufshcd_get_pwr_dev_param'
drivers/scsi/ufs/ufs-exynos.o:undefined reference to `ufshcd_pltfrm_shutdown'
drivers/scsi/ufs/ufs-exynos.o:undefined reference to `ufshcd_pltfrm_suspend'
drivers/scsi/ufs/ufs-exynos.o:undefined reference to `ufshcd_pltfrm_resume'
drivers/scsi/ufs/ufs-exynos.o:undefined reference to `ufshcd_pltfrm_runtime_suspend'
drivers/scsi/ufs/ufs-exynos.o:undefined reference to `ufshcd_pltfrm_runtime_resume'
drivers/scsi/ufs/ufs-exynos.o:undefined reference to `ufshcd_pltfrm_runtime_idle'
Link: https://lore.kernel.org/r/20200620173232.52521-1-alim.akhtar@samsung.com
Fixes:
55f4b1f73631 ("scsi: ufs: ufs-exynos: Add UFS host support for Exynos SoCs")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Bodo Stroesser [Thu, 18 Jun 2020 13:16:32 +0000 (15:16 +0200)]
scsi: target: tcmu: Fix crash in tcmu_flush_dcache_range on ARM
This patch fixes the following crash (see
https://bugzilla.kernel.org/show_bug.cgi?id=208045)
Process iscsi_trx (pid: 7496, stack limit = 0x0000000010dd111a)
CPU: 0 PID: 7496 Comm: iscsi_trx Not tainted 4.19.118-0419118-generic
#
202004230533
Hardware name: Greatwall QingTian DF720/F601, BIOS
601FBE20 Sep 26 2019
pstate:
80400005 (Nzcv daif +PAN -UAO)
pc : flush_dcache_page+0x18/0x40
lr : is_ring_space_avail+0x68/0x2f8 [target_core_user]
sp :
ffff000015123a80
x29:
ffff000015123a80 x28:
0000000000000000
x27:
0000000000001000 x26:
ffff000023ea5000
x25:
ffffcfa25bbe08b8 x24:
0000000000000078
x23:
ffff7e0000000000 x22:
ffff000023ea5001
x21:
ffffcfa24b79c000 x20:
0000000000000fff
x19:
ffff7e00008fa940 x18:
0000000000000000
x17:
0000000000000000 x16:
ffff2d047e709138
x15:
0000000000000000 x14:
0000000000000000
x13:
0000000000000000 x12:
ffff2d047fbd0a40
x11:
0000000000000000 x10:
0000000000000030
x9 :
0000000000000000 x8 :
ffffc9a254820a00
x7 :
00000000000013b0 x6 :
000000000000003f
x5 :
0000000000000040 x4 :
ffffcfa25bbe08e8
x3 :
0000000000001000 x2 :
0000000000000078
x1 :
ffffcfa25bbe08b8 x0 :
ffff2d040bc88a18
Call trace:
flush_dcache_page+0x18/0x40
is_ring_space_avail+0x68/0x2f8 [target_core_user]
queue_cmd_ring+0x1f8/0x680 [target_core_user]
tcmu_queue_cmd+0xe4/0x158 [target_core_user]
__target_execute_cmd+0x30/0xf0 [target_core_mod]
target_execute_cmd+0x294/0x390 [target_core_mod]
transport_generic_new_cmd+0x1e8/0x358 [target_core_mod]
transport_handle_cdb_direct+0x50/0xb0 [target_core_mod]
iscsit_execute_cmd+0x2b4/0x350 [iscsi_target_mod]
iscsit_sequence_cmd+0xd8/0x1d8 [iscsi_target_mod]
iscsit_process_scsi_cmd+0xac/0xf8 [iscsi_target_mod]
iscsit_get_rx_pdu+0x404/0xd00 [iscsi_target_mod]
iscsi_target_rx_thread+0xb8/0x130 [iscsi_target_mod]
kthread+0x130/0x138
ret_from_fork+0x10/0x18
Code:
f9000bf3 aa0003f3 aa1e03e0 d503201f (
f9400260)
---[ end trace
1e451c73f4266776 ]---
The solution is based on patch:
"scsi: target: tcmu: Optimize use of flush_dcache_page"
which restricts the use of tcmu_flush_dcache_range() to addresses from
vmalloc'ed areas only.
This patch now replaces the virt_to_page() call in
tcmu_flush_dcache_range() - which is wrong for vmalloced addrs - by
vmalloc_to_page().
The patch was tested on ARM with kernel 4.19.118 and 5.7.2
Link: https://lore.kernel.org/r/20200618131632.32748-3-bstroesser@ts.fujitsu.com
Tested-by: JiangYu <lnsyyj@hotmail.com>
Tested-by: Daniel Meyerholt <dxm523@gmail.com>
Acked-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Bodo Stroesser <bstroesser@ts.fujitsu.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Bodo Stroesser [Thu, 18 Jun 2020 13:16:31 +0000 (15:16 +0200)]
scsi: target: tcmu: Optimize use of flush_dcache_page
(scatter|gather)_data_area() need to flush dcache after writing data to or
before reading data from a page in uio data area. The two routines are
able to handle data transfer to/from such a page in fragments and flush the
cache after each fragment was copied by calling the wrapper
tcmu_flush_dcache_range().
That means:
1) flush_dcache_page() can be called multiple times for the same page.
2) Calling flush_dcache_page() indirectly using the wrapper does not make
sense, because each call of the wrapper is for one single page only and
the calling routine already has the correct page pointer.
Change (scatter|gather)_data_area() such that, instead of calling
tcmu_flush_dcache_range() before/after each memcpy, it now calls
flush_dcache_page() before unmapping a page (when writing is complete for
that page) or after mapping a page (when starting to read the page).
After this change only calls to tcmu_flush_dcache_range() for addresses in
vmalloc'ed command ring are left over.
The patch was tested on ARM with kernel 4.19.118 and 5.7.2
Link: https://lore.kernel.org/r/20200618131632.32748-2-bstroesser@ts.fujitsu.com
Tested-by: JiangYu <lnsyyj@hotmail.com>
Tested-by: Daniel Meyerholt <dxm523@gmail.com>
Acked-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Bodo Stroesser <bstroesser@ts.fujitsu.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Asutosh Das [Tue, 9 Jun 2020 17:17:46 +0000 (10:17 -0700)]
scsi: ufs: docs: Add WriteBooster documentation
Adds sysfs documentation for WriteBooster entries.
Link: https://lore.kernel.org/r/1591723067-22998-1-git-send-email-asutoshd@codeaurora.org
Acked-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Bean Huo [Fri, 19 Jun 2020 15:41:17 +0000 (17:41 +0200)]
scsi: core: Fix formatting errors in scsi_lib.c
Delete trailing whitespace, multiple blank lines, and make switch/case be
at the same indentation.
Link: https://lore.kernel.org/r/20200619154117.10262-3-huobean@gmail.com
Signed-off-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Bean Huo [Fri, 19 Jun 2020 15:41:16 +0000 (17:41 +0200)]
scsi: core: Remove scsi_sdb_cache
After commit
f664a3cc17b7 ("scsi: kill off the legacy IO path"),
scsi_sdb_cache is not used anymore. Remove it.
Link: https://lore.kernel.org/r/20200619154117.10262-2-huobean@gmail.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>