OSDN Git Service

uclinux-h8/linux.git
2 years agoscsi: cxlflash: Query write_zeroes limit for zeroing
Christoph Hellwig [Wed, 9 Feb 2022 08:28:22 +0000 (09:28 +0100)]
scsi: cxlflash: Query write_zeroes limit for zeroing

The write_same and write_zeroes limits for SCSI are effectively the same,
so the current code works just fine.  But we plan to remove
REQ_OP_WRITE_SAME support, so switch to querying the write zeroes limit for
a zeroing WRITE SAME operation.

Link: https://lore.kernel.org/r/20220209082828.2629273-2-hch@lst.de
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: mpi3mr: Fix flushing !WQ_MEM_RECLAIM events warning
Sreekanth Reddy [Fri, 18 Feb 2022 18:05:15 +0000 (23:35 +0530)]
scsi: mpi3mr: Fix flushing !WQ_MEM_RECLAIM events warning

Fix the following warning by not allocating driver's event handling worker
queue with WQ_MEM_RECLAIM flag enabled:

workqueue: WQ_MEM_RECLAIM
mpi3mr_fwevt_worker [mpi3mr] is flushing !WQ_MEM_RECLAIM events

Link: https://lore.kernel.org/r/20220218180515.27455-1-sreekanth.reddy@broadcom.com
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: target: tcmu: Make cmd_ring_size changeable via configfs
Guixin Liu [Wed, 16 Feb 2022 02:21:49 +0000 (10:21 +0800)]
scsi: target: tcmu: Make cmd_ring_size changeable via configfs

Make cmd_ring_size changeable similar to the way it is done for
max_data_area_mb. The reason is that our tcmu client will create thousands
of tcmu instances, and this will consume lots of mem with default 8Mb cmd
ring size for every backstore.

One can change the value by typing:

    echo "cmd_ring_size_mb=N" > control

The "N" is a integer between 1 to 8, if set 1, the cmd ring can hold about
6k cmds(tcmu_cmd_entry about 176 byte) at least.

The value is printed when doing:

    cat info

In addition, a new readonly attribute 'cmd_ring_size_mb' returns the value
in read.

Link: https://lore.kernel.org/r/1644978109-14885-1-git-send-email-kanie@linux.alibaba.com
Reviewed-by: Xiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
Reviewed-by: Bodo Stroesser <bostroesser@gmail.com>
Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: qla2xxx: Use named initializers for q_dev_state
Gleb Chesnokov [Tue, 15 Feb 2022 17:13:59 +0000 (17:13 +0000)]
scsi: qla2xxx: Use named initializers for q_dev_state

Make q_dev_state a little more readable and maintainable by using named
initializers.

Also convert QLA8XXX_DEV_* macros into an enum and remove
qla83xx_dev_state_to_string(), which is a duplicate of qdev_state().

Link: https://lore.kernel.org/r/AS8PR10MB495298515A7553C8D6D6E74D9D349@AS8PR10MB4952.EURPRD10.PROD.OUTLOOK.COM
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Gleb Chesnokov <Chesnokov.G@raidix.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: qla2xxx: Use named initializers for port_[d]state_str
Gleb Chesnokov [Tue, 15 Feb 2022 17:13:53 +0000 (17:13 +0000)]
scsi: qla2xxx: Use named initializers for port_[d]state_str

Make port_state_str and port_dstate_str a little more readable and
maintainable by using named initializers.

Also convert FCS_* macros into an enum.

Link: https://lore.kernel.org/r/AS8PR10MB495215841EB25C16DBC0CB409D349@AS8PR10MB4952.EURPRD10.PROD.OUTLOOK.COM
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Gleb Chesnokov <Chesnokov.G@raidix.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: ufs: core: Remove wlun_dev_to_hba()
Keoseong Park [Tue, 15 Feb 2022 11:40:02 +0000 (20:40 +0900)]
scsi: ufs: core: Remove wlun_dev_to_hba()

Commit edc0596cc04b ("scsi: ufs: core: Stop clearing UNIT ATTENTIONS")
removed all callers of wlun_dev_to_hba(). Hence also remove the macro
itself.

Link: https://lore.kernel.org/r/1891546521.01644927481711.JavaMail.epsvc@epcpadp4
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Keoseong Park <keosung.park@samsung.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: core: Remove struct scsi_pointer from struct scsi_cmnd
Bart Van Assche [Fri, 18 Feb 2022 19:51:17 +0000 (11:51 -0800)]
scsi: core: Remove struct scsi_pointer from struct scsi_cmnd

Remove struct scsi_pointer from struct scsi_cmnd since the previous patches
removed all users of that member of struct scsi_cmnd. Additionally, reorder
the members of struct scsi_cmnd such that the statement that the field
below can be modified by the SCSI LLD is again correct.

Link: https://lore.kernel.org/r/20220218195117.25689-50-bvanassche@acm.org
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: zalon: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:51:16 +0000 (11:51 -0800)]
scsi: zalon: Stop using the SCSI pointer

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-49-bvanassche@acm.org
Cc: Helge Deller <deller@gmx.de>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hannes Reinecke <hare@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>
2 years agoscsi: wd33c93: Move the SCSI pointer to private command data
Bart Van Assche [Fri, 18 Feb 2022 19:51:15 +0000 (11:51 -0800)]
scsi: wd33c93: Move the SCSI pointer to private command data

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-48-bvanassche@acm.org
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>
2 years agoscsi: wd719x: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:51:14 +0000 (11:51 -0800)]
scsi: wd719x: Stop using the SCSI pointer

Move the DMA handle into the per-command private data instead of using the
SCSI pointer from struct scsi_cmnd. This patch prepares for removal of the
SCSI pointer from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-47-bvanassche@acm.org
Cc: Ondrej Zary <linux@zary.sk>
Cc: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hannes Reinecke <hare@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>
2 years agoscsi: usb: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:51:13 +0000 (11:51 -0800)]
scsi: usb: Stop using the SCSI pointer

Set scsi_host_template.cmd_size instead of using the SCSI pointer for
storing driver-private data. Change the type of the argument of
uas_add_work() from struct uas_cmd_info * into struct scsi_cmnd * because
it is easier to convert a SCSI command pointer into a uas_cmd_info pointer
than the other way around.

This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-46-bvanassche@acm.org
Cc: linux-usb@vger.kernel.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Oliver Neukum <oneukum@suse.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: sym53c8xx_2: Move the SCSI pointer to private command data
Bart Van Assche [Fri, 18 Feb 2022 19:51:12 +0000 (11:51 -0800)]
scsi: sym53c8xx_2: Move the SCSI pointer to private command data

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-45-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hannes Reinecke <hare@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>
2 years agoscsi: smartpqi: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:51:11 +0000 (11:51 -0800)]
scsi: smartpqi: Stop using the SCSI pointer

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-44-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hannes Reinecke <hare@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>
2 years agoscsi: qla2xxx: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:51:10 +0000 (11:51 -0800)]
scsi: qla2xxx: Stop using the SCSI pointer

Instead of using the SCp.ptr field to track whether or not a command is
in flight, use the sp->type field to track this information. sp->type
must be set for proper operation of the qla2xxx driver. See e.g. the
switch (sp->type) statement in qla2x00_ct_entry().

This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-43-bvanassche@acm.org
Cc: Nilesh Javali <njavali@marvell.com>
Cc: Ewan D. Milne <emilne@redhat.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: qla1280: Move the SCSI pointer to private command data
Bart Van Assche [Fri, 18 Feb 2022 19:51:09 +0000 (11:51 -0800)]
scsi: qla1280: Move the SCSI pointer to private command data

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-42-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hannes Reinecke <hare@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>
2 years agoscsi: ppa: Move the SCSI pointer to private command data
Bart Van Assche [Fri, 18 Feb 2022 19:51:08 +0000 (11:51 -0800)]
scsi: ppa: Move the SCSI pointer to private command data

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-41-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.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>
2 years agoscsi: sym53c500_cs: Move the SCSI pointer to private command data
Bart Van Assche [Fri, 18 Feb 2022 19:51:07 +0000 (11:51 -0800)]
scsi: sym53c500_cs: Move the SCSI pointer to private command data

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd.
This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-40-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.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>
2 years agoscsi: nsp_cs: Move the SCSI pointer to private command data
Bart Van Assche [Fri, 18 Feb 2022 19:51:06 +0000 (11:51 -0800)]
scsi: nsp_cs: Move the SCSI pointer to private command data

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
in struct scsi_cmnd.
This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-39-bvanassche@acm.org
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>
2 years agoscsi: nsp32: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:51:05 +0000 (11:51 -0800)]
scsi: nsp32: Stop using the SCSI pointer

Move the SCSI status field to private data. Stop setting the .ptr,
.this_residual, .buffer and .buffer_residual SCSI pointer members
since no code in this driver reads these members.

This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-38-bvanassche@acm.org
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Masanori Goto <gotom@debian.or.jp>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: mvumi: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:51:04 +0000 (11:51 -0800)]
scsi: mvumi: Stop using the SCSI pointer

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-37-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hannes Reinecke <hare@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>
2 years agoscsi: mvsas: Fix a set-but-not-used warning
Bart Van Assche [Fri, 18 Feb 2022 19:51:03 +0000 (11:51 -0800)]
scsi: mvsas: Fix a set-but-not-used warning

This patch fixes the following compiler warning:

drivers/scsi/mvsas/mv_init.c: In function ‘mvs_pci_init’:
drivers/scsi/mvsas/mv_init.c:497:30: warning: variable ‘mpi’ set but not used [-Wunused-but-set-variable]
  497 |         struct mvs_prv_info *mpi;
      |                              ^~~

Link: https://lore.kernel.org/r/20220218195117.25689-36-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: John Garry <john.garry@huawei.com>
Reviewed-by: Hannes Reinecke <hare@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>
2 years agoscsi: mesh: Move the SCSI pointer to private command data
Bart Van Assche [Fri, 18 Feb 2022 19:51:02 +0000 (11:51 -0800)]
scsi: mesh: Move the SCSI pointer to private command data

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-35-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.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>
2 years agoscsi: megasas: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:51:01 +0000 (11:51 -0800)]
scsi: megasas: Stop using the SCSI pointer

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-34-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hannes Reinecke <hare@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>
2 years agoscsi: megaraid: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:51:00 +0000 (11:51 -0800)]
scsi: megaraid: Stop using the SCSI pointer

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-33-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.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>
2 years agoscsi: mac53c94: Move the SCSI pointer to private command data
Bart Van Assche [Fri, 18 Feb 2022 19:50:59 +0000 (11:50 -0800)]
scsi: mac53c94: Move the SCSI pointer to private command data

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-32-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.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>
2 years agoscsi: mac53c94: Fix a set-but-not-used compiler warning
Bart Van Assche [Fri, 18 Feb 2022 19:50:58 +0000 (11:50 -0800)]
scsi: mac53c94: Fix a set-but-not-used compiler warning

Fix the following compiler warning:

   drivers/scsi/mac53c94.c: In function 'mac53c94_init':
   drivers/scsi/mac53c94.c:128:13: warning: variable 'x' set but not used [-Wunused-but-set-variable]
     128 |         int x;

Link: https://lore.kernel.org/r/20220218195117.25689-31-bvanassche@acm.org
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hannes Reinecke <hare@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>
2 years agoscsi: qedf: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:50:57 +0000 (11:50 -0800)]
scsi: qedf: Stop using the SCSI pointer

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. Remove the CMD_SCSI_STATUS() assignment because the
assigned value is not used.

This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-30-bvanassche@acm.org
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: bnx2fc: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:50:56 +0000 (11:50 -0800)]
scsi: bnx2fc: Stop using the SCSI pointer

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. Remove the CMD_SCSI_STATUS() assignment because the
assigned value is not used.

This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-29-bvanassche@acm.org
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: libfc: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:50:55 +0000 (11:50 -0800)]
scsi: libfc: Stop using the SCSI pointer

Move the fc_fcp_pkt pointer, the residual length and the SCSI status into
the new data structure libfc_cmd_priv. This patch prepares for removal of
the SCSI pointer from struct scsi_cmnd.

The user of the libfc data path functions have been identified as follows:
$ git grep -lw fc_queuecommand | grep -v scsi/libfc/
drivers/scsi/fcoe/fcoe.c

Link: https://lore.kernel.org/r/20220218195117.25689-28-bvanassche@acm.org
Cc: Saurav Kashyap <skashyap@marvell.com>
Cc: Javed Hasan <jhasan@marvell.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: initio: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:50:54 +0000 (11:50 -0800)]
scsi: initio: Stop using the SCSI pointer

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-27-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hannes Reinecke <hare@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>
2 years agoscsi: iscsi: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:50:53 +0000 (11:50 -0800)]
scsi: iscsi: Stop using the SCSI pointer

Instead of storing the iSCSI task pointer and the session age in the SCSI
pointer, use command-private variables. This patch prepares for removal of
the SCSI pointer from struct scsi_cmnd.

The list of iSCSI drivers has been obtained as follows:
$ git grep -lw iscsi_host_alloc
drivers/infiniband/ulp/iser/iscsi_iser.c
drivers/scsi/be2iscsi/be_main.c
drivers/scsi/bnx2i/bnx2i_iscsi.c
drivers/scsi/cxgbi/libcxgbi.c
drivers/scsi/iscsi_tcp.c
drivers/scsi/libiscsi.c
drivers/scsi/qedi/qedi_main.c
drivers/scsi/qla4xxx/ql4_os.c
include/scsi/libiscsi.h

Note: it is not clear to me how the qla4xxx driver can work without this
patch since it uses the scsi_cmnd::SCp.ptr member for two different
purposes:
- The qla4xxx driver uses this member to store a struct srb pointer.
- libiscsi uses this member to store a struct iscsi_task pointer.

Reviewed-by: Lee Duncan <lduncan@suse.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Cc: Chris Leech <cleech@redhat.com>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Nilesh Javali <njavali@marvell.com>
Cc: Manish Rangankar <mrangankar@marvell.com>
Cc: Karen Xie <kxie@chelsio.com>
Cc: Ketan Mukadam <ketan.mukadam@broadcom.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
iscsi

Link: https://lore.kernel.org/r/20220218195117.25689-26-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: imm: Move the SCSI pointer to private command data
Bart Van Assche [Fri, 18 Feb 2022 19:50:52 +0000 (11:50 -0800)]
scsi: imm: Move the SCSI pointer to private command data

Set .cmd_size in the SCSI host template instead of using the SCSI pointer.
This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-25-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.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>
2 years agoscsi: hptiop: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:50:51 +0000 (11:50 -0800)]
scsi: hptiop: Stop using the SCSI pointer

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Rename hpt_scsi_pointer into hpt_cmd_priv because that data structure is
not related to struct scsi_pointer.

Link: https://lore.kernel.org/r/20220218195117.25689-24-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: fnic: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:50:50 +0000 (11:50 -0800)]
scsi: fnic: Stop using the SCSI pointer

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-23-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: fnic: Fix a tracing statement
Bart Van Assche [Fri, 18 Feb 2022 19:50:49 +0000 (11:50 -0800)]
scsi: fnic: Fix a tracing statement

Report both the command flags and command state instead of only the
command state.

Link: https://lore.kernel.org/r/20220218195117.25689-22-bvanassche@acm.org
Fixes: 4d7007b49d52 ("[SCSI] fnic: Fnic Trace Utility")
Cc: Hiral Patel <hiralpat@cisco.com>
Reviewed-by: Hannes Reinecke <hare@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>
2 years agoscsi: fdomain: Move the SCSI pointer to private command data
Bart Van Assche [Fri, 18 Feb 2022 19:50:48 +0000 (11:50 -0800)]
scsi: fdomain: Move the SCSI pointer to private command data

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-21-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: esp_scsi: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:50:47 +0000 (11:50 -0800)]
scsi: esp_scsi: Stop using the SCSI pointer

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-20-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hannes Reinecke <hare@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>
2 years agoscsi: dc395x: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:50:46 +0000 (11:50 -0800)]
scsi: dc395x: Stop using the SCSI pointer

Remove the code that sets SCSI pointer members since there is no code in
this driver that reads these members.

Link: https://lore.kernel.org/r/20220218195117.25689-19-bvanassche@acm.org
Cc: Oliver Neukum <oneukum@suse.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hannes Reinecke <hare@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>
2 years agoscsi: csio: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:50:45 +0000 (11:50 -0800)]
scsi: csio: Stop using the SCSI pointer

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-18-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.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>
2 years agoscsi: bfa: Stop using the SCSI pointer
Bart Van Assche [Fri, 18 Feb 2022 19:50:44 +0000 (11:50 -0800)]
scsi: bfa: Stop using the SCSI pointer

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-17-bvanassche@acm.org
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: aha152x: Move the SCSI pointer to private command data
Bart Van Assche [Fri, 18 Feb 2022 19:50:43 +0000 (11:50 -0800)]
scsi: aha152x: Move the SCSI pointer to private command data

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-16-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hannes Reinecke <hare@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>
2 years agoscsi: aha1542: Remove a set-but-not-used array
Bart Van Assche [Fri, 18 Feb 2022 19:50:42 +0000 (11:50 -0800)]
scsi: aha1542: Remove a set-but-not-used array

This patch fixes the following W=1 warning:

drivers/scsi/aha1542.c:209:12: warning: variable ‘inquiry_result’ set but not used [-Wunused-but-set-variable]
  209 |         u8 inquiry_result[4];

Link: https://lore.kernel.org/r/20220218195117.25689-15-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hannes Reinecke <hare@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>
2 years agoscsi: advansys: Move the SCSI pointer to private command data
Bart Van Assche [Fri, 18 Feb 2022 19:50:41 +0000 (11:50 -0800)]
scsi: advansys: Move the SCSI pointer to private command data

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-14-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: aacraid: Move the SCSI pointer to private command data
Bart Van Assche [Fri, 18 Feb 2022 19:50:40 +0000 (11:50 -0800)]
scsi: aacraid: Move the SCSI pointer to private command data

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-13-bvanassche@acm.org
Reviewed-by: Hannes Reinecke <hare@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>
2 years agoscsi: 53c700: Stop clearing SCSI pointer fields
Bart Van Assche [Fri, 18 Feb 2022 19:50:39 +0000 (11:50 -0800)]
scsi: 53c700: Stop clearing SCSI pointer fields

None of the 53c700 drivers uses the SCSI pointer. Hence remove the code
from 53c700.c that clears two SCSI pointer fields. The 53c700 drivers are:

$ git grep -l 'include.*53c700'
drivers/scsi/53c700.c
drivers/scsi/a4000t.c
drivers/scsi/bvme6000_scsi.c
drivers/scsi/lasi700.c
drivers/scsi/mvme16x_scsi.c
drivers/scsi/sim710.c
drivers/scsi/sni_53c710.c
drivers/scsi/zorro7xx.c

Link: https://lore.kernel.org/r/20220218195117.25689-12-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: arm: Move the SCSI pointer to private command data
Bart Van Assche [Fri, 18 Feb 2022 19:50:38 +0000 (11:50 -0800)]
scsi: arm: Move the SCSI pointer to private command data

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd. The ARM SCSI drivers have been identified as follows:
$ git grep -l '#include.*arm_scsi.h'
drivers/scsi/arm/acornscsi.c
drivers/scsi/arm/cumana_2.c
drivers/scsi/arm/eesox.c
drivers/scsi/arm/fas216.c
drivers/scsi/arm/powertec.c

Link: https://lore.kernel.org/r/20220218195117.25689-11-bvanassche@acm.org
Cc: Russell King <linux@armlinux.org.uk>
Reviewed-by: Hannes Reinecke <hare@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>
2 years agoscsi: arm: Rename arm/scsi.h into arm/arm_scsi.h
Bart Van Assche [Fri, 18 Feb 2022 19:50:37 +0000 (11:50 -0800)]
scsi: arm: Rename arm/scsi.h into arm/arm_scsi.h

The new name makes the purpose of this header file more clear and also
makes it easier to find this header file with grep.

Link: https://lore.kernel.org/r/20220218195117.25689-10-bvanassche@acm.org
Cc: Russell King <linux@armlinux.org.uk>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: NCR5380: Add SCp members to struct NCR5380_cmd
Finn Thain [Fri, 18 Feb 2022 19:50:36 +0000 (11:50 -0800)]
scsi: NCR5380: Add SCp members to struct NCR5380_cmd

This is necessary for the eventual removal of SCp from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-9-bvanassche@acm.org
Cc: Michael Schmitz <schmitzmic@gmail.com>
Cc: Ondrej Zary <linux@zary.sk>
Suggested-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Finn Thain <fthain@linux-m68k.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: NCR5380: Remove the NCR5380_CMD_SIZE macro
Bart Van Assche [Fri, 18 Feb 2022 19:50:35 +0000 (11:50 -0800)]
scsi: NCR5380: Remove the NCR5380_CMD_SIZE macro

This makes it easier to find users of the NCR5380_cmd data structure with
'grep'.

Link: https://lore.kernel.org/r/20220218195117.25689-8-bvanassche@acm.org
Cc: Finn Thain <fthain@telegraphics.com.au>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Ondrej Zary <linux@rainbow-software.org>
Cc: Michael Schmitz <schmitzmic@gmail.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Acked-by: Finn Thain <fthain@linux-m68k.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: Remove drivers/scsi/scsi.h
Bart Van Assche [Fri, 18 Feb 2022 19:50:34 +0000 (11:50 -0800)]
scsi: Remove drivers/scsi/scsi.h

The following two header files have the same file name: include/scsi/scsi.h
and drivers/scsi/scsi.h. This is confusing. Remove the latter since the
following note was added in drivers/scsi/scsi.h in 2004:

"NOTE: this file only contains compatibility glue for old drivers. All
these wrappers will be removed sooner or later. For new code please use
the interfaces declared in the headers in include/scsi/"

Link: https://lore.kernel.org/r/20220218195117.25689-7-bvanassche@acm.org
Cc: Christoph Hellwig <hch@lst.de>
Cc: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: nsp_cs: Use true and false instead of TRUE and FALSE
Bart Van Assche [Fri, 18 Feb 2022 19:50:33 +0000 (11:50 -0800)]
scsi: nsp_cs: Use true and false instead of TRUE and FALSE

This patch prepares for removal of the drivers/scsi/scsi.h header file. That
header file defines the 'TRUE' and 'FALSE' constants.

Link: https://lore.kernel.org/r/20220218195117.25689-6-bvanassche@acm.org
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Cc: John Garry <john.garry@huawei.com>
Reviewed-by: Hannes Reinecke <hare@suse.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>
2 years agoscsi: nsp_cs: Change the return type of two functions into 'void'
Bart Van Assche [Fri, 18 Feb 2022 19:50:32 +0000 (11:50 -0800)]
scsi: nsp_cs: Change the return type of two functions into 'void'

nsp_reselected() and nsphw_init() always return TRUE. Change the return type
of these functions into 'void'.

Link: https://lore.kernel.org/r/20220218195117.25689-5-bvanassche@acm.org
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Cc: John Garry <john.garry@huawei.com>
Reviewed-by: Hannes Reinecke <hare@suse.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>
2 years agoscsi: ips: Use true and false instead of TRUE and FALSE
Bart Van Assche [Fri, 18 Feb 2022 19:50:31 +0000 (11:50 -0800)]
scsi: ips: Use true and false instead of TRUE and FALSE

This patch prepares for removal of the drivers/scsi/scsi.h header file.
That header file defines the 'TRUE' and 'FALSE' constants.

Link: https://lore.kernel.org/r/20220218195117.25689-4-bvanassche@acm.org
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Cc: John Garry <john.garry@huawei.com>
Reviewed-by: Hannes Reinecke <hare@suse.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>
2 years agoscsi: ips: Change the return type of ips_release() into 'void'
Bart Van Assche [Fri, 18 Feb 2022 19:50:30 +0000 (11:50 -0800)]
scsi: ips: Change the return type of ips_release() into 'void'

ips_release() has one caller and that caller ignores the value returned by
ips_release(). Hence change the return type of that function into 'void'.

Link: https://lore.kernel.org/r/20220218195117.25689-3-bvanassche@acm.org
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Cc: John Garry <john.garry@huawei.com>
Reviewed-by: Hannes Reinecke <hare@suse.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>
2 years agoscsi: ips: Remove an unreachable statement
Bart Van Assche [Fri, 18 Feb 2022 19:50:29 +0000 (11:50 -0800)]
scsi: ips: Remove an unreachable statement

Whether or not CONFIG_BUG is enabled, BUG() never returns. Hence, code past
a BUG() statement is unreachable. Remove one such unreachable statement.

Link: https://lore.kernel.org/r/20220218195117.25689-2-bvanassche@acm.org
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Cc: John Garry <john.garry@huawei.com>
Reviewed-by: Hannes Reinecke <hare@suse.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>
2 years agoscsi: libsas: Add sas_execute_ata_cmd()
John Garry [Tue, 22 Feb 2022 12:50:59 +0000 (20:50 +0800)]
scsi: libsas: Add sas_execute_ata_cmd()

Add a function to execute an ATA command using the TMF code, and use in the
hisi_sas driver. That driver needs to be able to issue the command on a
specific phy, so add an interface for that.

With that, hisi_sas_exec_internal_tmf_task() may be deleted.

Link: https://lore.kernel.org/r/1645534259-27068-19-git-send-email-john.garry@huawei.com
Tested-by: Yihang Li <liyihang6@hisilicon.com>
Tested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: libsas: Add sas_abort_task()
John Garry [Thu, 17 Feb 2022 15:42:45 +0000 (23:42 +0800)]
scsi: libsas: Add sas_abort_task()

Add a generic implementation of abort task TMF handler, and use in LLDDs.

With that, some LLDDs custom TMF functions can now be deleted.

Link: https://lore.kernel.org/r/1645112566-115804-18-git-send-email-john.garry@huawei.com
Tested-by: Yihang Li <liyihang6@hisilicon.com>
Tested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: libsas: Add sas_query_task()
John Garry [Thu, 17 Feb 2022 15:42:44 +0000 (23:42 +0800)]
scsi: libsas: Add sas_query_task()

Add a generic implementation of query task TMF handler, and use in LLDDs.

Link: https://lore.kernel.org/r/1645112566-115804-17-git-send-email-john.garry@huawei.com
Tested-by: Yihang Li <liyihang6@hisilicon.com>
Tested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: libsas: Add sas_lu_reset()
John Garry [Thu, 17 Feb 2022 15:42:43 +0000 (23:42 +0800)]
scsi: libsas: Add sas_lu_reset()

Add a generic implementation of LU reset TMF handler, and use in LLDDs.

Link: https://lore.kernel.org/r/1645112566-115804-16-git-send-email-john.garry@huawei.com
Tested-by: Yihang Li <liyihang6@hisilicon.com>
Tested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: libsas: Add sas_clear_task_set()
John Garry [Thu, 17 Feb 2022 15:42:42 +0000 (23:42 +0800)]
scsi: libsas: Add sas_clear_task_set()

Add a generic implementation of clear task set TMF handler, and use in
LLDDs.

Link: https://lore.kernel.org/r/1645112566-115804-15-git-send-email-john.garry@huawei.com
Tested-by: Yihang Li <liyihang6@hisilicon.com>
Tested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: libsas: Add sas_abort_task_set()
John Garry [Thu, 17 Feb 2022 15:42:41 +0000 (23:42 +0800)]
scsi: libsas: Add sas_abort_task_set()

Add a generic implementation of abort task set TMF handler, and use in
LLDDs.

Link: https://lore.kernel.org/r/1645112566-115804-14-git-send-email-john.garry@huawei.com
Tested-by: Yihang Li <liyihang6@hisilicon.com>
Tested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: libsas: Add TMF handler aborted callback
John Garry [Thu, 17 Feb 2022 15:42:40 +0000 (23:42 +0800)]
scsi: libsas: Add TMF handler aborted callback

The hisi_sas and pm8001 TMF handlers have some special processing for when
the TMF is aborted, so add a callback and fill it in for those drivers.

Link: https://lore.kernel.org/r/1645112566-115804-13-git-send-email-john.garry@huawei.com
Tested-by: Yihang Li <liyihang6@hisilicon.com>
Tested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: libsas: Add TMF handler exec complete callback
John Garry [Thu, 17 Feb 2022 15:42:39 +0000 (23:42 +0800)]
scsi: libsas: Add TMF handler exec complete callback

The pm8001 TMF handler has some special processing when the TMF completes,
so add a callback and fill it in for the pm8001 driver.

Link: https://lore.kernel.org/r/1645112566-115804-12-git-send-email-john.garry@huawei.com
Tested-by: Yihang Li <liyihang6@hisilicon.com>
Tested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: libsas: Add sas_execute_ssp_tmf()
John Garry [Thu, 17 Feb 2022 15:42:38 +0000 (23:42 +0800)]
scsi: libsas: Add sas_execute_ssp_tmf()

Add a function to issue an SSP TMF.

Add a temp prototype to keep make W=1 happy.

Link: https://lore.kernel.org/r/1645112566-115804-11-git-send-email-john.garry@huawei.com
Tested-by: Yihang Li <liyihang6@hisilicon.com>
Tested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: libsas: Add sas_execute_tmf()
John Garry [Thu, 17 Feb 2022 15:42:37 +0000 (23:42 +0800)]
scsi: libsas: Add sas_execute_tmf()

Drivers using libsas have to issue their own TMFs, and the code to do this
is duplicated between drivers.

Add a common function to handle TMFs. This will be also used for sending
ATA commands, but use name "tmf" as the purpose is similar between SCSI and
ATA in the usage.

The force_phy_id argument will be used for a hisi_sas HW bug workaround.

We check the sas task status stat field against TMF codes, as according to
the SAS v1.1 spec 9.2.2.5.3, if response_data is in datapres, then the
response code should be a TMF code - see table 128.

Link: https://lore.kernel.org/r/1645112566-115804-10-git-send-email-john.garry@huawei.com
Tested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: libsas: Add sas_task.tmf
John Garry [Thu, 17 Feb 2022 15:42:36 +0000 (23:42 +0800)]
scsi: libsas: Add sas_task.tmf

Add a pointer to a sas_tmf_task to the sas_task struct, as this will be
used when the common LLDD TMF code is factored out.

Also set it for the LLDDs to store per-sas_task TMF info.

Link: https://lore.kernel.org/r/1645112566-115804-9-git-send-email-john.garry@huawei.com
Tested-by: Yihang Li <liyihang6@hisilicon.com>
Tested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: libsas: Add struct sas_tmf_task
John Garry [Thu, 17 Feb 2022 15:42:35 +0000 (23:42 +0800)]
scsi: libsas: Add struct sas_tmf_task

Some of the LLDDs which use libsas have their own definition of a struct
to hold TMF info, so add a common struct for libsas.

Also add an interim force phy id field for hisi_sas driver, which will be
removed once the STP "TMF" code is factored out.

Even though some LLDDs (pm8001) use a u32 for the tag, u16 will be adequate,
as that named driver only uses tags in range [0, 1024).

Link: https://lore.kernel.org/r/1645112566-115804-8-git-send-email-john.garry@huawei.com
Tested-by: Yihang Li <liyihang6@hisilicon.com>
Tested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: libsas: Move SMP task handlers to core
John Garry [Thu, 17 Feb 2022 15:42:34 +0000 (23:42 +0800)]
scsi: libsas: Move SMP task handlers to core

Move the SMP task handlers to the core host code as they will be re-used
for executing internal abort and TMF tasks.

Link: https://lore.kernel.org/r/1645112566-115804-7-git-send-email-john.garry@huawei.com
Tested-by: Yihang Li <liyihang6@hisilicon.com>
Tested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: hisi_sas: Delete unused I_T_NEXUS_RESET_PHYUP_TIMEOUT
John Garry [Thu, 17 Feb 2022 15:42:33 +0000 (23:42 +0800)]
scsi: hisi_sas: Delete unused I_T_NEXUS_RESET_PHYUP_TIMEOUT

There is no user, so delete it.

Link: https://lore.kernel.org/r/1645112566-115804-6-git-send-email-john.garry@huawei.com
Tested-by: Yihang Li <liyihang6@hisilicon.com>
Tested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: libsas: Delete SAS_SG_ERR
John Garry [Thu, 17 Feb 2022 15:42:32 +0000 (23:42 +0800)]
scsi: libsas: Delete SAS_SG_ERR

No LLDD sets exec status as SAS_SG_ERR, so remove support.

Link: https://lore.kernel.org/r/1645112566-115804-5-git-send-email-john.garry@huawei.com
Tested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: libsas: Delete lldd_clear_aca callback
John Garry [Thu, 17 Feb 2022 15:42:31 +0000 (23:42 +0800)]
scsi: libsas: Delete lldd_clear_aca callback

This callback is never called, so remove support.

Link: https://lore.kernel.org/r/1645112566-115804-4-git-send-email-john.garry@huawei.com
Tested-by: Yihang Li <liyihang6@hisilicon.com>
Tested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-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>
2 years agoscsi: libsas: Use enum for response frame DATAPRES field
John Garry [Thu, 17 Feb 2022 15:42:30 +0000 (23:42 +0800)]
scsi: libsas: Use enum for response frame DATAPRES field

As defined in table 126 of the SAS spec 1.1, use an enum for the DATAPRES
field, which makes reading the code easier.

Also change sas_ssp_task_response() to use a switch statement, which is
more suitable (than if-else), as suggested by Christoph.

Link: https://lore.kernel.org/r/1645112566-115804-3-git-send-email-john.garry@huawei.com
Suggested-by: Xiang Chen <chenxiang66@hisilicon.com>
Tested-by: Yihang Li <liyihang6@hisilicon.com>
Tested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: libsas: Handle non-TMF codes in sas_scsi_find_task()
John Garry [Thu, 17 Feb 2022 15:42:29 +0000 (23:42 +0800)]
scsi: libsas: Handle non-TMF codes in sas_scsi_find_task()

LLDD TMF callbacks may return linux or other error codes instead of TMF
codes. This may cause problems in sas_scsi_find_task() ->
.lldd_query_task(), as only TMF codes are handled there. As such, we may
not return a task_disposition type from sas_scsi_find_task(). Function
sas_eh_handle_sas_errors() only handles that type, and will only progress
error handling for those recognised types.

Return TASK_ABORT_FAILED upon exit on the assumption that the command may
still be alive and error handling should be escalated.

Link: https://lore.kernel.org/r/1645112566-115804-2-git-send-email-john.garry@huawei.com
Tested-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoMerge branch '5.17/scsi-fixes' into 5.18/scsi-staging
Martin K. Petersen [Tue, 15 Feb 2022 02:51:29 +0000 (21:51 -0500)]
Merge branch '5.17/scsi-fixes' into 5.18/scsi-staging

Pull 5.17 fixes branch into 5.18 tree to resolve a few pm8001 driver
merge conflicts.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: mpi3mr: Bump driver version to 8.0.0.68.0
Sreekanth Reddy [Thu, 10 Feb 2022 09:58:17 +0000 (15:28 +0530)]
scsi: mpi3mr: Bump driver version to 8.0.0.68.0

Bump mpi3mr driver version to 8.0.0.68.0.

Link: https://lore.kernel.org/r/20220210095817.22828-10-sreekanth.reddy@broadcom.com
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: mpi3mr: Fix memory leaks
Sreekanth Reddy [Thu, 10 Feb 2022 09:58:16 +0000 (15:28 +0530)]
scsi: mpi3mr: Fix memory leaks

Fix memory leaks related to operational reply queue's memory segments which
are not getting freed while unloading the driver.

Link: https://lore.kernel.org/r/20220210095817.22828-9-sreekanth.reddy@broadcom.com
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: mpi3mr: Update the copyright year
Sreekanth Reddy [Thu, 10 Feb 2022 09:58:15 +0000 (15:28 +0530)]
scsi: mpi3mr: Update the copyright year

Update the copyright year to 2017-2022.

Link: https://lore.kernel.org/r/20220210095817.22828-8-sreekanth.reddy@broadcom.com
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: mpi3mr: Fix reporting of actual data transfer size
Sreekanth Reddy [Thu, 10 Feb 2022 09:58:14 +0000 (15:28 +0530)]
scsi: mpi3mr: Fix reporting of actual data transfer size

The driver is missing to set the residual size while completing an
I/O. Ensure proper data transfer size is reported to the kernel on I/O
completion based on the transfer length reported by the firmware.

Link: https://lore.kernel.org/r/20220210095817.22828-7-sreekanth.reddy@broadcom.com
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: mpi3mr: Fix cmnd getting marked as in use forever
Sreekanth Reddy [Thu, 10 Feb 2022 09:58:13 +0000 (15:28 +0530)]
scsi: mpi3mr: Fix cmnd getting marked as in use forever

When a driver command which requires the driver to issue a follow up
command using the same command frame is outstanding and a soft reset
operation occurs, then that driver command frame is getting marked as in
use permanently and won't be reused again.

Clear the driver command frames while flushing out the outstanding commands
and avoid issuing any new requests using these command frames while soft
reset is going on.

Link: https://lore.kernel.org/r/20220210095817.22828-6-sreekanth.reddy@broadcom.com
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: mpi3mr: Fix hibernation issue
Sreekanth Reddy [Thu, 10 Feb 2022 09:58:12 +0000 (15:28 +0530)]
scsi: mpi3mr: Fix hibernation issue

Hibernation operation fails when it is issued for second time. This is
because the driver is trying to release the IOC's PCI resources after
setting power state to D3.

Set the IOC's power state to D3 only after releasing the IOC's PCI
resources.

Link: https://lore.kernel.org/r/20220210095817.22828-5-sreekanth.reddy@broadcom.com
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: mpi3mr: Update MPI3 headers
Sreekanth Reddy [Thu, 10 Feb 2022 09:58:11 +0000 (15:28 +0530)]
scsi: mpi3mr: Update MPI3 headers

Update MPI3 headers.

Link: https://lore.kernel.org/r/20220210095817.22828-4-sreekanth.reddy@broadcom.com
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: mpi3mr: Fix printing of pending I/O count
Sreekanth Reddy [Thu, 10 Feb 2022 09:58:10 +0000 (15:28 +0530)]
scsi: mpi3mr: Fix printing of pending I/O count

Print proper pending I/O count after issuing target reset TM operation.

Link: https://lore.kernel.org/r/20220210095817.22828-3-sreekanth.reddy@broadcom.com
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: mpi3mr: Fix deadlock while canceling the fw event
Sreekanth Reddy [Thu, 10 Feb 2022 09:58:09 +0000 (15:28 +0530)]
scsi: mpi3mr: Fix deadlock while canceling the fw event

During controller reset, the driver tries to flush all the pending firmware
event works from worker queue that are queued prior to the reset. However,
if any work is waiting for device addition/removal operation to be
completed at the SML, then a deadlock is observed. This is due to the
controller reset waiting for the device addition/removal to be completed
and the device/addition removal is waiting for the controller reset to be
completed.

To limit this deadlock, continue with the controller reset handling without
canceling the work which is waiting for device addition/removal operation
to complete at SML.

Link: https://lore.kernel.org/r/20220210095817.22828-2-sreekanth.reddy@broadcom.com
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: Remove unused member cmd_pool for structure scsi_host_template
Xiang Chen [Fri, 11 Feb 2022 06:42:58 +0000 (14:42 +0800)]
scsi: Remove unused member cmd_pool for structure scsi_host_template

After commit e9c787e65c0c ("scsi: allocate scsi_cmnd structures as part of
struct request"), the member cmd_pool in structure scsi_host_template is
not used, so remove it.

Link: https://lore.kernel.org/r/1644561778-183074-5-git-send-email-chenxiang66@hisilicon.com
Reviewed-by: John Garry <john.garry@huawei.com>
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: libsas: Remove unused parameter for function sas_ata_eh()
Xiang Chen [Fri, 11 Feb 2022 06:42:57 +0000 (14:42 +0800)]
scsi: libsas: Remove unused parameter for function sas_ata_eh()

Input parameter work_q is not unused in function sas_ata_eh(), so remove
it.

Link: https://lore.kernel.org/r/1644561778-183074-4-git-send-email-chenxiang66@hisilicon.com
Reviewed-by: John Garry <john.garry@huawei.com>
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: libsas: Remove duplicated setting for task->task_state_flags
Xiang Chen [Fri, 11 Feb 2022 06:42:56 +0000 (14:42 +0800)]
scsi: libsas: Remove duplicated setting for task->task_state_flags

Task->task_state_flags is already set in function sas_alloc_task(), so
remove duplicated setting.

Link: https://lore.kernel.org/r/1644561778-183074-3-git-send-email-chenxiang66@hisilicon.com
Reviewed-by: John Garry <john.garry@huawei.com>
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: libsas: Use void for sas_discover_event() return code
Xiang Chen [Fri, 11 Feb 2022 06:42:55 +0000 (14:42 +0800)]
scsi: libsas: Use void for sas_discover_event() return code

The callers of function sas_discover_event() do not check its return value.
The function also only ever returns 0, so use void instead.

Link: https://lore.kernel.org/r/1644561778-183074-2-git-send-email-chenxiang66@hisilicon.com
Reviewed-by: John Garry <john.garry@huawei.com>
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: message: fusion: Use GFP_KERNEL
Julia Lawall [Thu, 10 Feb 2022 20:42:22 +0000 (21:42 +0100)]
scsi: message: fusion: Use GFP_KERNEL

Pci_driver probe functions aren't called with locks held and thus don't
need GFP_ATOMIC. Use GFP_KERNEL instead.

Problem found with Coccinelle.

Link: https://lore.kernel.org/r/20220210204223.104181-9-Julia.Lawall@inria.fr
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: smartpqi: Fix unused variable pqi_pm_ops for clang
Don Brace [Thu, 10 Feb 2022 20:11:51 +0000 (14:11 -0600)]
scsi: smartpqi: Fix unused variable pqi_pm_ops for clang

Driver added a new dev_pm_ops structure used only if CONFIG_PM is set.  The
CONFIG_PM MACRO needed to be moved up in the code to avoid the compiler
warnings. The hunk to move the location was missing from the above patch.

Found by kernel test robot by building driver with CONFIG_PM disabled.

Link: https://lore.kernel.org/all/202202090657.bstNLuce-lkp@intel.com/
Link: https://lore.kernel.org/r/20220210201151.236170-1-don.brace@microchip.com
Fixes: c66e078ad89e ("scsi: smartpqi: Fix hibernate and suspend")
Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Scott Teel <scott.teel@microchip.com>
Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Mike Mcgowen <mike.mcgowen@microchip.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: libsas: Drop SAS_TASK_AT_INITIATOR
John Garry [Thu, 10 Feb 2022 10:43:24 +0000 (18:43 +0800)]
scsi: libsas: Drop SAS_TASK_AT_INITIATOR

This flag is now only ever set, so delete it.

This also avoids a use-after-free in the pm8001 queue path, as reported in
the following:

https://lore.kernel.org/linux-scsi/c3cb7228-254e-9584-182b-007ac5e6fe0a@huawei.com/T/#m28c94c6d3ff582ec4a9fa54819180740e8bd4cfb

https://lore.kernel.org/linux-scsi/0cc0c435-b4f2-9c76-258d-865ba50a29dd@huawei.com/

[mkp: checkpatch + two SAS_TASK_AT_INITIATOR references]

Link: https://lore.kernel.org/r/1644489804-85730-3-git-send-email-john.garry@huawei.com
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: isci: Drop SAS_TASK_AT_INITIATOR check in isci_task_abort_task()
John Garry [Thu, 10 Feb 2022 10:43:23 +0000 (18:43 +0800)]
scsi: isci: Drop SAS_TASK_AT_INITIATOR check in isci_task_abort_task()

In the queue path, move around when we assign sas_task->lldd_task such that
this pointer and the SAS_TASK_AT_INITIATOR flag are set atomically.  It is
also not required to clear SAS_TASK_AT_INITIATOR in isci_task_execute_task()
error path as it is also cleared immediately after in isci_task_refuse()
call.

Now the following items may be considered:

 - SAS_TASK_STATE_DONE and SAS_TASK_AT_INITIATOR are mutually exclusive
   apart from possibly when SAS_TASK_STATE_DONE is set in
   sas_scsi_find_task(), but that is after .lldd_abort_task, i.e. the
   considered callback, is called.

 - If isci_task_refuse() is called in the queue path, then
   sas_task->lldd_task and SAS_TASK_AT_INITIATOR are cleared atomically in
   isci_task_refuse().

 - In the completion path, SAS_TASK_STATE_DONE is set and
   SAS_TASK_AT_INITIATOR is cleared atomically before the
   sas_task.lldd_task is cleared later.

So in isci_task_abort_task() if SAS_TASK_STATE_DONE is not set and
sas_task.lldd_task is still set, then SAS_TASK_AT_INITIATOR must be set -
so we can drop this check on SAS_TASK_AT_INITIATOR.

[mkp: checkpatch]

Link: https://lore.kernel.org/r/1644489804-85730-2-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>
2 years agoscsi: qla2xxx: Remove unused qla_sess_op_cmd_list from scsi_qla_host_t
Gleb Chesnokov [Tue, 8 Feb 2022 15:18:38 +0000 (15:18 +0000)]
scsi: qla2xxx: Remove unused qla_sess_op_cmd_list from scsi_qla_host_t

The qla_sess_op_cmd_list was introduced in commit 8b2f5ff3d05c ("qla2xxx:
cleanup cmd in qla workqueue before processing TMR"). Then the usage of
this list was dropped in commit fb35265b12bb ("scsi: qla2xxx: Remove
session creation redundant code").

Thus, remove this list since it is no longer used.

Link: https://lore.kernel.org/r/AS8PR10MB49524AAB4C8016E4AFF17FFB9D2D9@AS8PR10MB4952.EURPRD10.PROD.OUTLOOK.COM
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Gleb Chesnokov <Chesnokov.G@raidix.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: pm8001: Clean up inconsistent indenting
Yang Li [Tue, 8 Feb 2022 02:55:00 +0000 (10:55 +0800)]
scsi: pm8001: Clean up inconsistent indenting

Eliminate the following smatch warning:

drivers/scsi/pm8001/pm8001_ctl.c:760 pm8001_update_flash() warn:
inconsistent indenting

Link: https://lore.kernel.org/r/20220208025500.29511-1-yang.lee@linux.alibaba.com
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Acked-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: ibmvscsis: Silence -Warray-bounds warning
Kees Cook [Tue, 8 Feb 2022 06:12:31 +0000 (22:12 -0800)]
scsi: ibmvscsis: Silence -Warray-bounds warning

Instead of doing a cast to storage that is too small, add a union for the
high 64 bits. Silences the warnings under -Warray-bounds:

drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c: In function 'ibmvscsis_send_messages':
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c:1934:44: error: array subscript 'struct viosrp_crq[0]' is partly outside array bounds of 'u64[1]' {aka 'long long unsigned int[1]'} [-Werror=array-bounds]
 1934 |                                         crq->valid = VALID_CMD_RESP_EL;
      |                                            ^~
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c:1875:13: note: while referencing 'msg_hi'
 1875 |         u64 msg_hi = 0;
      |             ^~~~~~

There is no change to the resulting binary instructions.

Link: https://lore.kernel.org/lkml/20220125142430.75c3160e@canb.auug.org.au
Link: https://lore.kernel.org/r/20220208061231.3429486-1-keescook@chromium.org
Cc: Michael Cyr <mikecyr@linux.ibm.com>
Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Tyrel Datwyler <tyreld@linux.ibm.com>
Cc: linux-scsi@vger.kernel.org
Cc: target-devel@vger.kernel.org
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Reviewed-by: Tyrel Datwyler <tyreld@linux.ibm.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: qla2xxx: Add qla2x00_async_done() for async routines
Saurav Kashyap [Tue, 8 Feb 2022 09:39:46 +0000 (01:39 -0800)]
scsi: qla2xxx: Add qla2x00_async_done() for async routines

This done routine will delete the timer and check for its return value and
decrease the reference count accordingly. This prevents boot hangs reported
after commit 31e6cdbe0eae ("scsi: qla2xxx: Implement ref count for SRB")
was merged.

Link: https://lore.kernel.org/r/20220208093946.4471-1-njavali@marvell.com
Fixes: 31e6cdbe0eae ("scsi: qla2xxx: Implement ref count for SRB")
Reported-by: Ewan Milne <emilne@redhat.com>
Tested-by: Ewan D. Milne <emilne@redhat.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: lpfc: Reduce log messages seen after firmware download
James Smart [Mon, 7 Feb 2022 18:04:42 +0000 (10:04 -0800)]
scsi: lpfc: Reduce log messages seen after firmware download

Messages around firmware download were incorrectly tagged as being related
to discovery trace events. Thus, firmware download status ended up dumping
the trace log as well as the firmware update message. As there were a
couple of log messages in this state, the trace log was dumped multiple
times.

Resolve this by converting from trace events to SLI events.

Link: https://lore.kernel.org/r/20220207180442.72836-1-jsmart2021@gmail.com
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: lpfc: Remove NVMe support if kernel has NVME_FC disabled
James Smart [Mon, 7 Feb 2022 18:05:16 +0000 (10:05 -0800)]
scsi: lpfc: Remove NVMe support if kernel has NVME_FC disabled

The driver is initiating NVMe PRLIs to determine device NVMe support.  This
should not be occurring if CONFIG_NVME_FC support is disabled.

Correct this by changing the default value for FC4 support. Currently it
defaults to FCP and NVMe. With change, when NVME_FC support is not enabled
in the kernel, the default value is just FCP.

Link: https://lore.kernel.org/r/20220207180516.73052-1-jsmart2021@gmail.com
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: smartpqi: Update version to 2.1.14-035
Don Brace [Tue, 1 Feb 2022 21:49:18 +0000 (15:49 -0600)]
scsi: smartpqi: Update version to 2.1.14-035

Link: https://lore.kernel.org/r/164375215867.440833.17567317655622946368.stgit@brunhilda.pdev.net
Reviewed-by: Kevin Barnett <kevin.barnett@microchip.com>
Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Scott Teel <scott.teel@microchip.com>
Reviewed-by: Gerry Morong <gerry.morong@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: smartpqi: Fix lsscsi -t SAS addresses
Kevin Barnett [Tue, 1 Feb 2022 21:49:13 +0000 (15:49 -0600)]
scsi: smartpqi: Fix lsscsi -t SAS addresses

Correct lsscsi -t output for newer controllers that support 16-byte WWID in
the SAS address field. lsscsi -t was displaying all zeros for SAS
addresses.

When we added support to smartpqi for 16-byte WWIDs in the RPL data for
newer controllers, we were copying the wrong part of the 16-byte WWID to
the SAS address field.

Link: https://lore.kernel.org/r/164375215363.440833.7298523719813806902.stgit@brunhilda.pdev.net
Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Scott Teel <scott.teel@microchip.com>
Reviewed-by: Mike McGowen <mike.mcgowen@microchip.com>
Signed-off-by: Kevin Barnett <kevin.barnett@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: smartpqi: Fix hibernate and suspend
Kevin Barnett [Tue, 1 Feb 2022 21:49:08 +0000 (15:49 -0600)]
scsi: smartpqi: Fix hibernate and suspend

Restructure the hibernate/suspend code to allow workarounds for the
controller boot differences.

Newer controllers have subtle differences in the way that they boot up.

Link: https://lore.kernel.org/r/164375214859.440833.14683009064111314948.stgit@brunhilda.pdev.net
Reviewed-by: Mike McGowen <mike.mcgowen@microchip.com>
Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Scott Teel <scott.teel@microchip.com>
Signed-off-by: Kevin Barnett <kevin.barnett@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>