OSDN Git Service

tomoyo/tomoyo-test1.git
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>
2 years agoscsi: smartpqi: Fix BUILD_BUG_ON() statements
Mike McGowen [Tue, 1 Feb 2022 21:49:03 +0000 (15:49 -0600)]
scsi: smartpqi: Fix BUILD_BUG_ON() statements

Add calls to the functions at the beginning driver initialization.

The BUILD_BUG_ON() statements that are currently in functions named
verify_structures() in the modules smartpqi_init.c and smartpqi_sis.c do
not work as currently implemented.

Link: https://lore.kernel.org/r/164375214355.440833.13129778749209816497.stgit@brunhilda.pdev.net
Reviewed-by: Kevin Barnett <kevin.barnett@microchip.com>
Reviewed-by: Scott Teel <scott.teel@microchip.com>
Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Signed-off-by: Mike McGowen <Mike.McGowen@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 NUMA node not updated during init
Mike McGowen [Tue, 1 Feb 2022 21:48:58 +0000 (15:48 -0600)]
scsi: smartpqi: Fix NUMA node not updated during init

Correct NUMA node association when calling pqi_pci_probe().

In the function pqi_pci_probe(), the driver makes an OS call to get the
NUMA node associated with a controller. If the call returns that there is
no associated node, the driver attempts to set it to node 0. The problem is
that a different local variable (cp_node) was being used to do this, but
the original local variable (node) was still being used in the call to
pqi_alloc_ctrl_info().

The value of "node" is not updated if the conditional after the call to
dev_to_node() evaluates to TRUE.

Link: https://lore.kernel.org/r/164375213850.440833.5243014942807747074.stgit@brunhilda.pdev.net
Reviewed-by: Kevin Barnett <kevin.barnett@microchip.com>
Reviewed-by: Scott Teel <scott.teel@microchip.com>
Signed-off-by: Mike McGowen <Mike.McGowen@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: Expose SAS address for SATA drives
Kevin Barnett [Tue, 1 Feb 2022 21:48:53 +0000 (15:48 -0600)]
scsi: smartpqi: Expose SAS address for SATA drives

Remove UNIQUE_WWID_IN_REPORT_PHYS_LUN PQI feature.

This feature was originally added to solve a problem with NVMe drives, but
this problem has since been solved a different way, so this PQI feature is
no longer required for any type of drive.

The kernel was not creating symbolic links in sysfs between SATA drives and
their enclosure.

The driver was enabling the UNIQUE_WWID_IN_REPORT_PHYS_LUN PQI feature,
which causes the FW to return a WWID for SATA drives that is derived from a
unique ID read from the SATA drive itself. The driver was exposing this
WWID as the drive's SAS address. However, because this SAS address does not
match the SAS address returned by an enclosure's SES Page 0xA data, the
Linux kernel was not able to match a SATA drive with its enclosure.

Link: https://lore.kernel.org/r/164375213346.440833.12379222470149882747.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>
2 years agoscsi: smartpqi: Speed up RAID 10 sequential reads
Mike McGowen [Tue, 1 Feb 2022 21:48:48 +0000 (15:48 -0600)]
scsi: smartpqi: Speed up RAID 10 sequential reads

Use all data disks for sequential read operations.

Testing discovered inconsistent performance on RAID 10 volumes when
performing 256K sequential reads. The driver was only using a single
tracker to determine which physical drive to send a request to for AIO
requests.

Change the single tracker (next_bypass_group) to an array of trackers based
on the number of data disks in a row of the RAID map.

Link: https://lore.kernel.org/r/164375212842.440833.6733971458765002128.stgit@brunhilda.pdev.net
Reviewed-by: Kevin Barnett <kevin.barnett@microchip.com>
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: Mike McGowen <Mike.McGowen@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 kdump issue when controller is locked up
Mahesh Rajashekhara [Tue, 1 Feb 2022 21:48:43 +0000 (15:48 -0600)]
scsi: smartpqi: Fix kdump issue when controller is locked up

Avoid dropping into shell if the controller is in locked up state.

Driver issues SIS soft reset to bring back the controller to SIS mode while
OS boots into kdump mode.

If the controller is in lockup state, SIS soft reset does not work.

Since the controller lockup code has not been cleared, driver considers the
firmware is no longer up and running. Driver returns back an error code to
OS and the kdump fails.

Link: https://lore.kernel.org/r/164375212337.440833.11955356190354940369.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>
Signed-off-by: Mahesh Rajashekhara <mahesh.rajashekhara@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: Update volume size after expansion
Mahesh Rajashekhara [Tue, 1 Feb 2022 21:48:38 +0000 (15:48 -0600)]
scsi: smartpqi: Update volume size after expansion

After modifying logical volume size, lsblk command still shows previous
size of logical volume.

When the driver gets any event from firmware it schedules rescan worker
with delay of 10 seconds. If array expansion is so quick that it gets
completed in a second, the driver could not catch logical volume expansion
due to worker delay.

Since driver does not detect volume expansion, driver would not call
rescan device to update new size to the OS.

Link: https://lore.kernel.org/r/164375211833.440833.17023155389220583731.stgit@brunhilda.pdev.net
Reviewed-by: Kevin Barnett <kevin.barnett@microchip.com>
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: Mahesh Rajashekhara <mahesh.rajashekhara@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: Avoid drive spin-down during suspend
Sagar Biradar [Tue, 1 Feb 2022 21:48:33 +0000 (15:48 -0600)]
scsi: smartpqi: Avoid drive spin-down during suspend

On certain systems (based on PCI IDs), when the OS transitions the system
into the suspend (S3) state, the BMIC flush cache command will indicate a
system RESTART instead of SUSPEND.

This avoids drive spin-down.

Link: https://lore.kernel.org/r/164375211330.440833.7203813692110347698.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>
Signed-off-by: Sagar Biradar <sagar.biradar@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: Resolve delay issue with PQI_HZ value
Balsundar P [Tue, 1 Feb 2022 21:48:28 +0000 (15:48 -0600)]
scsi: smartpqi: Resolve delay issue with PQI_HZ value

Change PQI_HZ to HZ.

PQI_HZ macro was set to 1000 when HZ value is less than 1000.  By default,
PQI_HZ will result into a delay of 10 seconds(for kernel, which has HZ =
100). So in this case when firmware raises an event, rescan worker will be
scheduled after a delay of (10 x PQI_HZ) = 100 seconds instead of 10
seconds.

Also driver uses PQI_HZ at many instances, which might result in some other
issues with respect to delay.

Link: https://lore.kernel.org/r/164375210825.440833.15510172447583227486.stgit@brunhilda.pdev.net
Reviewed-by: Kevin Barnett <kevin.barnett@microchip.com>
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: Balsundar P <balsundar.p@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 a typo in func pqi_aio_submit_io()
Kevin Barnett [Tue, 1 Feb 2022 21:48:23 +0000 (15:48 -0600)]
scsi: smartpqi: Fix a typo in func pqi_aio_submit_io()

Use correct pqi_aio_path_request structure to calculate the offset to
sg_descriptors.

The function pqi_aio_submit_io() uses the pqi_raid_path_request structure
to calculate the offset of the structure member sg_descriptors.  This is
incorrect.  It should be using the pqi_aio_path_request structure instead.

This typo is benign because the offsets are the same in both structures.

Link: https://lore.kernel.org/r/164375210321.440833.2566086558909686629.stgit@brunhilda.pdev.net
Reviewed-by: Mike McGowen <mike.mcgowen@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>
2 years agoscsi: smartpqi: Fix a name typo and cleanup code
Kevin Barnett [Tue, 1 Feb 2022 21:48:18 +0000 (15:48 -0600)]
scsi: smartpqi: Fix a name typo and cleanup code

Rename the function pqi_is_io_high_priority() to pqi_is_io_high_priority().
Remove 2 unnecessary lines from the function, and adjusted the white space.

Link: https://lore.kernel.org/r/164375209818.440833.10908948825731635853.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>
2 years agoscsi: smartpqi: Quickly propagate path failures to SCSI midlayer
Murthy Bhat [Tue, 1 Feb 2022 21:48:13 +0000 (15:48 -0600)]
scsi: smartpqi: Quickly propagate path failures to SCSI midlayer

Return DID_NO_CONNECT when a path failure is detected.

When a path fails during I/O and AIO path gets disabled for a multipath
device, the I/O was retried in the RAID path slowing down path fail
detection. Returning DID_NO_CONNECT allows multipath to switch paths more
quickly.

Link: https://lore.kernel.org/r/164375209313.440833.9992416628621839233.stgit@brunhilda.pdev.net
Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Scott Teel <scott.teel@microchip.com>
Reviewed-by: Sagar Biradar <sagar.biradar@microchip.com>
Signed-off-by: Murthy Bhat <Murthy.Bhat@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: Eliminate drive spin down on warm boot
Sagar Biradar [Tue, 1 Feb 2022 21:48:08 +0000 (15:48 -0600)]
scsi: smartpqi: Eliminate drive spin down on warm boot

Avoid drive spin down during a warm boot.

Call the BMIC Flush Cache command (0xc2) to indicate the reason for the
flush cache (shutdown, hibernate, suspend, or restart).

Link: https://lore.kernel.org/r/164375208810.440833.11254644025650871435.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: Sagar Biradar <sagar.biradar@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: Enable SATA NCQ priority in sysfs
Gilbert Wu [Tue, 1 Feb 2022 21:48:03 +0000 (15:48 -0600)]
scsi: smartpqi: Enable SATA NCQ priority in sysfs

Add device attribute 'sas_ncq_prio_enable' to enable SATA NCQ priority
support and provide I/O priority in SCSI command and pass priority
information to controller firmware.

This device attribute works only when device has NCQ priority support and
controller firmware can handle I/Os with NCQ priority attribute.

Link: https://lore.kernel.org/r/164375208306.440833.7392577382127815362.stgit@brunhilda.pdev.net
Reviewed-by: Mike McGowen <mike.mcgowen@microchip.com>
Reviewed-by: Scott Teel <scott.teel@microchip.com>
Signed-off-by: Gilbert Wu <Gilbert.Wu@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: Add PCI IDs
Don Brace [Tue, 1 Feb 2022 21:47:58 +0000 (15:47 -0600)]
scsi: smartpqi: Add PCI IDs

Add in new ZTE controllers:
                                    VID  / DID  / SVID / SDID
                                    ----   ----   ----   ----
ZTE SmartROC3100 RS241-18i 2G       9005 / 028F / 1CF2 / 5449
ZTE SmartROC3100 RS242-18i 4G       9005 / 028F / 1CF2 / 544A
ZTE SmartIOC2100 RS243-18i          9005 / 028F / 1CF2 / 544B
ZTE SmartROC3100 RM241B-18i 2G      9005 / 028F / 1CF2 / 544D
ZTE SmartROC3100 RM242B-18i 4G      9005 / 028F / 1CF2 / 544E
ZTE SmartIOC2100 RM243B-18i         9005 / 028F / 1CF2 / 544F

Add PCI ID for 1100-24i controller:
                                    VID  / DID  / SVID / SDID
                                    ----   ----   ----   ----
HBA 1100-24i                        9005 / 028F / 9005 / 1304

Add PCI IDs for HPE and Adaptec devices:
                                    VID  / DID  / SVID / SDID
                                    ----   ----   ----   ----
Adaptec Smart HBA 2200-8io /e       9005 / 028F / 9005 / 1463
Adaptec Smart HBA 2200-16io /e      9005 / 028F / 9005 / 14C2
HPE SR308i-p Gen11                  9005 / 028F / 1590 / 0382
HPE SR308i-o Gen11                  9005 / 028F / 1590 / 0383
HPE SR932i-p Gen11                  9005 / 028F / 1590 / 0381

Add PCI IDs for Inspur controllers:
                                    VID  / DID  / SVID / SDID
                                    ----   ----   ----   ----
INSPUR RS0800M5H24i                 9005 / 028F / 1BD4 / 006B
INSPUR RS0800M5E8I                  9005 / 028F / 1BD4 / 006C
INSPUR RS0800M5H8I                  9005 / 028F / 1BD4 / 006D
INSPUR RS0804M5R16i                 9005 / 028F / 1BD4 / 006F
INSPUR RS0800M5E16i                 9005 / 028F / 1BD4 / 0070
INSPUR RS0800M5H16i                 9005 / 028F / 1BD4 / 0071
INSPUR RS0800M5E16i                 9005 / 028F / 1BD4 / 0072
NT RAID 3100-24i                    9005 / 028F / 1F0C / 3161

Add HPE and Adaptec OROC PCI IDs:
                                    VID  / DID  / SVID / SDID
                                    ----   ----   ----   ----
HPE SR216i-o Gen11                  9005 / 028F / 9005 / 036F
Adaptec SmartRAID 3284-16io /e/uC   9005 / 028F / 9005 / 1473
Adaptec SmartRAID 3254-16io /e      9005 / 028F / 9005 / 1474

Add PCI IDs for new channel controllers:
                                    VID  / DID  / SVID / SDID
                                    ----   ----   ----   ----
Adaptec SmartRAID 3254-8i /e        9005 / 028F / 9005 / 14A4
Adaptec SmartRAID 3252-8i /e        9005 / 028F / 9005 / 14A5
Adaptec SmartRAID 3204-8i /e        9005 / 028F / 9005 / 14A6

Align PCI IDs with OOB driver. Easier to check for differences.

Link: https://lore.kernel.org/r/164375207802.440833.15947108153078495425.stgit@brunhilda.pdev.net
Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Scott Teel <scott.teel@microchip.com>
Co-developed-by: Mike McGowen <Mike.McGowen@microchip.com>
Signed-off-by: Mike McGowen <Mike.McGowen@microchip.com>
Co-developed-by: Murthy Bhat <Murthy.Bhat@microchip.com>
Signed-off-by: Murthy Bhat <Murthy.Bhat@microchip.com>
Co-developed-by: Sagar Biradar <sagar.biradar@microchip.com>
Signed-off-by: Sagar Biradar <sagar.biradar@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 rmmod stack trace
Don Brace [Tue, 1 Feb 2022 21:47:53 +0000 (15:47 -0600)]
scsi: smartpqi: Fix rmmod stack trace

Prevent "BUG: scheduling while atomic: rmmod" stack trace.

Stop setting spin_locks before calling OS functions to remove devices.

Link: https://lore.kernel.org/r/164375207296.440833.4996145011193819683.stgit@brunhilda.pdev.net
Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Scott Teel <scott.teel@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: mpt3sas: Convert to flexible arrays
Kees Cook [Tue, 1 Feb 2022 22:39:48 +0000 (14:39 -0800)]
scsi: mpt3sas: Convert to flexible arrays

This converts to a flexible array instead of the old-style 1-element
arrays. The existing code already did the correct math for finding the size
of the resulting flexible array structure, so there is no binary
difference.

The other two structures converted to use flexible arrays appear to have no
users at all.

Link: https://lore.kernel.org/r/20220201223948.1455637-1-keescook@chromium.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: usb: storage: Complete the SCSI request directly
Sebastian Andrzej Siewior [Tue, 1 Feb 2022 21:09:54 +0000 (22:09 +0100)]
scsi: usb: storage: Complete the SCSI request directly

The USB storage driver can complete its requests directly from a kernel
thread. Use scsi_done_direct() to avoid waking ksoftirqd.

Link: https://lore.kernel.org/r/20220201210954.570896-3-sebastian@breakpoint.cc
Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: core: Add scsi_done_direct() for immediate completion
Sebastian Andrzej Siewior [Thu, 3 Feb 2022 20:29:25 +0000 (21:29 +0100)]
scsi: core: Add scsi_done_direct() for immediate completion

Add scsi_done_direct() which behaves like scsi_done() except that it
invokes blk_mq_complete_request_direct() in order to complete the request.

Callers from process context can complete the request directly instead
waking ksoftirqd.

Link: https://lore.kernel.org/r/Yfw7JaszshmfYa1d@flow
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: core: Make "access_state" sysfs attribute always visible
Martin Wilck [Thu, 27 Jan 2022 14:13:51 +0000 (15:13 +0100)]
scsi: core: Make "access_state" sysfs attribute always visible

If a SCSI device handler module is loaded after some SCSI devices have
already been probed (e.g. via request_module() by dm-multipath), the
"access_state" and "preferred_path" sysfs attributes remain invisible for
these devices, although the handler is attached and live. The reason is
that the visibility is only checked when the sysfs attribute group is first
created. This results in an inconsistent user experience depending on the
load order of SCSI low-level drivers vs. device handler modules.

This patch changes user space API: attempting to read the "access_state" or
"preferred_path" attributes will now result in -EINVAL rather than -ENODEV
for devices that have no device handler, and tests for the existence of
these attributes will have a different result.

Link: https://lore.kernel.org/r/20220127141351.30706-1-mwilck@suse.com
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: lpfc: Remove redundant flush_workqueue() call
Minghao Chi (CGEL ZTE) [Thu, 27 Jan 2022 01:43:30 +0000 (01:43 +0000)]
scsi: lpfc: Remove redundant flush_workqueue() call

destroy_workqueue() already drains the queue before destroying it, so there
is no need to flush it explicitly.

Remove the redundant flush_workqueue() call.

Link: https://lore.kernel.org/r/20220127014330.1185114-1-chi.minghao@zte.com.cn
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>
Signed-off-by: CGEL ZTE <cgel.zte@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: qedi: Remove redundant flush_workqueue() calls
Minghao Chi (CGEL ZTE) [Thu, 27 Jan 2022 01:39:34 +0000 (01:39 +0000)]
scsi: qedi: Remove redundant flush_workqueue() calls

destroy_workqueue() already drains the queue before destroying it, so there
is no need to flush it explicitly.

Remove the redundant flush_workqueue() calls.

Link: https://lore.kernel.org/r/20220127013934.1184923-1-chi.minghao@zte.com.cn
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>
Signed-off-by: CGEL ZTE <cgel.zte@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 years agoscsi: bfa: Replace snprintf() with sysfs_emit()
Yang Guang [Thu, 27 Jan 2022 00:03:46 +0000 (08:03 +0800)]
scsi: bfa: Replace snprintf() with sysfs_emit()

coccinelle report:
./drivers/scsi/bfa/bfad_attr.c:908:8-16:
WARNING: use scnprintf or sprintf
./drivers/scsi/bfa/bfad_attr.c:860:8-16:
WARNING: use scnprintf or sprintf
./drivers/scsi/bfa/bfad_attr.c:888:8-16:
WARNING: use scnprintf or sprintf
./drivers/scsi/bfa/bfad_attr.c:853:8-16:
WARNING: use scnprintf or sprintf
./drivers/scsi/bfa/bfad_attr.c:808:8-16:
WARNING: use scnprintf or sprintf
./drivers/scsi/bfa/bfad_attr.c:728:8-16:
WARNING: use scnprintf or sprintf
./drivers/scsi/bfa/bfad_attr.c:822:8-16:
WARNING: use scnprintf or sprintf
./drivers/scsi/bfa/bfad_attr.c:927:9-17:
WARNING: use scnprintf or sprintf
./drivers/scsi/bfa/bfad_attr.c:900:8-16:
WARNING: use scnprintf or sprintf
./drivers/scsi/bfa/bfad_attr.c:874:8-16:
WARNING: use scnprintf or sprintf
./drivers/scsi/bfa/bfad_attr.c:714:8-16:
WARNING: use scnprintf or sprintf
./drivers/scsi/bfa/bfad_attr.c:839:8-16:
WARNING: use scnprintf or sprintf

Use sysfs_emit() instead of scnprintf() or sprintf().

Link: https://lore.kernel.org/r/def83ff75faec64ba592b867a8499b1367bae303.1643181468.git.yang.guang5@zte.com.cn
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
Signed-off-by: David Yang <davidcomponentone@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>