platform/kernel/linux-starfive.git
5 years agoscsi: fnic: Use vzalloc
Sabyasachi Gupta [Wed, 14 Nov 2018 16:54:21 +0000 (22:24 +0530)]
scsi: fnic: Use vzalloc

Replaced vmalloc + memset with vzalloc

Signed-off-by: Sabyasachi Gupta <sabyasachi.linux@gmail.com>
Acked-by: Sesidhar Baddela <sebaddel@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target/core: Reduce the amount of code executed with a spinlock held
Bart Van Assche [Tue, 27 Nov 2018 23:52:04 +0000 (15:52 -0800)]
scsi: target/core: Reduce the amount of code executed with a spinlock held

Due to the "make ABORT and LUN RESET handling synchronous" patch, cmd->work
is only modified from the regular command execution path and no longer
asynchronously by the code that executes task management functions. Since
the regular command execution code is sequential per command, no locking is
required to manipulate cmd->work. Hence stop protecting cmd->work
manipulations with locking.

Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: David Disseldorp <ddiss@suse.de>
Cc: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target/core: Make ABORT and LUN RESET handling synchronous
Bart Van Assche [Tue, 27 Nov 2018 23:52:03 +0000 (15:52 -0800)]
scsi: target/core: Make ABORT and LUN RESET handling synchronous

Instead of invoking target driver callback functions from the context that
handles an abort or LUN RESET task management function, only set the abort
flag from that context and perform the actual abort handling from the
context of the regular command processing flow. This approach has the
advantage that the task management code becomes much easier to read and to
verify since the number of potential race conditions against the command
processing flow is strongly reduced.

This patch has been tested by running the following two shell commands
concurrently for about ten minutes for both the iSCSI and the SRP target
drivers ($dev is an initiator device node connected with storage provided
by the target driver under test):

 * fio with data verification enabled on a filesystem mounted on top of
   $dev.

 * while true; do sg_reset -d $dev; echo -n .; sleep .1; done

Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: David Disseldorp <ddiss@suse.de>
Cc: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target/core: Fix TAS handling for aborted commands
Bart Van Assche [Tue, 27 Nov 2018 23:52:02 +0000 (15:52 -0800)]
scsi: target/core: Fix TAS handling for aborted commands

The TASK ABORTED STATUS (TAS) bit is defined as follows in SAM:
"TASK_ABORTED: this status shall be returned if a command is aborted by a
command or task management function on another I_T nexus and the control
mode page TAS bit is set to one". TAS handling is spread over the target
core and the iSCSI target driver. If a LUN RESET is received, the target
core will send the TASK_ABORTED response for all commands for which such a
response has to be sent. If an ABORT TASK is received, only the iSCSI
target driver will send the TASK_ABORTED response for the commands for
which that response has to be sent.  That is a bug since all target drivers
have to honor the TAS bit. Fix this by moving the code that handles TAS
from the iSCSI target driver into the target core. Additionally, if a
command has been aborted, instead of sending the TASK_ABORTED status from
the context that processes the SCSI command send it from the context of the
ABORT TMF.  The core_tmr_abort_task() change in this patch causes the
CMD_T_TAS flag to be set if a TASK_ABORTED status has to be sent back to
the initiator that submitted the command. If that flag has been set
transport_cmd_finish_abort() will send the TASK_ABORTED response.

Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: David Disseldorp <ddiss@suse.de>
Cc: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target/core: Simplify the code for aborting SCSI commands
Bart Van Assche [Tue, 27 Nov 2018 23:52:01 +0000 (15:52 -0800)]
scsi: target/core: Simplify the code for aborting SCSI commands

Instead of allowing the code that aborts a SCSI command to finish before
all iSCSI data frames have been received, make that code wait until all
iSCSI data frames have been received. Introduce a new member variable in
the target driver template to communicate that information from the iSCSI
target driver to the target core. This change allows to leave out the check
whether or not it is already safe to send the TASK_ABORTED reply from
transport_send_task_abort().

Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: David Disseldorp <ddiss@suse.de>
Cc: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target/core: Make it possible to wait from more than one context for command...
Bart Van Assche [Tue, 27 Nov 2018 23:52:00 +0000 (15:52 -0800)]
scsi: target/core: Make it possible to wait from more than one context for command completion

This patch does not change any functionality but makes the patch that makes
TMF handling synchronous easier to read.

Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: David Disseldorp <ddiss@suse.de>
Cc: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target/core: Use system workqueues for TMF
Bart Van Assche [Tue, 27 Nov 2018 23:51:59 +0000 (15:51 -0800)]
scsi: target/core: Use system workqueues for TMF

A quote from SAM-5: "The order in which task management requests are
processed is not specified by the SCSI architecture model.  The SCSI
architecture model does not require in-order delivery of such task
management requests or processing by the task manager in the order
received. To guarantee the processing order of task management requests
referencing sent to a specific logical unit, an application client should
not have more than one such task management request pending to that logical
unit." This means that it is safe to use the system workqueues instead of
tmr_wq for processing TMFs. An intended side effect of this patch is that
it enables concurrent processing of TMFs.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Mike Christie <mchristi@redhat.com>
Cc: David Disseldorp <ddiss@suse.de>
Cc: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target/core: Make sure that target_wait_for_sess_cmds() waits long enough
Bart Van Assche [Tue, 27 Nov 2018 23:51:58 +0000 (15:51 -0800)]
scsi: target/core: Make sure that target_wait_for_sess_cmds() waits long enough

A session must only be released after all code that accesses the session
structure has finished. Make sure that this is the case by introducing a
new command counter per session that is only decremented after the
.release_cmd() callback has finished. This patch fixes the following crash:

BUG: KASAN: use-after-free in do_raw_spin_lock+0x1c/0x130
Read of size 4 at addr ffff8801534b16e4 by task rmdir/14805
CPU: 16 PID: 14805 Comm: rmdir Not tainted 4.18.0-rc2-dbg+ #5
Call Trace:
dump_stack+0xa4/0xf5
print_address_description+0x6f/0x270
kasan_report+0x241/0x360
__asan_load4+0x78/0x80
do_raw_spin_lock+0x1c/0x130
_raw_spin_lock_irqsave+0x52/0x60
srpt_set_ch_state+0x27/0x70 [ib_srpt]
srpt_disconnect_ch+0x1b/0xc0 [ib_srpt]
srpt_close_session+0xa8/0x260 [ib_srpt]
target_shutdown_sessions+0x170/0x180 [target_core_mod]
core_tpg_del_initiator_node_acl+0xf3/0x200 [target_core_mod]
target_fabric_nacl_base_release+0x25/0x30 [target_core_mod]
config_item_release+0x9c/0x110 [configfs]
config_item_put+0x26/0x30 [configfs]
configfs_rmdir+0x3b8/0x510 [configfs]
vfs_rmdir+0xb3/0x1e0
do_rmdir+0x262/0x2c0
do_syscall_64+0x77/0x230
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: David Disseldorp <ddiss@suse.de>
Cc: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target/core: Simplify transport_clear_lun_ref()
Bart Van Assche [Tue, 27 Nov 2018 23:51:57 +0000 (15:51 -0800)]
scsi: target/core: Simplify transport_clear_lun_ref()

Since transport_clear_lun_ref() already waits until the percpu-refcount
.release() method is called, it is not necessary to wait first until
percpu_ref_kill_and_confirm() has finished transitioning the refcount into
atomic mode. Remove the code that waits for percpu_ref_kill_and_confirm()
to complete and also the completion object that is used by that code.  This
patch does not change the behavior of the SCSI target code.

Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: David Disseldorp <ddiss@suse.de>
Cc: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target/core: Use kvcalloc() instead of open-coding it
Bart Van Assche [Tue, 27 Nov 2018 23:51:56 +0000 (15:51 -0800)]
scsi: target/core: Use kvcalloc() instead of open-coding it

This patch does not change any functionality. Note: the code that frees
sess_cmd_map already uses kvfree() so that code does not need to be
modified.

Reviewed-by: David Disseldorp <ddiss@suse.de>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target/tcmu: Fix queue_cmd_ring() declaration
Bart Van Assche [Tue, 27 Nov 2018 23:51:55 +0000 (15:51 -0800)]
scsi: target/tcmu: Fix queue_cmd_ring() declaration

This patch does not change any functionality but avoids that sparse
complains about the queue_cmd_ring() function and its callers.

Fixes: 6fd0ce79724d ("tcmu: prep queue_cmd_ring to be used by unmap wq")
Reviewed-by: David Disseldorp <ddiss@suse.de>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: xen-scsifront: mark expected switch fall-through
Gustavo A. R. Silva [Wed, 28 Nov 2018 04:34:35 +0000 (22:34 -0600)]
scsi: xen-scsifront: mark expected switch fall-through

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

Notice that, in this particular case, I replaced "Missed the backend's
Closing state -- fallthrough" with "fall through - Missed the backend's
Closing state", which contains the "fall through" annotation at the
beginnig of the code comment, which is what GCC is expecting to find.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: megaraid_sas_fusion: Mark expected switch fall-through
Gustavo A. R. Silva [Wed, 28 Nov 2018 04:32:34 +0000 (22:32 -0600)]
scsi: megaraid_sas_fusion: Mark expected switch fall-through

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

Notice that, in this particular case, I replaced "Fall thru" with a "Fall
through" annotation and added a dash as a token in order to separate the
"Fall through" annotation from the rest of the comment on the same line,
which is what GCC is expecting to find.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: megaraid: megaraid_sas_base: Mark expected switch fall-through
Gustavo A. R. Silva [Wed, 28 Nov 2018 04:32:27 +0000 (22:32 -0600)]
scsi: megaraid: megaraid_sas_base: Mark expected switch fall-through

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

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: libfc: fc_rport: Mark expected switch fall-through
Gustavo A. R. Silva [Wed, 28 Nov 2018 04:30:55 +0000 (22:30 -0600)]
scsi: libfc: fc_rport: Mark expected switch fall-through

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

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hpsa: mark expected switch fall-throughs
Gustavo A. R. Silva [Wed, 28 Nov 2018 04:29:07 +0000 (22:29 -0600)]
scsi: hpsa: mark expected switch fall-throughs

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

Addresses-Coverity-ID: 1195463 ("Missing break in switch")
Addresses-Coverity-ID: 1195464 ("Missing break in switch")
Addresses-Coverity-ID: 1195465 ("Missing break in switch")
Addresses-Coverity-ID: 1195466 ("Missing break in switch")
Addresses-Coverity-ID: 1357338 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: aacraid: Mark expected switch fall-through
Gustavo A. R. Silva [Wed, 28 Nov 2018 04:26:09 +0000 (22:26 -0600)]
scsi: aacraid: Mark expected switch fall-through

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

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: Dave Carroll <david.carroll@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: aacraid: Mark expected switch fall-throughs
Gustavo A. R. Silva [Wed, 28 Nov 2018 04:25:41 +0000 (22:25 -0600)]
scsi: aacraid: Mark expected switch fall-throughs

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

Also, a break statement is properly aligned.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: Dave Carroll <david.carroll@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: Introduce a switch/case statement in qlt_xmit_tm_rsp()
Bart Van Assche [Tue, 27 Nov 2018 23:04:54 +0000 (15:04 -0800)]
scsi: qla2xxx: Introduce a switch/case statement in qlt_xmit_tm_rsp()

This patch improves code readability but does not change any functionality.

Cc: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: mpt3sas: fix spelling mistake "manufaucturing" -> "manufacturing"
Colin Ian King [Wed, 28 Nov 2018 15:30:48 +0000 (15:30 +0000)]
scsi: mpt3sas: fix spelling mistake "manufaucturing" -> "manufacturing"

There is a spelling mistake in some description text, fix it.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: ufs: add fall through annotation
Tomas Winkler [Mon, 26 Nov 2018 08:10:34 +0000 (10:10 +0200)]
scsi: ufs: add fall through annotation

Add /* fallthrough */ annotation, to eliminate compilation warning:
warning: this statement may fall through [-Wimplicit-fallthrough=]

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qedi: Update driver version to 8.33.0.21
Nilesh Javali [Wed, 21 Nov 2018 09:25:23 +0000 (01:25 -0800)]
scsi: qedi: Update driver version to 8.33.0.21

Signed-off-by: Nilesh Javali <nilesh.javali@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qedi: Move LL2 producer index processing in BH.
Manish Rangankar [Wed, 21 Nov 2018 09:25:22 +0000 (01:25 -0800)]
scsi: qedi: Move LL2 producer index processing in BH.

1. Removed logic to update HW producer index in interrupt context.

2. Update HW producer index after UIO ring and buffer gets initialized.

Signed-off-by: Manish Rangankar <manish.rangankar@cavium.com>
Reviewed-by: Lee Duncan <lduncan@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qedi: add module param to set ping packet size
Nilesh Javali [Wed, 21 Nov 2018 09:25:21 +0000 (01:25 -0800)]
scsi: qedi: add module param to set ping packet size

Default packet size is 0x400. For jumbo packets set to 0x2400.

Signed-off-by: Nilesh Javali <nilesh.javali@cavium.com>
Reviewed-by: Lee Duncan <lduncan@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qedi: Add packet filter in light L2 Rx path.
Manish Rangankar [Wed, 21 Nov 2018 09:25:20 +0000 (01:25 -0800)]
scsi: qedi: Add packet filter in light L2 Rx path.

Add packet filter to avoid unnecessary packet processing in iscsiuio.

Signed-off-by: Manish Rangankar <manish.rangankar@cavium.com>
Reviewed-by: Lee Duncan <lduncan@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qedi: Check for session online before getting iSCSI TLV data.
Manish Rangankar [Wed, 21 Nov 2018 09:25:19 +0000 (01:25 -0800)]
scsi: qedi: Check for session online before getting iSCSI TLV data.

The kernel panic was observed after switch side perturbation,

BUG: unable to handle kernel NULL pointer dereference at (null)
     IP: [<ffffffff8132b5a0>] strcmp+0x20/0x40
     PGD 0 Oops: 0000 [#1] SMP
CPU: 8 PID: 647 Comm: kworker/8:1 Tainted: G        W  OE  ------------   3.10.0-693.el7.x86_64 #1
Hardware name: HPE ProLiant DL380 Gen10/ProLiant DL380 Gen10, BIOS U30 06/20/2018
Workqueue: slowpath-13:00. qed_slowpath_task [qed]
task: ffff880429eb8fd0 ti: ffff880429190000 task.ti: ffff880429190000
RIP: 0010:[<ffffffff8132b5a0>]  [<ffffffff8132b5a0>] strcmp+0x20/0x40
RSP: 0018:ffff880429193c68  EFLAGS: 00010202
RAX: 000000000000000a RBX: 0000000000000002 RCX: 0000000000000000
RDX: 0000000000000001 RSI: 0000000000000001 RDI: ffff88042bda7a41
RBP: ffff880429193c68 R08: 000000000000ffff R09: 000000000000ffff
R10: 0000000000000007 R11: ffff88042b3af338 R12: ffff880420b007a0
R13: ffff88081aa56af8 R14: 0000000000000001 R15: ffff88081aa50410
FS:  0000000000000000(0000) GS:ffff88042fe00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 00000000019f2000 CR4: 00000000003407e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Stack:
ffff880429193d20 ffffffffc02a0c90 ffffc90004b32000 ffff8803fd3ec600
ffff88042bda7800 ffff88042bda7a00 ffff88042bda7840 ffff88042bda7a40
0000000129193d10 2e3836312e323931 ff000a342e363232 ffffffffc01ad99d
Call Trace:
[<ffffffffc02a0c90>] qedi_get_protocol_tlv_data+0x270/0x470 [qedi]
[<ffffffffc01ad99d>] ? qed_mfw_process_tlv_req+0x24d/0xbf0 [qed]
[<ffffffffc01653ae>] qed_mfw_fill_tlv_data+0x5e/0xd0 [qed]
[<ffffffffc01ad9b9>] qed_mfw_process_tlv_req+0x269/0xbf0 [qed]

Fix kernel NULL pointer deref by checking for session is online before
getting iSCSI TLV data.

Signed-off-by: Manish Rangankar <manish.rangankar@cavium.com>
Reviewed-by: Lee Duncan <lduncan@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qedi: Allocate IRQs based on msix_cnt
Nilesh Javali [Wed, 21 Nov 2018 09:25:18 +0000 (01:25 -0800)]
scsi: qedi: Allocate IRQs based on msix_cnt

The driver load on some systems failed with error,
[0004:01:00.5]:[qedi_request_msix_irq:2524]:8: request_irq failed.

Allocate the IRQs based on MSIX count obtained from qed module instead of
number of queues.

Signed-off-by: Nilesh Javali <nilesh.javali@cavium.com>
Reviewed-by: Lee Duncan <lduncan@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qedi: Replace PAGE_SIZE with QEDI_PAGE_SIZE
Nilesh Javali [Wed, 21 Nov 2018 09:25:17 +0000 (01:25 -0800)]
scsi: qedi: Replace PAGE_SIZE with QEDI_PAGE_SIZE

Use QEDI_PAGE_SIZE for enablement of module on systems with 64K page size.

Signed-off-by: Nilesh Javali <nilesh.javali@cavium.com>
Reviewed-by: Lee Duncan <lduncan@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qedi: Fix spelling mistake "OUSTANDING" -> "OUTSTANDING"
Nilesh Javali [Wed, 21 Nov 2018 09:25:16 +0000 (01:25 -0800)]
scsi: qedi: Fix spelling mistake "OUSTANDING" -> "OUTSTANDING"

Fix trivial spelling mistake within macro definition.

Signed-off-by: Nilesh Javali <nilesh.javali@cavium.com>
Reviewed-by: Lee Duncan <lduncan@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qedi: Cleanup redundant QEDI_PAGE_SIZE macro definition
Nilesh Javali [Wed, 21 Nov 2018 09:25:15 +0000 (01:25 -0800)]
scsi: qedi: Cleanup redundant QEDI_PAGE_SIZE macro definition

Remove redundant macro definition.

Signed-off-by: Nilesh Javali <nilesh.javali@cavium.com>
Reviewed-by: Lee Duncan <lduncan@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target: replace fabric_ops.name with fabric_alias
David Disseldorp [Fri, 23 Nov 2018 17:36:13 +0000 (18:36 +0100)]
scsi: target: replace fabric_ops.name with fabric_alias

iscsi_target_mod is the only LIO fabric where fabric_ops.name differs from
the fabric_ops.fabric_name string.  fabric_ops.name is used when matching
target/$fabric ConfigFS create paths, so rename it .fabric_alias and
fallback to target/$fabric vs .fabric_name comparison if .fabric_alias
isn't initialised.  iscsi_target_mod is the only fabric module to set
.fabric_alias . All other fabric modules rely on .fabric_name matching and
can drop the duplicate string.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target: drop unnecessary get_fabric_name() accessor from fabric_ops
David Disseldorp [Fri, 23 Nov 2018 17:36:12 +0000 (18:36 +0100)]
scsi: target: drop unnecessary get_fabric_name() accessor from fabric_ops

All fabrics return a const string. In all cases *except* iSCSI the
get_fabric_name() string matches fabric_ops.name.

Both fabric_ops.get_fabric_name() and fabric_ops.name are user-facing, with
the former being used for PR/ALUA state and the latter for ConfigFS
(config/target/$name), so we unfortunately need to keep both strings around
for now.  Replace the useless .get_fabric_name() accessor function with a
const string fabric_name member variable.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target: drop unused pi_prot_format attribute storage
David Disseldorp [Fri, 23 Nov 2018 17:36:11 +0000 (18:36 +0100)]
scsi: target: drop unused pi_prot_format attribute storage

On write, the pi_prot_format configfs attribute invokes the device
format_prot() callback if present. Read dumps the contents of
se_dev_attrib.pi_prot_format which is always zero.  Make the configfs
attribute write-only, and drop the always zero se_dev_attrib.pi_prot_format
storage.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: Use dma_zalloc_coherent
Sabyasachi Gupta [Sun, 18 Nov 2018 14:38:48 +0000 (20:08 +0530)]
scsi: lpfc: Use dma_zalloc_coherent

Replaced dma_alloc_coherent + memset with dma_zalloc_coherent.

Signed-off-by: Sabyasachi Gupta <sabyasachi.linux@gmail.com>
Acked-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: bnx2i: remove set but not used variable 'cid_num'
YueHaibing [Mon, 12 Nov 2018 01:54:05 +0000 (01:54 +0000)]
scsi: bnx2i: remove set but not used variable 'cid_num'

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

drivers/scsi/bnx2i/bnx2i_hwi.c: In function 'bnx2i_process_ofld_cmpl':
drivers/scsi/bnx2i/bnx2i_hwi.c:2430:6: warning:
 variable 'cid_num' set but not used [-Wunused-but-set-variable]

It never used since commit
  cf4e6363859d ("[SCSI] bnx2i: Add bnx2i iSCSI driver.")

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: Nilesh Javali <nilesh.javali@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: aha1542: convert to DMA mapping API
Christoph Hellwig [Sat, 10 Nov 2018 08:28:22 +0000 (09:28 +0100)]
scsi: aha1542: convert to DMA mapping API

aha1542 is one of the last users of the legacy isa_*_to_bus APIs, which
also isn't portable enough.  Convert it to the proper DMA mapping API.

Thanks to Ondrej Zary for testing and finding and fixing a crucial bug.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: megaraid_sas: Add support for MegaRAID Aero controllers
Shivasharan S [Fri, 9 Nov 2018 17:47:20 +0000 (09:47 -0800)]
scsi: megaraid_sas: Add support for MegaRAID Aero controllers

This patch adds support for MegaRAID Aero controller PCI IDs.  Print a
message when a configurable secure type controller is encountered.

Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: mpt3sas: Display message on Configurable secure HBA
Sreekanth Reddy [Fri, 9 Nov 2018 09:34:12 +0000 (15:04 +0530)]
scsi: mpt3sas: Display message on Configurable secure HBA

Display following warning message only upon detection of configurable
secure type controllers.

"HBA is in Configurable Secure mode"

[mkp: typos]

Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: libfc: Remove set but not used variable 'disc'
Yue Haibing [Thu, 8 Nov 2018 06:31:21 +0000 (06:31 +0000)]
scsi: libfc: Remove set but not used variable 'disc'

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

drivers/scsi/libfc/fc_rport.c: In function 'fc_rport_recv_flogi_req':
drivers/scsi/libfc/fc_rport.c:866:18: warning:
 variable 'disc' set but not used [-Wunused-but-set-variable]

It no used any more after
commit baa6719f902a ("libfc: Update rport reference counting")

Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
Reviewed-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: target: add emulate_pr backstore attr to toggle PR support
David Disseldorp [Wed, 7 Nov 2018 13:11:07 +0000 (14:11 +0100)]
scsi: target: add emulate_pr backstore attr to toggle PR support

The new emulate_pr backstore attribute allows for Persistent Reservation
and SCSI2 RESERVE/RELEASE support to be completely disabled. This can be
useful for scenarios such as:

- Ensuring ATS (Compare & Write) usage on recent VMware ESXi initiators.

- Allowing clustered (e.g. tcm-user) backends to block such requests,
  avoiding the multi-node reservation state propagation.

When explicitly disabled, PR and RESERVE/RELEASE requests receive Invalid
Command Operation Code response sense data.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Mike Christie <mchristi@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: cxgb4i: fix thermal configuration dependencies
Arnd Bergmann [Fri, 2 Nov 2018 15:35:23 +0000 (16:35 +0100)]
scsi: cxgb4i: fix thermal configuration dependencies

I fixed a bug by adding a dependency in the network driver, but that fix
caused a related bug in the SCSI driver:

WARNING: unmet direct dependencies detected for CHELSIO_T4
  Depends on [m]: NETDEVICES [=y] && ETHERNET [=y] && NET_VENDOR_CHELSIO [=y] && PCI [=y] && (IPV6 [=y] || IPV6 [=y]=n) && (THERMAL [=m] || !THERMAL [=m])
  Selected by [y]:
  - SCSI_CXGB4_ISCSI [=y] && SCSI_LOWLEVEL [=y] && SCSI [=y] && PCI [=y] && INET [=y] && (IPV6 [=y] || IPV6 [=y]=n)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.o: In function `cxgb4_thermal_init':
cxgb4_thermal.c:(.text+0x158): undefined reference to `thermal_zone_device_register'
drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.o: In function `cxgb4_thermal_remove':
cxgb4_thermal.c:(.text+0x1d8): undefined reference to `thermal_zone_device_unregister'
/git/arm-soc/Makefile:1042: recipe for target 'vmlinux' failed

The same dependency needs to be propagated here to make it work correctly
with CONFIG_THERMAL=m and SCSI_CXGB4_ISCSI=y. That change by itself causes
another problem with a circular dependency, as we use 'select NETDEVICES'.
This is something we really should not do anyway, as a driver symbol should
never select another major subsystem, so let's turn that into a 'depends
on'. I don't see any downsides of that, as NETDEVICES is only disabled in
rather obscure cases that are not relevant to the users of cxgb4i.

Fixes: e70a57fa59bb ("cxgb4: fix thermal configuration dependencies")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: aic94xx: Use dma_pool_zalloc
Souptick Joarder [Thu, 1 Nov 2018 04:19:09 +0000 (09:49 +0530)]
scsi: aic94xx: Use dma_pool_zalloc

Replaced dma_pool_alloc + memset with dma_pool_zalloc.

Signed-off-by: Brajeswar Ghosh <brajeswar.linux@gmail.com>
Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: zfcp: drop old default switch case which might paper over missing case
Steffen Maier [Thu, 8 Nov 2018 14:44:58 +0000 (15:44 +0100)]
scsi: zfcp: drop old default switch case which might paper over missing case

This was introduced with v2.6.27 commit 287ac01acf22 ("[SCSI] zfcp: Cleanup
code in zfcp_erp.c") but would now suppress helpful -Wswitch compiler
warnings when building with W=1 such as the following forced example:

drivers/s390/scsi/zfcp_erp.c: In function 'zfcp_erp_setup_act':
drivers/s390/scsi/zfcp_erp.c:220:2: warning: enumeration value 'ZFCP_ERP_ACTION_REOPEN_PORT' not handled in switch [-Wswitch]
  switch (need) {
  ^~~~~~

But then again, only with W=1 we would notice unhandled enum cases.
Without the default cases and a missed unhandled enum case, the code might
perform unforeseen things we might not want...

As of today, we never run through the removed default case, so removing it
is no functional change.  In the future, we never should run through a
default case but introduce the necessary specific case(s) to handle new
functionality.

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: zfcp: drop default switch case which might paper over missing case
Steffen Maier [Thu, 8 Nov 2018 14:44:57 +0000 (15:44 +0100)]
scsi: zfcp: drop default switch case which might paper over missing case

This was introduced with v4.18 commit 8c3d20aada70 ("scsi: zfcp: fix
missing REC trigger trace for all objects in ERP_FAILED") but would now
suppress helpful -Wswitch compiler warnings when building with W=1 such as
the following forced example:

drivers/s390/scsi/zfcp_erp.c: In function 'zfcp_erp_handle_failed':
drivers/s390/scsi/zfcp_erp.c:126:2: warning: enumeration value 'ZFCP_ERP_ACTION_REOPEN_PORT_FORCED' not handled in switch [-Wswitch]
  switch (want) {
  ^~~~~~

But then again, only with W=1 we would notice unhandled enum cases.
Without the default cases and a missed unhandled enum case, the code might
perform unforeseen things we might not want...

As of today, we never run through the removed default case, so removing it
is no functional change.  In the future, we never should run through a
default case but introduce the necessary specific case(s) to handle new
functionality.

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: zfcp: silence -Wimplicit-fallthrough in zfcp_erp_lun_strategy()
Steffen Maier [Thu, 8 Nov 2018 14:44:56 +0000 (15:44 +0100)]
scsi: zfcp: silence -Wimplicit-fallthrough in zfcp_erp_lun_strategy()

For some reason the already existing substring "fall through" in the
comment is not sufficient for GCC to silence -Wimplicit-fallthrough.

  CC [M]  drivers/s390/scsi/zfcp_erp.o
drivers/s390/scsi/zfcp_erp.c: In function 'zfcp_erp_lun_strategy':
drivers/s390/scsi/zfcp_erp.c:1065:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
  if (atomic_read(&zfcp_sdev->status) & ZFCP_STATUS_COMMON_OPEN)
      ^
drivers/s390/scsi/zfcp_erp.c:1068:2: note: here
  case ZFCP_ERP_STEP_LUN_CLOSING:
  ^~~~

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: zfcp: silence remaining kdoc warnings in header files
Steffen Maier [Thu, 8 Nov 2018 14:44:55 +0000 (15:44 +0100)]
scsi: zfcp: silence remaining kdoc warnings in header files

Improve whatever the following simple invocation reported:
$ ./scripts/kernel-doc -none drivers/s390/scsi/*.h

While at it, improve some related kdoc,
including struct zfcp_fsf_ct_els in zfcp_fsf.h.

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: zfcp: silence all W=1 build warnings for existing kdoc
Steffen Maier [Thu, 8 Nov 2018 14:44:54 +0000 (15:44 +0100)]
scsi: zfcp: silence all W=1 build warnings for existing kdoc

While at it also improve some copy & paste kdoc mistakes.

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: zfcp: properly format LUN (and WWPN) for LUN sharing violation kmsg
Steffen Maier [Thu, 8 Nov 2018 14:44:53 +0000 (15:44 +0100)]
scsi: zfcp: properly format LUN (and WWPN) for LUN sharing violation kmsg

zfcp: <devbusid>: LUN 0x0 on port 0x5005076......... ...
zfcp: <devbusid>: LUN 0x1000000000000 on port 0x5005076......... ...

should be

zfcp: <devbusid>: LUN 0x0000000000000000 on port 0x5005076......... ...
zfcp: <devbusid>: LUN 0x0001000000000000 on port 0x5005076.........
                  is already in use by CSS., MIF Image ID .

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: zfcp: use enum zfcp_erp_act_result for argument/return of affected functions
Steffen Maier [Thu, 8 Nov 2018 14:44:52 +0000 (15:44 +0100)]
scsi: zfcp: use enum zfcp_erp_act_result for argument/return of affected functions

With that instead of just "int" it becomes clear which functions return
this type and which ones also accept it as argument they just pass through
in some cases or modify in other cases.  v2.6.27 commit 287ac01acf22
("[SCSI] zfcp: Cleanup code in zfcp_erp.c") introduced the enum which was
cpp defines previously.

Silence some false -Wswitch compiler warning cases with individual
NOP cases. When adding more enum values and building with W=1 we
would get compiler warnings about missed new cases.

Consistently use the variable name "result", so change "retval" in
zfcp_erp_strategy() to "result". This avoids confusion with other compile
unit variables "retval" having different semantics and type.

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: zfcp: use enum zfcp_erp_steps for struct zfcp_erp_action.step
Steffen Maier [Thu, 8 Nov 2018 14:44:51 +0000 (15:44 +0100)]
scsi: zfcp: use enum zfcp_erp_steps for struct zfcp_erp_action.step

Use the already defined enum for this purpose to get at least some build
checking (even though an enum is type equivalent to an int in C).  v2.6.27
commit 287ac01acf22 ("[SCSI] zfcp: Cleanup code in zfcp_erp.c") introduced
the enum which was cpp defines previously.

Since struct zfcp_erp_action type is embedded into other structures living
in zfcp_def.h, we have to move enum zfcp_erp_act_type from its private
definition in zfcp_erp.c to the zfcp-global zfcp_def.h

Silence some false -Wswitch compiler warning cases with individual NOP
cases. When adding more enum values and building with W=1 we would get
compiler warnings about missed new cases.

Add missing break statements in some of the above switch cases.  No
functional change, but making it future-proof.  I think all of these should
have had a break statement ever since, even if these switch cases happened
to be the last ones in the switch statement body.

"Fall through" in the context of switch case usually means not to have a
break and fall through to the subsequent switch case. However, I think this
old comment meant that here we do not have an _early return_ in the switch
case but the code path continues after the switch case body.

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: zfcp: the action field of zfcp_erp_action is actually the type
Steffen Maier [Thu, 8 Nov 2018 14:44:50 +0000 (15:44 +0100)]
scsi: zfcp: the action field of zfcp_erp_action is actually the type

&zfcp_erp_action.action ==> &zfcp_erp_action.type

While at it, make use of the already defined enum for this purpose to get
at least some build checking (even though an enum is type equivalent to an
int in C). v2.6.27 commit 287ac01acf22 ("[SCSI] zfcp: Cleanup code in
zfcp_erp.c") introduced the enum which was cpp defines previously.

To prevent compiler warnings with the switch(act->type), we have to
separate the recently added eyecatchers from enum zfcp_erp_act_type.

Since struct zfcp_erp_action type is embedded into other structures living
in zfcp_def.h, we have to move enum zfcp_erp_act_type from its private
definition in zfcp_erp.c to the zfcp-global zfcp_def.h.

Silence one false -Wswitch compiler warning case: LUNs as the leaves in our
object tree do not have any follow-up success recovery.

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: zfcp: clarify function argument name for trace tag string
Steffen Maier [Thu, 8 Nov 2018 14:44:49 +0000 (15:44 +0100)]
scsi: zfcp: clarify function argument name for trace tag string

v2.6.30 commit 5ffd51a5e495 ("[SCSI] zfcp: replace current ERP logging with
a more convenient version") changed trace record distinguishing from a
numerical ID to a 7 character string called "trace tag". While starting to
use function arguments with different type and semantics, it did not change
the argument name accordingly.

v2.6.38 commit ae0904f60fab ("[SCSI] zfcp: Redesign of the debug tracing
for recovery actions.") renamed variable names "id" into "tag" but only
within zfcp_dbf.*, not within zfcp_erp.c.

This was a bit confusing since the remainder of zfcp does use the term
"trace tag". Also "id" is quite generic and it's not obvious for what.
Just unify it consistently and use the "dbf" prefix to relate the arguments
to the code in zfcp_dbf.*.

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: zfcp: ERP thread setup kdoc update
Steffen Maier [Thu, 8 Nov 2018 14:44:48 +0000 (15:44 +0100)]
scsi: zfcp: ERP thread setup kdoc update

zfcp_erp_thread_setup() update complements v2.6.32 commit 347c6a965dc1
("[SCSI] zfcp: Use kthread API for zfcp erp thread").

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: zfcp: update kernel message for invalid FCP_CMND length, it's not the CDB
Steffen Maier [Thu, 8 Nov 2018 14:44:47 +0000 (15:44 +0100)]
scsi: zfcp: update kernel message for invalid FCP_CMND length, it's not the CDB

The CDB is just a part inside of FCP_CMND, see zfcp_fc_scsi_to_fcp().
While at it, fix the device driver reaction: adapter not LUN shutdown.

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: zfcp: drop duplicate seq_no from zfcp_fsf_req which is also in QTCB header
Steffen Maier [Thu, 8 Nov 2018 14:44:46 +0000 (15:44 +0100)]
scsi: zfcp: drop duplicate seq_no from zfcp_fsf_req which is also in QTCB header

There is no point for double bookkeeping especially just for tracing.  The
trace can take it from the QTCB which always exists for non-SRB responses
traced with zfcp_dbf_hba_fsf_res().

As a side effect, this removes an alignment hole and reduces the size of
struct zfcp_fsf_req, and thus of each pending request, by 8 bytes.

Before:
$ pahole -C zfcp_fsf_req drivers/s390/scsi/zfcp.ko
...
struct fsf_qtcb *          qtcb;                 /*   144     8 */
u32                        seq_no;               /*   152     4 */
/* XXX 4 bytes hole, try to pack */
void *                     data;                 /*   160     8 */
...
/* size: 296, cachelines: 2, members: 14 */
/* sum members: 288, holes: 2, sum holes: 8 */
/* last cacheline: 40 bytes */
After:
$ pahole -C zfcp_fsf_req drivers/s390/scsi/zfcp.ko
...
struct fsf_qtcb *          qtcb;                 /*   144     8 */
void *                     data;                 /*   152     8 */
...
/* size: 288, cachelines: 2, members: 13 */
        /* sum members: 284, holes: 1, sum holes: 4 */

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: zfcp: drop duplicate fsf_command from zfcp_fsf_req which is also in QTCB header
Steffen Maier [Thu, 8 Nov 2018 14:44:45 +0000 (15:44 +0100)]
scsi: zfcp: drop duplicate fsf_command from zfcp_fsf_req which is also in QTCB header

Status read buffers (SRBs, unsolicited notifications) never use a QTCB
[zfcp_fsf_req_create()]. zfcp_fsf_req_send() already uses this to
distinguish SRBs from other FSF request types. We can re-use this method in
zfcp_fsf_req_complete(). Introduce a helper function to make the check for
req->qtcb less magic.

SRBs always are FSF_QTCB_UNSOLICITED_STATUS, so we can hard-code this for
the two trace functions dealing with SRBs.

All other FSF request types have a QTCB and we can get the fsf_command from
there.

zfcp_dbf_hba_fsf_response() and thus zfcp_dbf_hba_fsf_res() are only called
for non-SRB requests so it's safe to dereference the QTCB
[zfcp_fsf_req_complete() returns early on SRB, else calls
zfcp_fsf_protstatus_eval() which calls zfcp_dbf_hba_fsf_response()].  In
zfcp_scsi_forget_cmnd() we guard the QTCB dereference with a preceding NULL
check and rely on boolean shortcut evaluation.

As a side effect, this causes an alignment hole which we can close in
a later patch after having cleaned up all fields of struct zfcp_fsf_req.
Before:
$ pahole -C zfcp_fsf_req drivers/s390/scsi/zfcp.ko
...
u32                        status;               /*   136     4 */
u32                        fsf_command;          /*   140     4 */
struct fsf_qtcb *          qtcb;                 /*   144     8 */
...
After:
$ pahole -C zfcp_fsf_req drivers/s390/scsi/zfcp.ko
...
u32                        status;               /*   136     4 */
/* XXX 4 bytes hole, try to pack */
struct fsf_qtcb *          qtcb;                 /*   144     8 */
...

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: zfcp: drop unnecessary forward prototype for struct zfcp_fsf_req
Steffen Maier [Thu, 8 Nov 2018 14:44:44 +0000 (15:44 +0100)]
scsi: zfcp: drop unnecessary forward prototype for struct zfcp_fsf_req

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: zfcp: group sort internal structure definitions for proximity
Steffen Maier [Thu, 8 Nov 2018 14:44:43 +0000 (15:44 +0100)]
scsi: zfcp: group sort internal structure definitions for proximity

Have structures just before the structures that use them (without
disrupting sequences of using structures such as zfcp_unit and
zfcp_scsi_dev):

 - zfcp_adapter_mempool embedded in zfcp_adapter,

 - zfcp_latenc... embedded in zfcp_scsi_dev.

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: zfcp: namespace prefix for internal latency data structures
Steffen Maier [Thu, 8 Nov 2018 14:44:42 +0000 (15:44 +0100)]
scsi: zfcp: namespace prefix for internal latency data structures

In contrast to struct fsf_qual_latency_info, the ones here are not FSF but
software defined zfcp-internal.

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: zfcp: update width in comment for ZFCP_COMMON_FLAGS mask
Steffen Maier [Thu, 8 Nov 2018 14:44:41 +0000 (15:44 +0100)]
scsi: zfcp: update width in comment for ZFCP_COMMON_FLAGS mask

v2.6.10 history commit 4062e12b2ba2 ("[PATCH] s390: zfcp act enhancements")
extended this mask by one nibble with the introduction of
ZFCP_STATUS_COMMON_ACCESS_DENIED == 0x00800000 for ACT (access control
table).

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: zfcp: move scsi_eh & non-ERP timeout defines owned by and local to zfcp_fsf.c
Steffen Maier [Thu, 8 Nov 2018 14:44:40 +0000 (15:44 +0100)]
scsi: zfcp: move scsi_eh & non-ERP timeout defines owned by and local to zfcp_fsf.c

Also clarify namespace prefix for the timeout used for FSF requests on
behalf of SCSI error recovery: It is zfcp_fsf_ not zfcp_scsi_.

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: zfcp: drop unnecessary forward prototype for struct zfcp_reqlist
Steffen Maier [Thu, 8 Nov 2018 14:44:39 +0000 (15:44 +0100)]
scsi: zfcp: drop unnecessary forward prototype for struct zfcp_reqlist

While struct zfcp_adapter contains a pointer to zfcp_reqlist, the pointer
field does not need to know the structure or even a prototype.

The prototype was introduced with v2.6.34 commit b6bd2fb92a7b ("[SCSI]
zfcp: Move FSF request tracking code to new file").

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: zfcp: move SG table helper from aux to fc and make them static
Steffen Maier [Thu, 8 Nov 2018 14:44:38 +0000 (15:44 +0100)]
scsi: zfcp: move SG table helper from aux to fc and make them static

Since commit 663e0890e31c ("[SCSI] zfcp: remove access control tables
interface") these helper functions are only used for auto port scan in
zfcp_fc.c. Also change them to the corresponding namespace prefix.

This is a small cleanup for the miscellaneous catchall compile unit
zfcp_aux.c.

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: zfcp: remove unnecessary null pointer check before mempool_destroy
zhong jiang [Thu, 8 Nov 2018 14:44:37 +0000 (15:44 +0100)]
scsi: zfcp: remove unnecessary null pointer check before mempool_destroy

mempool_destroy has taken null pointer check into account. so remove the
redundant check.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Acked-by: Benjamin Block <bblock@linux.ibm.com>
[maier@linux.ibm.com: depends on v4.3 4e3ca3e033d1 ("mm/mempool: allow NULL `pool' pointer in mempool_destroy()")]
Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: libsas: Remove pcidev reference
John Garry [Thu, 15 Nov 2018 10:20:32 +0000 (18:20 +0800)]
scsi: libsas: Remove pcidev reference

Not all host drivers are PCI drivers - like hisi_sas, which supports a
platform driver - so remove reference to "pcidev".

Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: libsas: Drop SAS_DPRINTK() and revise logs levels
John Garry [Thu, 15 Nov 2018 10:20:31 +0000 (18:20 +0800)]
scsi: libsas: Drop SAS_DPRINTK() and revise logs levels

Like sas_printk() did previously, SAS_DPRINTK() offers little value now
that libsas logs already have the "sas" prefix through pr_fmt(fmt). So it
can be dropped.

However, after reviewing some logs in libsas, it is noticed that debug
level is too low in many instances.

So this change drops SAS_DPRINTK() and revises some logs to a more
appropriate level. However many stay at debug level, although some
are significantly promoted.

We add -DDEBUG for compilation so that we keep the debug messages by
default, as before.

All the pre-existing checkpatch errors for spanning messages across
multiple lines are also fixed.

Finally, all other references to printk() [apart from special formatting
in sas_ata.c] are removed and replaced with appropriate pr_xxx().

Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: libsas: Drop sas_printk()
John Garry [Thu, 15 Nov 2018 10:20:30 +0000 (18:20 +0800)]
scsi: libsas: Drop sas_printk()

The printk wrapper sas_printk() adds little value now that libsas logs
already have the "sas" prefix through pr_fmt(fmt), so just use pr_notice()
directly.

In addition, strings which span multiple lines are reunited.

Originally-from: Joe Perches <joe@perches.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: libsas: Use pr_fmt(fmt)
John Garry [Thu, 15 Nov 2018 10:20:29 +0000 (18:20 +0800)]
scsi: libsas: Use pr_fmt(fmt)

In preparation for dropping the libsas printk wrappers, use pr_fmt(fmt)
declaration to add the framework log prefix - "sas".

Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: libsas: Delete sas_dump.{c, h}
John Garry [Thu, 15 Nov 2018 10:20:28 +0000 (18:20 +0800)]
scsi: libsas: Delete sas_dump.{c, h}

The code in these files is not longer referenced, so delete them.

Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hisi_sas: change the time of SAS SSP connection
Xiang Chen [Fri, 9 Nov 2018 14:06:36 +0000 (22:06 +0800)]
scsi: hisi_sas: change the time of SAS SSP connection

Currently the time of SAS SSP connection is 1ms, which means the link
connection will fail if no IO response after this period.

For some disks handling large IO (such as 512k), 1ms is not enough, so
change it to 5ms.

Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hisi_sas: Relocate some codes to avoid an unused check
Xiang Chen [Fri, 9 Nov 2018 14:06:35 +0000 (22:06 +0800)]
scsi: hisi_sas: Relocate some codes to avoid an unused check

In function hisi_sas_task_prep(), we check asd_sas_port, but in function
hisi_sas_task_exec(), we already refer to asd_sas_port by using function
dev_to_hisi_hba() implicitly. So to avoid this possible invalid
dereference, relocate the check to function hisi_sas_task_prep().

Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hisi_sas: Add support for interrupt coalescing for v3 hw
Xiang Chen [Fri, 9 Nov 2018 14:06:34 +0000 (22:06 +0800)]
scsi: hisi_sas: Add support for interrupt coalescing for v3 hw

If INT_COAL_EN is enabled, configure time and count of interrupt
coalescing.  Then if CQ collects count of CQ entries in time, it will
report the interrupt. Or if CQ doesn't collect enough CQ entries in time,
it will report the interrupt at timeout.

As all the registers are not supported to be changed dynamically, we need
to config those register between disable and enable PHYs.

Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hisi_sas: Add support for interrupt converge for v3 hw
Xiang Chen [Fri, 9 Nov 2018 14:06:33 +0000 (22:06 +0800)]
scsi: hisi_sas: Add support for interrupt converge for v3 hw

If CQ_INT_CONVERGE_EN is enabled, the interrupts of all the 16 CQ queues
will be reported by CQ0.

So we need to change the process of CQ tasklet for this situation.

Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hisi_sas: Create separate host attributes per HBA
Xiang Chen [Fri, 9 Nov 2018 14:06:32 +0000 (22:06 +0800)]
scsi: hisi_sas: Create separate host attributes per HBA

Currently all the three HBA (v1/v2/v3 HW) share the same host attributes.

To support each HBA having separate attributes in future, create per-HBA
attributes.

Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: wd719x: always use generic DMA API
Christoph Hellwig [Fri, 9 Nov 2018 15:54:06 +0000 (16:54 +0100)]
scsi: wd719x: always use generic DMA API

The wd719x driver currently uses a mix of the legacy PCI DMA and the
generic DMA APIs.  Switch it over to the generic DMA API entirely.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: wd719x: use per-command private data
Christoph Hellwig [Fri, 9 Nov 2018 15:54:05 +0000 (16:54 +0100)]
scsi: wd719x: use per-command private data

Add the SCB onto the scsi command allocation and use dma streaming mappings
for it only when in use.  This avoid possibly calling dma_alloc_coherent
under a lock or even in irq context, while also making the code simpler.

Thanks to Ondrej Zary for testing and various bug fixes.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: wd719x: there should be no active SCBs on removal
Christoph Hellwig [Fri, 9 Nov 2018 15:54:04 +0000 (16:54 +0100)]
scsi: wd719x: there should be no active SCBs on removal

Warn on that case instead of trying to free them which would be fatal in
case we actually had active ones.

[mkp: typos]

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: sym53c8xx: use dma_set_mask
Christoph Hellwig [Thu, 18 Oct 2018 13:10:24 +0000 (15:10 +0200)]
scsi: sym53c8xx: use dma_set_mask

The driver currently uses pci_set_dma_mask despite otherwise using the
generic DMA API.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: stex: use dma_set_mask_and_coherent
Christoph Hellwig [Thu, 18 Oct 2018 13:10:23 +0000 (15:10 +0200)]
scsi: stex: use dma_set_mask_and_coherent

The driver currently uses pci_set_dma_mask despite otherwise using the
generic DMA API.  Switch it over to the better generic DMA API.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: mvumi: use dma_set_mask
Christoph Hellwig [Thu, 18 Oct 2018 13:10:22 +0000 (15:10 +0200)]
scsi: mvumi: use dma_set_mask

The driver currently uses pci_set_dma_mask despite otherwise using the
generic DMA API.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: lpfc: use dma_set_mask_and_coherent
Christoph Hellwig [Thu, 18 Oct 2018 13:10:21 +0000 (15:10 +0200)]
scsi: lpfc: use dma_set_mask_and_coherent

The driver currently uses pci_set_dma_mask despite otherwise using the
generic DMA API.  Switch it over to the better generic DMA API.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: isci: use dma_set_mask_and_coherent
Christoph Hellwig [Thu, 18 Oct 2018 13:10:20 +0000 (15:10 +0200)]
scsi: isci: use dma_set_mask_and_coherent

The driver currently uses pci_set_dma_mask despite otherwise using the
generic DMA API.  Switch it over to the better generic DMA API.

[mkp: s/iscsi/isci/]

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: initio: use dma_set_mask
Christoph Hellwig [Thu, 18 Oct 2018 13:10:19 +0000 (15:10 +0200)]
scsi: initio: use dma_set_mask

The driver currently uses pci_set_dma_mask despite otherwise using the
generic DMA API.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hptiop: use dma_set_mask
Christoph Hellwig [Thu, 18 Oct 2018 13:10:18 +0000 (15:10 +0200)]
scsi: hptiop: use dma_set_mask

The driver currently uses pci_set_dma_mask despite otherwise using the
generic DMA API.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: hisi_sas: use dma_set_mask_and_coherent
Christoph Hellwig [Thu, 18 Oct 2018 13:10:17 +0000 (15:10 +0200)]
scsi: hisi_sas: use dma_set_mask_and_coherent

The driver currently uses pci_set_dma_mask despite otherwise using the
generic DMA API.  Switch it over to the better generic DMA API.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: esas2r: use dma_set_mask_and_coherent
Christoph Hellwig [Thu, 18 Oct 2018 13:10:16 +0000 (15:10 +0200)]
scsi: esas2r: use dma_set_mask_and_coherent

The driver currently uses pci_set_dma_mask despite otherwise using the
generic DMA API.  Also move the dma_get_required_mask check before actually
setting the dma mask so that we don't end up with inconsistent settings in
corner cases.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: dpt_i2o: use dma_set_mask
Christoph Hellwig [Thu, 18 Oct 2018 13:10:15 +0000 (15:10 +0200)]
scsi: dpt_i2o: use dma_set_mask

The driver currently uses pci_set_dma_mask despite otherwise using the
generic DMA API.  Also move the dma_get_required_mask check before actually
setting the dma mask, so that we don't end up with inconsistent settings in
corner cases.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: bfa: use dma_set_mask_and_coherent
Christoph Hellwig [Thu, 18 Oct 2018 13:10:14 +0000 (15:10 +0200)]
scsi: bfa: use dma_set_mask_and_coherent

The driver currently uses pci_set_dma_mask despite otherwise using the
generic DMA API.  Switch it over to the better generic DMA API helper and
also ensure we set the coherent mask as well in the resume path.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: arcmsr: use dma_set_mask
Christoph Hellwig [Thu, 18 Oct 2018 13:10:13 +0000 (15:10 +0200)]
scsi: arcmsr: use dma_set_mask

The driver currently uses pci_set_dma_mask despite otherwise using the
generic DMA API.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: ufs: Add UFS platform driver for Cadence UFS
Janek Kotas [Thu, 20 Sep 2018 13:08:30 +0000 (13:08 +0000)]
scsi: ufs: Add UFS platform driver for Cadence UFS

This patch adds a device tree platform driver for Cadence UFS Host
Controller.  It can be enabled with SCSI_UFS_CDNS_PLATFORM Kconfig option.

Signed-off-by: Jan Kotas <jank@cadence.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: dt-bindings: ufs: Add bindings for Cadence UFS
Janek Kotas [Thu, 20 Sep 2018 13:08:22 +0000 (13:08 +0000)]
scsi: dt-bindings: ufs: Add bindings for Cadence UFS

This patch adds a DT binding documentation for Cadence UFS Host Controller.

Signed-off-by: Jan Kotas <jank@cadence.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: ufs: set the device reference clock setting
Subhash Jadavani [Tue, 16 Oct 2018 08:59:41 +0000 (14:29 +0530)]
scsi: ufs: set the device reference clock setting

UFS host supplies the reference clock to UFS device and UFS device
specification allows host to provide one of the 4 frequencies (19.2 MHz, 26
MHz, 38.4 MHz, 52 MHz) for reference clock. Host should set the device
reference clock frequency setting in the device based on what frequency it
is supplying to UFS device.

Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Sayali Lokhande <sayalil@codeaurora.org>
Reviewed-by: Evan Green <evgreen@chromium.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: pmcraid: use generic DMA API
Christoph Hellwig [Thu, 18 Oct 2018 13:05:37 +0000 (15:05 +0200)]
scsi: pmcraid: use generic DMA API

Switch from the legacy PCI DMA API to the generic DMA API.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: pmcraid: don't allocate a dma coherent buffer for sense data
Christoph Hellwig [Thu, 18 Oct 2018 13:05:36 +0000 (15:05 +0200)]
scsi: pmcraid: don't allocate a dma coherent buffer for sense data

We can just dma map the sense buffer passed with the scsi command,
and that gets us out of the nasty business of doing dma coherent
allocations from irq context.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: pmcraid: simplify pmcraid_cancel_all a bit
Christoph Hellwig [Thu, 18 Oct 2018 13:05:35 +0000 (15:05 +0200)]
scsi: pmcraid: simplify pmcraid_cancel_all a bit

No need for a local cmd_done variable, and pass boolean values as bool
type instead of u32.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla2xxx: use lower_32_bits and upper_32_bits instead of reinventing them
Christoph Hellwig [Thu, 18 Oct 2018 13:03:37 +0000 (15:03 +0200)]
scsi: qla2xxx: use lower_32_bits and upper_32_bits instead of reinventing them

This also moves the optimization for builds with 32-bit dma_addr_t to
the compiler (where it belongs) instead of opencoding it based on
incorrect assumptions.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla1280: properly handle 64-bit DMA
Christoph Hellwig [Thu, 18 Oct 2018 13:03:36 +0000 (15:03 +0200)]
scsi: qla1280: properly handle 64-bit DMA

CONFIG_HIGHMEM is not in fact an indicator for > 32-bit dma addressing
Given that the driver is a bit weird and wants a compile time selection
switch to checking CONFIG_ARCH_DMA_ADDR_T_64BIT instead.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: qla1280: use lower_32_bits and upper_32_bits instead of reinventing them
Christoph Hellwig [Thu, 18 Oct 2018 13:03:35 +0000 (15:03 +0200)]
scsi: qla1280: use lower_32_bits and upper_32_bits instead of reinventing them

This also moves the optimization for builds with 32-bit dma_addr_t to
the compiler (where it belongs) instead of opencoding it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: ips: properly handle 64-bit DMA
Christoph Hellwig [Thu, 18 Oct 2018 13:03:34 +0000 (15:03 +0200)]
scsi: ips: properly handle 64-bit DMA

CONFIG_HIGHMEM64 is only one (and these days unusual) way to indicate
that > 32-bit dma address are possible.  Replace it with a check of the
dma_addr_t size.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
5 years agoscsi: ips: use lower_32_bits and upper_32_bits instead of reinventing them
Christoph Hellwig [Thu, 18 Oct 2018 13:03:33 +0000 (15:03 +0200)]
scsi: ips: use lower_32_bits and upper_32_bits instead of reinventing them

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>