]> git.ipfire.org Git - thirdparty/kernel/linux.git/log
thirdparty/kernel/linux.git
6 months agoscsi: core: Add passthrough tests for success and no failure definitions
Mike Christie [Mon, 13 Jan 2025 18:07:57 +0000 (12:07 -0600)] 
scsi: core: Add passthrough tests for success and no failure definitions

This patch adds scsi_check_passthrough() tests for the cases where a
command completes successfully and when the command failed but the caller
did not pass in a list of failures.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
Link: https://lore.kernel.org/r/20250113180757.16691-1-michael.christie@oracle.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoMerge patch series "Introduce support for Fabric Discovery and Login Services"
Martin K. Petersen [Tue, 14 Jan 2025 16:35:50 +0000 (11:35 -0500)] 
Merge patch series "Introduce support for Fabric Discovery and Login Services"

Karan Tilak Kumar <kartilak@cisco.com> says:

Hi Martin, reviewers,

This cover letter describes the feature: add support for Fabric
Discovery and Login Services (FDLS) to fnic driver.

This functionality is needed to support port channel RSCN (PC-RSCN)
handling and serves as a base to create FC-NVME initiators
(planned later), and eCPU handling (planned later).

It is used to discover the fabric and target ports associated with the
fabric.  It will then login to the target ports that are zoned to it.
The driver uses the tport structure presented by FDLS.

Port channel RSCN is a Cisco vendor specific RSCN event. It is
applicable only to Cisco UCS fabrics.

In cases where the eCPU in the UCS VIC (Unified Computing Services
Virtual Interface Card) hangs, a fabric log out is sent to the fabric.
Upon successful log out from the fabric, the IO path is failed over to
a new path.

Generally from a feature perspective, the code is divided into adding
support for this functionality initially. Then, code has been added to
modify the IO path and interfaces. Finally, support for port channel
RSCN handling has been added.

Here are the headers of some of the salient patches:

o add headers and definitions for FDLS
o add support for fabric based solicited requests and responses
o add support for target based solicited requests and responses
o add support for unsolicited requests and responses
o add support for FDMI
o add support for FIP
o add functionality in fnic to support FDLS
o modify IO path to use FDLS and tport
o modify fnic interfaces to use FDLS
o add support to handle port channel RSCN

Even though the patches have been made into a series, some patches are
heavier than others. But, every effort has been made to keep the
purpose of each patch as a single-purpose, and to compile cleanly.
All the individual patches compile cleanly. The compiler used is GCC
13.3. Some function calls have been coded as placeholders with
appropriate comments to avoid compiler warnings.

This patchset has been tested as a whole. Therefore, the tested-by
fields have been added only to one patch in the set.  I've refrained
from adding tested-by to most of the patches, so as to not mislead the
reviewer/reader.

A brief note on the unit tests:

o. Perform zone in zone out testing in a loop: remove a target
port from the zone, add it to the zone in a loop. 1000+ iterations
of this test have been successful.

o. Configure multipathing, and run link flaps on single link.
IOs drop briefly, but pick up as expected.

o. Configure multipathing, and run link flaps on two links, with a
30 second delay in between. IOs drop briefly, but pick up as expected.

o. Module load/unload test.

o. Repeat the above tests with 1 queue and 64 queues.
All tests were successful.

Please consider this patch series for the next merge window.

Link: https://lore.kernel.org/r/20241212020312.4786-1-kartilak@cisco.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: fnic: Propagate SCSI error code from fnic_scsi_drv_init()
Arun Easi [Fri, 10 Jan 2025 09:19:56 +0000 (01:19 -0800)] 
scsi: fnic: Propagate SCSI error code from fnic_scsi_drv_init()

Propagate scsi_add_host() error instead of returning -1.

Suggested-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Sesidhar Baddela <sebaddel@cisco.com>
Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Reviewed-by: Gian Carlo Boffa <gcboffa@cisco.com>
Signed-off-by: Arun Easi <aeasi@cisco.com>
Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
Link: https://lore.kernel.org/r/20250110091956.17749-1-kartilak@cisco.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: fnic: Test for memory allocation failure and return error code
Karan Tilak Kumar [Fri, 10 Jan 2025 09:19:24 +0000 (01:19 -0800)] 
scsi: fnic: Test for memory allocation failure and return error code

Fix kernel test robot warning.  Test for memory allocation failure, and
free memory for queues allocated in a multiqueue and non-multiqueue
scenario.  Return appropriate error code.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/r/202412312347.FE4ZgEoM-lkp@intel.com/
Reported-by: Julia Lawall <julia.lawall@inria.fr>
Closes: https://lore.kernel.org/r/202412312347.FE4ZgEoM-lkp@intel.com/
Reviewed-by: Sesidhar Baddela <sebaddel@cisco.com>
Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Reviewed-by: Gian Carlo Boffa <gcboffa@cisco.com>
Reviewed-by: Arun Easi <aeasi@cisco.com>
Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
Link: https://lore.kernel.org/r/20250110091924.17729-1-kartilak@cisco.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: fnic: Return appropriate error code from failure of scsi drv init
Karan Tilak Kumar [Fri, 10 Jan 2025 09:18:42 +0000 (01:18 -0800)] 
scsi: fnic: Return appropriate error code from failure of scsi drv init

Return appropriate error code from fnic_probe caused by failure of
fnic_scsi_drv_init. Fix bug report.

Suggested-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Sesidhar Baddela <sebaddel@cisco.com>
Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Reviewed-by: Gian Carlo Boffa <gcboffa@cisco.com>
Reviewed-by: Arun Easi <aeasi@cisco.com>
Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
Link: https://lore.kernel.org/r/20250110091842.17711-1-kartilak@cisco.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: fnic: Return appropriate error code for mem alloc failure
Karan Tilak Kumar [Fri, 10 Jan 2025 09:17:46 +0000 (01:17 -0800)] 
scsi: fnic: Return appropriate error code for mem alloc failure

Return appropriate error code from fnic_probe when memory create slab pool
fails. Fix bug report.

Suggested-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Sesidhar Baddela <sebaddel@cisco.com>
Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Reviewed-by: Gian Carlo Boffa <gcboffa@cisco.com>
Reviewed-by: Arun Easi <aeasi@cisco.com>
Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
Link: https://lore.kernel.org/r/20250110091746.17671-1-kartilak@cisco.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: fnic: Remove always-true IS_FNIC_FCP_INITIATOR macro
Arun Easi [Fri, 10 Jan 2025 09:16:55 +0000 (01:16 -0800)] 
scsi: fnic: Remove always-true IS_FNIC_FCP_INITIATOR macro

IS_FNIC_FCP_INITIATOR macro is not applicable at this time.  Delete the
macro.

Suggested-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Sesidhar Baddela <sebaddel@cisco.com>
Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Reviewed-by: Gian Carlo Boffa <gcboffa@cisco.com>
Signed-off-by: Arun Easi <aeasi@cisco.com>
Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
Link: https://lore.kernel.org/r/20250110091655.17643-1-kartilak@cisco.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: fnic: Fix use of uninitialized value in debug message
Dheeraj Reddy Jonnalagadda [Wed, 8 Jan 2025 05:09:16 +0000 (10:39 +0530)] 
scsi: fnic: Fix use of uninitialized value in debug message

The oxid variable in fdls_process_abts_req() was only being initialized
inside the if (tport) block, but was being used in a debug print statement
after that block. If tport was NULL, oxid would remain uninitialized.  Move
the oxid initialization to happen at declaration using
FNIC_STD_GET_OX_ID(fchdr).

Fixes: f828af44b8dd ("scsi: fnic: Add support for unsolicited requests and responses")
Closes: https://scan7.scan.coverity.com/#/project-view/52337/11354?selectedIssue=1602772
Signed-off-by: Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@gmail.com>
Link: https://lore.kernel.org/r/20250108050916.52721-1-dheeraj.linuxdev@gmail.com
Reviewed-by: Karan Tilak Kumar <kartilak@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: fnic: Delete incorrect debugfs error handling
Dan Carpenter [Tue, 7 Jan 2025 13:35:19 +0000 (16:35 +0300)] 
scsi: fnic: Delete incorrect debugfs error handling

Debugfs functions are not supposed to require error checking and, in fact,
adding checks would normally lead to the driver refusing to load when
CONFIG_DEBUGFS is disabled.

What saves us here is that this code checks for NULL instead of error
pointers so the error checking is all dead code.  Delete it.

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/a5c237cd-449b-4f9d-bcff-6285fb7c28d1@stanley.mountain
Reviewed-by: Karan Tilak Kumar <kartilak@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: fnic: Remove unnecessary else to fix warning in FDLS FIP
Karan Tilak Kumar [Mon, 6 Jan 2025 22:44:51 +0000 (14:44 -0800)] 
scsi: fnic: Remove unnecessary else to fix warning in FDLS FIP

Implement review comments from Martin:
    Remove unnecessary else from fip.c to fix a warning.

Reviewed-by: Sesidhar Baddela <sebaddel@cisco.com>
Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Reviewed-by: Gian Carlo Boffa <gcboffa@cisco.com>
Reviewed-by: Arun Easi <aeasi@cisco.com>
Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
Link: https://lore.kernel.org/r/20250106224451.3597-3-kartilak@cisco.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: fnic: Remove extern definition from .c files
Karan Tilak Kumar [Mon, 6 Jan 2025 22:44:50 +0000 (14:44 -0800)] 
scsi: fnic: Remove extern definition from .c files

Implement review comments from Martin:
    Remove extern definition of fnic_fip_queue from .c files

Reviewed-by: Sesidhar Baddela <sebaddel@cisco.com>
Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Reviewed-by: Gian Carlo Boffa <gcboffa@cisco.com>
Reviewed-by: Arun Easi <aeasi@cisco.com>
Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
Link: https://lore.kernel.org/r/20250106224451.3597-2-kartilak@cisco.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: fnic: Remove unnecessary else and unnecessary break in FDLS
Karan Tilak Kumar [Mon, 6 Jan 2025 22:44:49 +0000 (14:44 -0800)] 
scsi: fnic: Remove unnecessary else and unnecessary break in FDLS

Incorporate review comments from Martin:
    Remove unnecessary else and unnecessary break to fix warnings
    in the FDLS code.

Reviewed-by: Sesidhar Baddela <sebaddel@cisco.com>
Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Reviewed-by: Gian Carlo Boffa <gcboffa@cisco.com>
Reviewed-by: Arun Easi <aeasi@cisco.com>
Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
Link: https://lore.kernel.org/r/20250106224451.3597-1-kartilak@cisco.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: mpi3mr: Fix possible crash when setting up bsg fails
Guixin Liu [Tue, 7 Jan 2025 02:20:32 +0000 (10:20 +0800)] 
scsi: mpi3mr: Fix possible crash when setting up bsg fails

If bsg_setup_queue() fails, the bsg_queue is assigned a non-NULL value.
Consequently, in mpi3mr_bsg_exit(), the condition "if(!mrioc->bsg_queue)"
will not be satisfied, preventing execution from entering
bsg_remove_queue(), which could lead to the following crash:

BUG: kernel NULL pointer dereference, address: 000000000000041c
Call Trace:
  <TASK>
  mpi3mr_bsg_exit+0x1f/0x50 [mpi3mr]
  mpi3mr_remove+0x6f/0x340 [mpi3mr]
  pci_device_remove+0x3f/0xb0
  device_release_driver_internal+0x19d/0x220
  unbind_store+0xa4/0xb0
  kernfs_fop_write_iter+0x11f/0x200
  vfs_write+0x1fc/0x3e0
  ksys_write+0x67/0xe0
  do_syscall_64+0x38/0x80
  entry_SYSCALL_64_after_hwframe+0x78/0xe2

Fixes: 4268fa751365 ("scsi: mpi3mr: Add bsg device support")
Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
Link: https://lore.kernel.org/r/20250107022032.24006-1-kanie@linux.alibaba.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: ufs: bsg: Set bsg_queue to NULL after removal
Guixin Liu [Wed, 18 Dec 2024 01:42:14 +0000 (09:42 +0800)] 
scsi: ufs: bsg: Set bsg_queue to NULL after removal

Currently, this does not cause any issues, but I believe it is necessary to
set bsg_queue to NULL after removing it to prevent potential use-after-free
(UAF) access.

Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
Link: https://lore.kernel.org/r/20241218014214.64533-3-kanie@linux.alibaba.com
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: ufs: bsg: Delete bsg_dev when setting up bsg fails
Guixin Liu [Wed, 18 Dec 2024 01:42:13 +0000 (09:42 +0800)] 
scsi: ufs: bsg: Delete bsg_dev when setting up bsg fails

We should remove the bsg device when bsg_setup_queue() fails to release the
resources.

Fixes: df032bf27a41 ("scsi: ufs: Add a bsg endpoint that supports UPIUs")
Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
Link: https://lore.kernel.org/r/20241218014214.64533-2-kanie@linux.alibaba.com
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: st: Don't set pos_unknown just after device recognition
Kai Mäkisara [Mon, 16 Dec 2024 11:37:55 +0000 (13:37 +0200)] 
scsi: st: Don't set pos_unknown just after device recognition

Commit 9604eea5bd3a ("scsi: st: Add third party poweron reset handling") in
v6.6 added new code to handle the Power On/Reset Unit Attention (POR UA)
sense data. This was in addition to the existing method. When this Unit
Attention is received, the driver blocks attempts to read, write and some
other operations because the reset may have rewinded the tape. Because of
the added code, also the initial POR UA resulted in blocking operations,
including those that are used to set the driver options after the device is
recognized. Also, reading and writing are refused, whereas they succeeded
before this commit.

Add code to not set pos_unknown to block operations if the POR UA is
received from the first test_ready() call after the st device has been
created. This restores the behavior before v6.6.

Signed-off-by: Kai Mäkisara <Kai.Makisara@kolumbus.fi>
Link: https://lore.kernel.org/r/20241216113755.30415-1-Kai.Makisara@kolumbus.fi
Fixes: 9604eea5bd3a ("scsi: st: Add third party poweron reset handling")
CC: stable@vger.kernel.org
Closes: https://lore.kernel.org/linux-scsi/2201CF73-4795-4D3B-9A79-6EE5215CF58D@kolumbus.fi/
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: aic7xxx: Fix build 'aicasm' warning
wangdicheng [Fri, 6 Dec 2024 07:19:26 +0000 (15:19 +0800)] 
scsi: aic7xxx: Fix build 'aicasm' warning

When building with CONFIG_AIC7XXX_BUILD_FIRMWARE=y or
CONFIG_AIC79XX_BUILD_FIRMWARE=y, the warning messages are as follows:

  aicasm_gram.tab.c:1722:16: warning: implicit declaration of function
    ‘yylex’ [-Wimplicit-function-declaration]

  aicasm_macro_gram.c:68:25: warning: implicit declaration of function
    ‘mmlex’ [-Wimplicit-function-declaration]

  aicasm_scan.l:417:6: warning: implicit declaration of function
    ‘mm_switch_to_buffer’

  aicasm_scan.l:418:6: warning: implicit declaration of function
    ‘mmparse’

  aicasm_scan.l:421:6: warning: implicit declaration of function
    ‘mm_delete_buffer’

The solution is to add the corresponding function declaration to the
corresponding file.

Signed-off-by: wangdicheng <wangdicheng@kylinos.cn>
Signed-off-by: huanglei <huanglei@kylinos.cn>
Link: https://lore.kernel.org/r/20241206071926.63832-1-wangdich9700@163.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: Revert "scsi: ufs: core: Probe for EXT_IID support"
Avri Altman [Fri, 3 Jan 2025 08:02:04 +0000 (10:02 +0200)] 
scsi: Revert "scsi: ufs: core: Probe for EXT_IID support"

This reverts commit 6e1d850acff9477ae4c18a73c19ef52841ac2010.

Although added a while ago, to date no one make use of ext_iid,
specifically incorporates it in the upiu header.  Therefore, remove it as
it is currently unused and not serving any purpose.

Signed-off-by: Avri Altman <avri.altman@wdc.com>
Link: https://lore.kernel.org/r/20250103080204.63951-1-avri.altman@wdc.com
Cc: Can Guo <quic_cang@quicinc.com>
Cc: Asutosh Das <quic_asutoshd@quicinc.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: storvsc: Ratelimit warning logs to prevent VM denial of service
Easwar Hariharan [Tue, 7 Jan 2025 17:28:40 +0000 (17:28 +0000)] 
scsi: storvsc: Ratelimit warning logs to prevent VM denial of service

If there's a persistent error in the hypervisor, the SCSI warning for
failed I/O can flood the kernel log and max out CPU utilization,
preventing troubleshooting from the VM side. Ratelimit the warning so
it doesn't DoS the VM.

Closes: https://github.com/microsoft/WSL/issues/9173
Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com>
Link: https://lore.kernel.org/r/20250107-eahariha-ratelimit-storvsc-v1-1-7fc193d1f2b0@linux.microsoft.com
Reviewed-by: Michael Kelley <mhklinux@outlook.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: scsi_debug: Constify sdebug_driver_template
John Garry [Tue, 7 Jan 2025 15:33:25 +0000 (15:33 +0000)] 
scsi: scsi_debug: Constify sdebug_driver_template

It's better to have sdebug_driver_template as const, so update the probe
path to set the shost members directly after allocation and make that
change.

Signed-off-by: John Garry <john.g.garry@oracle.com>
Link: https://lore.kernel.org/r/20250107153325.1689432-1-john.g.garry@oracle.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoMerge branch '6.13/scsi-fixes' into 6.14/scsi-staging
Martin K. Petersen [Fri, 10 Jan 2025 20:20:30 +0000 (15:20 -0500)] 
Merge branch '6.13/scsi-fixes' into 6.14/scsi-staging

Pull in fixes branch to resolve merge conflict in ufs-qcom.c.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: documentation: Corrections for struct updates
Randy Dunlap [Sat, 21 Dec 2024 21:25:39 +0000 (13:25 -0800)] 
scsi: documentation: Corrections for struct updates

Update scsi_mid_low_api.rst for changes to struct scsi_host and
struct scsi_cmnd.

struct scsi_host:

 - no_async_abort is gone

 - drop sh_list w/ no replacement

 - change my_devices to __devices

struct scsi_cmnd:

 - removed 'done' (now in struct scsi_driver); use scsi_done() or
   scsi_done_direct() callbacks

 - change previous request_bufflen to scsi_bufflen()

 - change previous use_sg field to scsi_dma_map() or scsi_sg_count()

 - change previous request_buffer field to reference to 'usg_sg' text

[mkp: removed more obsolete stuff]

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/r/20241221212539.1314560-1-rdunlap@infradead.org
Cc: James E.J. Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: linux-doc@vger.kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: driver-api: documentation: Change what is added to docbook
Randy Dunlap [Wed, 18 Dec 2024 00:07:48 +0000 (16:07 -0800)] 
scsi: driver-api: documentation: Change what is added to docbook

For scsi_devinfo.c, use :export: so that exported symbols are put into the
docbook. Drop :internal: -- they aren't needed in the docbook.

For scsi_proc.c, drop :internal:. This will cause all documented private
(as is already done) and exported symbols to be added to the docbook.

For scsi_scan.c, switch from :internal: to :export: so that exported
symbols are put into the generated docbook.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/r/20241218000748.932850-1-rdunlap@infradead.org
Cc: James E.J. Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: linux-doc@vger.kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: transport: sas: spi: Fix kernel-doc for exported functions
Randy Dunlap [Thu, 12 Dec 2024 20:52:17 +0000 (12:52 -0800)] 
scsi: transport: sas: spi: Fix kernel-doc for exported functions

Fix kernel-doc for sas_port_alloc(), sas_port_alloc_num(), and
spi_dv_device().  This allows them to be part of the SCSI driver-api
docbook.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/r/20241212205217.597844-6-rdunlap@infradead.org
CC: James E.J. Bottomley <James.Bottomley@HansenPartnership.com>
CC: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: scsi_scan: Add kernel-doc for exported function
Randy Dunlap [Thu, 12 Dec 2024 20:52:16 +0000 (12:52 -0800)] 
scsi: scsi_scan: Add kernel-doc for exported function

Add kernel-doc for scsi_add_device() since it is exported.  This allows it
to be part of the SCSI driver-api docbook.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/r/20241212205217.597844-5-rdunlap@infradead.org
CC: James E.J. Bottomley <James.Bottomley@HansenPartnership.com>
CC: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: scsi_lib: Add kernel-doc for exported functions
Randy Dunlap [Thu, 12 Dec 2024 20:52:15 +0000 (12:52 -0800)] 
scsi: scsi_lib: Add kernel-doc for exported functions

Add kernel-doc for scsi_failures_reset_retries() and scsi_alloc_request()
since these are exported.  This allows them to be part of the SCSI
driver-api docbook.

Fix kernel-doc comments for scsi_vpd_tpg_id() [add kernel-doc for one
parameter and fix a typo].

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/r/20241212205217.597844-4-rdunlap@infradead.org
CC: James E.J. Bottomley <James.Bottomley@HansenPartnership.com>
CC: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: scsi_ioctl: Add kernel-doc for exported functions
Randy Dunlap [Thu, 12 Dec 2024 20:52:14 +0000 (12:52 -0800)] 
scsi: scsi_ioctl: Add kernel-doc for exported functions

Add kernel-doc for scsi_set_medium_removal(), scsi_cmd_allowed(), and
scsi_ioctl_block_when_processing_errors() since these are exported.  This
allows them to be part of the SCSI driver-api docbook.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/r/20241212205217.597844-3-rdunlap@infradead.org
CC: James E.J. Bottomley <James.Bottomley@HansenPartnership.com>
CC: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: scsi_error: Add kernel-doc for exported functions
Randy Dunlap [Thu, 12 Dec 2024 20:52:13 +0000 (12:52 -0800)] 
scsi: scsi_error: Add kernel-doc for exported functions

Convert scsi_report_bus_reset() and scsi_report_device_reset() to
kernel-doc since they are exported. This allows them to be part of the
driver-api/scsi.rst docbook.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/r/20241212205217.597844-2-rdunlap@infradead.org
CC: James E.J. Bottomley <James.Bottomley@HansenPartnership.com>
CC: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: fnic: Increment driver version
Karan Tilak Kumar [Thu, 12 Dec 2024 02:03:12 +0000 (18:03 -0800)] 
scsi: fnic: Increment driver version

Increment driver version to 1.8.0.0

Reviewed-by: Sesidhar Baddela <sebaddel@cisco.com>
Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Reviewed-by: Gian Carlo Boffa <gcboffa@cisco.com>
Tested-by: Karan Tilak Kumar <kartilak@cisco.com>
Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
Link: https://lore.kernel.org/r/20241212020312.4786-16-kartilak@cisco.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: fnic: Add support to handle port channel RSCN
Karan Tilak Kumar [Thu, 12 Dec 2024 02:03:11 +0000 (18:03 -0800)] 
scsi: fnic: Add support to handle port channel RSCN

Add support to handle port channel RSCN.

Port channel RSCN is a Cisco vendor specific RSCN event. It is applicable
only to Cisco UCS fabrics.  If there's a change in the port channel
configuration, an RCSN is sent to fnic. This is used to serially reset the
scsi initiator fnics so that there's no all paths down scenario. The
affected fnics are added to a list that are reset with a small time gap
between them.

Reviewed-by: Sesidhar Baddela <sebaddel@cisco.com>
Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Reviewed-by: Gian Carlo Boffa <gcboffa@cisco.com>
Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
Link: https://lore.kernel.org/r/20241212020312.4786-15-kartilak@cisco.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: fnic: Code cleanup
Karan Tilak Kumar [Thu, 12 Dec 2024 02:03:10 +0000 (18:03 -0800)] 
scsi: fnic: Code cleanup

Replace existing host structure with fnic host.

Add headers from scsi to support new functionality.

Remove unused code and declarations.

Reviewed-by: Sesidhar Baddela <sebaddel@cisco.com>
Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Reviewed-by: Gian Carlo Boffa <gcboffa@cisco.com>
Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
Link: https://lore.kernel.org/r/20241212020312.4786-14-kartilak@cisco.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: fnic: Add stats and related functionality
Karan Tilak Kumar [Thu, 12 Dec 2024 02:03:09 +0000 (18:03 -0800)] 
scsi: fnic: Add stats and related functionality

Add statistics and related functionality for FDLS.

Add supporting functions to display stats.

Reviewed-by: Sesidhar Baddela <sebaddel@cisco.com>
Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Reviewed-by: Gian Carlo Boffa <gcboffa@cisco.com>
Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
Link: https://lore.kernel.org/r/20241212020312.4786-13-kartilak@cisco.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: fnic: Modify fnic interfaces to use FDLS
Karan Tilak Kumar [Thu, 12 Dec 2024 02:03:08 +0000 (18:03 -0800)] 
scsi: fnic: Modify fnic interfaces to use FDLS

Modify fnic driver interfaces to use FDLS and supporting functions.

Refactor code in fnic_probe and fnic_remove.

Get fnic from shost_priv.

Add error handling in stats processing functions.

Modify some print statements.

Add support to do module unload cleanup.

Use placeholder functions/modify function declarations to not break
compilation.

Reviewed-by: Sesidhar Baddela <sebaddel@cisco.com>
Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Reviewed-by: Gian Carlo Boffa <gcboffa@cisco.com>
Co-developed-by: Arun Easi <aeasi@cisco.com>
Signed-off-by: Arun Easi <aeasi@cisco.com>
Co-developed-by: Karan Tilak Kumar <kartilak@cisco.com>
Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
Link: https://lore.kernel.org/r/20241212020312.4786-12-kartilak@cisco.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: fnic: Modify IO path to use FDLS
Karan Tilak Kumar [Thu, 12 Dec 2024 02:03:07 +0000 (18:03 -0800)] 
scsi: fnic: Modify IO path to use FDLS

Modify IO path to use FDLS.

Add helper functions to process IOs.

Remove unused template functions.

Clean up obsolete code.

Refactor old function definitions.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202410210147.fQp7tYeb-lkp@intel.com/
Reviewed-by: Sesidhar Baddela <sebaddel@cisco.com>
Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Reviewed-by: Gian Carlo Boffa <gcboffa@cisco.com>
Reviewed-by: Arun Easi <aeasi@cisco.com>
Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
Link: https://lore.kernel.org/r/20241212020312.4786-11-kartilak@cisco.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: fnic: Add functionality in fnic to support FDLS
Karan Tilak Kumar [Thu, 12 Dec 2024 02:03:06 +0000 (18:03 -0800)] 
scsi: fnic: Add functionality in fnic to support FDLS

Add interfaces in fnic to use FDLS services.

Modify link up and link down functionality to use FDLS.

Replace existing interfaces to handle new functionality provided by FDLS.

Modify data types of some data members to handle new functionality.

Add processing of tports and handling of tports.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202409292037.ZYWZwIK6-lkp@intel.com/
Reviewed-by: Sesidhar Baddela <sebaddel@cisco.com>
Co-developed-by: Gian Carlo Boffa <gcboffa@cisco.com>
Signed-off-by: Gian Carlo Boffa <gcboffa@cisco.com>
Co-developed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Signed-off-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Co-developed-by: Arun Easi <aeasi@cisco.com>
Signed-off-by: Arun Easi <aeasi@cisco.com>
Co-developed-by: Karan Tilak Kumar <kartilak@cisco.com>
Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
Link: https://lore.kernel.org/r/20241212020312.4786-10-kartilak@cisco.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: fnic: Add and integrate support for FIP
Karan Tilak Kumar [Thu, 12 Dec 2024 02:03:05 +0000 (18:03 -0800)] 
scsi: fnic: Add and integrate support for FIP

Add and integrate support for FCoE Initialization (protocol) FIP. This
protocol will be exercised on Cisco UCS rack servers.

Add support to specifically print FIP related debug messages.

Replace existing definitions to handle new data structures.

Clean up old and obsolete definitions.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202409291955.FcMZfNSt-lkp@intel.com/
Closes: https://lore.kernel.org/oe-kbuild-all/202412081904.pXwdx15J-lkp@intel.com/
Reviewed-by: Sesidhar Baddela <sebaddel@cisco.com>
Co-developed-by: Gian Carlo Boffa <gcboffa@cisco.com>
Signed-off-by: Gian Carlo Boffa <gcboffa@cisco.com>
Co-developed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Signed-off-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Co-developed-by: Arun Easi <aeasi@cisco.com>
Signed-off-by: Arun Easi <aeasi@cisco.com>
Co-developed-by: Karan Tilak Kumar <kartilak@cisco.com>
Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
Link: https://lore.kernel.org/r/20241212020312.4786-9-kartilak@cisco.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: fnic: Add and integrate support for FDMI
Karan Tilak Kumar [Thu, 12 Dec 2024 02:03:04 +0000 (18:03 -0800)] 
scsi: fnic: Add and integrate support for FDMI

Add support for Fabric-Device Management Interface (FDMI) by introducing
PCI device IDs for Cisco Hardware.

Introduce a module parameter to enable/disable FDMI support.

Integrate support for FDMI.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202406110734.p2v8dq9v-lkp@intel.com/
Reviewed-by: Sesidhar Baddela <sebaddel@cisco.com>
Co-developed-by: Gian Carlo Boffa <gcboffa@cisco.com>
Signed-off-by: Gian Carlo Boffa <gcboffa@cisco.com>
Co-developed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Signed-off-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Co-developed-by: Arun Easi <aeasi@cisco.com>
Signed-off-by: Arun Easi <aeasi@cisco.com>
Co-developed-by: Karan Tilak Kumar <kartilak@cisco.com>
Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
Link: https://lore.kernel.org/r/20241212020312.4786-8-kartilak@cisco.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: fnic: Add Cisco hardware model names
Karan Tilak Kumar [Thu, 12 Dec 2024 02:03:03 +0000 (18:03 -0800)] 
scsi: fnic: Add Cisco hardware model names

Add model IDs for Cisco VIC.

Reviewed-by: Sesidhar Baddela <sebaddel@cisco.com>
Co-developed-by: Gian Carlo Boffa <gcboffa@cisco.com>
Signed-off-by: Gian Carlo Boffa <gcboffa@cisco.com>
Co-developed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Signed-off-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Co-developed-by: Arun Easi <aeasi@cisco.com>
Signed-off-by: Arun Easi <aeasi@cisco.com>
Co-developed-by: Karan Tilak Kumar <kartilak@cisco.com>
Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
Link: https://lore.kernel.org/r/20241212020312.4786-7-kartilak@cisco.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: fnic: Add support for unsolicited requests and responses
Karan Tilak Kumar [Thu, 12 Dec 2024 02:03:02 +0000 (18:03 -0800)] 
scsi: fnic: Add support for unsolicited requests and responses

Add support for unsolicited requests and responses.

Add support to accept and reject frames.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202409291705.MugERX98-lkp@intel.com/
Reviewed-by: Sesidhar Baddela <sebaddel@cisco.com>
Co-developed-by: Gian Carlo Boffa <gcboffa@cisco.com>
Signed-off-by: Gian Carlo Boffa <gcboffa@cisco.com>
Co-developed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Signed-off-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Co-developed-by: Arun Easi <aeasi@cisco.com>
Signed-off-by: Arun Easi <aeasi@cisco.com>
Co-developed-by: Karan Tilak Kumar <kartilak@cisco.com>
Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
Link: https://lore.kernel.org/r/20241212020312.4786-6-kartilak@cisco.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: fnic: Add support for target based solicited requests and responses
Karan Tilak Kumar [Thu, 12 Dec 2024 02:03:01 +0000 (18:03 -0800)] 
scsi: fnic: Add support for target based solicited requests and responses

Add support for target based solicited requests and responses.

Add support for tport definitions and processing.

Add support for restarting the IT nexus.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202406120146.xchlZbqX-lkp@intel.com/
Closes: https://lore.kernel.org/oe-kbuild-all/202412081427.SlsFIJY4-lkp@intel.com/
Reviewed-by: Sesidhar Baddela <sebaddel@cisco.com>
Co-developed-by: Gian Carlo Boffa <gcboffa@cisco.com>
Signed-off-by: Gian Carlo Boffa <gcboffa@cisco.com>
Co-developed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Signed-off-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Co-developed-by: Arun Easi <aeasi@cisco.com>
Signed-off-by: Arun Easi <aeasi@cisco.com>
Co-developed-by: Karan Tilak Kumar <kartilak@cisco.com>
Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
Link: https://lore.kernel.org/r/20241212020312.4786-5-kartilak@cisco.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: fnic: Add support for fabric based solicited requests and responses
Karan Tilak Kumar [Thu, 12 Dec 2024 02:03:00 +0000 (18:03 -0800)] 
scsi: fnic: Add support for fabric based solicited requests and responses

Add fdls_disc.c to support fabric based solicited requests and responses.

Clean up obsolete code but keep the function template so as to not break
compilation.

Remove duplicate definitions from header files.

Modify definitions of data members.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202406112309.8GiDUvIM-lkp@intel.com/
Closes: https://lore.kernel.org/oe-kbuild-all/202406120201.VakI9Dly-lkp@intel.com/
Closes: https://lore.kernel.org/oe-kbuild-all/202412080837.2JU0r2Ny-lkp@intel.com/
Reviewed-by: Sesidhar Baddela <sebaddel@cisco.com>
Co-developed-by: Gian Carlo Boffa <gcboffa@cisco.com>
Signed-off-by: Gian Carlo Boffa <gcboffa@cisco.com>
Co-developed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Signed-off-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Co-developed-by: Arun Easi <aeasi@cisco.com>
Signed-off-by: Arun Easi <aeasi@cisco.com>
Co-developed-by: Karan Tilak Kumar <kartilak@cisco.com>
Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
Link: https://lore.kernel.org/r/20241212020312.4786-4-kartilak@cisco.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: fnic: Add headers and definitions for FDLS
Karan Tilak Kumar [Thu, 12 Dec 2024 02:02:59 +0000 (18:02 -0800)] 
scsi: fnic: Add headers and definitions for FDLS

Add headers and definitions for FDLS (Fabric Discovery and Login Services).

Reviewed-by: Sesidhar Baddela <sebaddel@cisco.com>
Co-developed-by: Gian Carlo Boffa <gcboffa@cisco.com>
Signed-off-by: Gian Carlo Boffa <gcboffa@cisco.com>
Co-developed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Signed-off-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Co-developed-by: Arun Easi <aeasi@cisco.com>
Signed-off-by: Arun Easi <aeasi@cisco.com>
Co-developed-by: Karan Tilak Kumar <kartilak@cisco.com>
Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
Link: https://lore.kernel.org/r/20241212020312.4786-3-kartilak@cisco.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: fnic: Replace shost_printk() with dev_info()/dev_err()
Karan Tilak Kumar [Thu, 12 Dec 2024 02:02:58 +0000 (18:02 -0800)] 
scsi: fnic: Replace shost_printk() with dev_info()/dev_err()

Sending host information to shost_printk() prior to host initialization in
fnic is unnecessary. Replace shost_printk() and a printk() prior to this
initialization with dev_info() and dev_err() accordingly.

Reviewed-by: Sesidhar Baddela <sebaddel@cisco.com>
Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Reviewed-by: Gian Carlo Boffa <gcboffa@cisco.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
Link: https://lore.kernel.org/r/20241212020312.4786-2-kartilak@cisco.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: scsi_debug: Skip host/bus reset settle delay
Bart Van Assche [Mon, 16 Dec 2024 18:48:52 +0000 (10:48 -0800)] 
scsi: scsi_debug: Skip host/bus reset settle delay

Skip the reset settle delay during error handling since the scsi_debug
driver doesn't need this delay.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20241216184852.2626339-1-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoMerge patch series "scsi: Constify 'struct bin_attribute'"
Martin K. Petersen [Thu, 2 Jan 2025 20:08:42 +0000 (15:08 -0500)] 
Merge patch series "scsi: Constify 'struct bin_attribute'"

Thomas Weißschuh <linux@weissschuh.net> says:

The sysfs core now allows instances of 'struct bin_attribute' to be
moved into read-only memory. Make use of that to protect them against
accidental or malicious modifications.

Link: https://lore.kernel.org/r/20241216-sysfs-const-bin_attr-scsi-v1-0-f0a5e54b3437@weissschuh.net
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: qla4xxx: Constify 'struct bin_attribute'
Thomas Weißschuh [Mon, 16 Dec 2024 11:29:18 +0000 (12:29 +0100)] 
scsi: qla4xxx: Constify 'struct bin_attribute'

The sysfs core now allows instances of 'struct bin_attribute' to be moved
into read-only memory. Make use of that to protect them against accidental
or malicious modifications.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20241216-sysfs-const-bin_attr-scsi-v1-11-f0a5e54b3437@weissschuh.net
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: qla2xxx: Constify 'struct bin_attribute'
Thomas Weißschuh [Mon, 16 Dec 2024 11:29:17 +0000 (12:29 +0100)] 
scsi: qla2xxx: Constify 'struct bin_attribute'

The sysfs core now allows instances of 'struct bin_attribute' to be moved
into read-only memory. Make use of that to protect them against accidental
or malicious modifications.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20241216-sysfs-const-bin_attr-scsi-v1-10-f0a5e54b3437@weissschuh.net
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: qedi: Constify 'struct bin_attribute'
Thomas Weißschuh [Mon, 16 Dec 2024 11:29:16 +0000 (12:29 +0100)] 
scsi: qedi: Constify 'struct bin_attribute'

The sysfs core now allows instances of 'struct bin_attribute' to be moved
into read-only memory. Make use of that to protect them against accidental
or malicious modifications.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20241216-sysfs-const-bin_attr-scsi-v1-9-f0a5e54b3437@weissschuh.net
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: qedf: Constify 'struct bin_attribute'
Thomas Weißschuh [Mon, 16 Dec 2024 11:29:15 +0000 (12:29 +0100)] 
scsi: qedf: Constify 'struct bin_attribute'

The sysfs core now allows instances of 'struct bin_attribute' to be moved
into read-only memory. Make use of that to protect them against accidental
or malicious modifications.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20241216-sysfs-const-bin_attr-scsi-v1-8-f0a5e54b3437@weissschuh.net
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: ipr: Constify 'struct bin_attribute'
Thomas Weißschuh [Mon, 16 Dec 2024 11:29:14 +0000 (12:29 +0100)] 
scsi: ipr: Constify 'struct bin_attribute'

The sysfs core now allows instances of 'struct bin_attribute' to be moved
into read-only memory. Make use of that to protect them against accidental
or malicious modifications.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20241216-sysfs-const-bin_attr-scsi-v1-7-f0a5e54b3437@weissschuh.net
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: lpfc: Constify 'struct bin_attribute'
Thomas Weißschuh [Mon, 16 Dec 2024 11:29:13 +0000 (12:29 +0100)] 
scsi: lpfc: Constify 'struct bin_attribute'

The sysfs core now allows instances of 'struct bin_attribute' to be moved
into read-only memory. Make use of that to protect them against accidental
or malicious modifications.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20241216-sysfs-const-bin_attr-scsi-v1-6-f0a5e54b3437@weissschuh.net
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: ibmvfc: Constify 'struct bin_attribute'
Thomas Weißschuh [Mon, 16 Dec 2024 11:29:12 +0000 (12:29 +0100)] 
scsi: ibmvfc: Constify 'struct bin_attribute'

The sysfs core now allows instances of 'struct bin_attribute' to be moved
into read-only memory. Make use of that to protect them against accidental
or malicious modifications.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20241216-sysfs-const-bin_attr-scsi-v1-5-f0a5e54b3437@weissschuh.net
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: esas2r: Constify 'struct bin_attribute'
Thomas Weißschuh [Mon, 16 Dec 2024 11:29:11 +0000 (12:29 +0100)] 
scsi: esas2r: Constify 'struct bin_attribute'

The sysfs core now allows instances of 'struct bin_attribute' to be moved
into read-only memory. Make use of that to protect them against accidental
or malicious modifications.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20241216-sysfs-const-bin_attr-scsi-v1-4-f0a5e54b3437@weissschuh.net
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: arcmsr: Constify 'struct bin_attribute'
Thomas Weißschuh [Mon, 16 Dec 2024 11:29:10 +0000 (12:29 +0100)] 
scsi: arcmsr: Constify 'struct bin_attribute'

The sysfs core now allows instances of 'struct bin_attribute' to be moved
into read-only memory. Make use of that to protect them against accidental
or malicious modifications.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20241216-sysfs-const-bin_attr-scsi-v1-3-f0a5e54b3437@weissschuh.net
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: 3w-sas: Constify 'struct bin_attribute'
Thomas Weißschuh [Mon, 16 Dec 2024 11:29:09 +0000 (12:29 +0100)] 
scsi: 3w-sas: Constify 'struct bin_attribute'

The sysfs core now allows instances of 'struct bin_attribute' to be moved
into read-only memory. Make use of that to protect them against accidental
or malicious modifications.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20241216-sysfs-const-bin_attr-scsi-v1-2-f0a5e54b3437@weissschuh.net
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: core: Constify 'struct bin_attribute'
Thomas Weißschuh [Mon, 16 Dec 2024 11:29:08 +0000 (12:29 +0100)] 
scsi: core: Constify 'struct bin_attribute'

The sysfs core now allows instances of 'struct bin_attribute' to be moved
into read-only memory. Make use of that to protect them against accidental
or malicious modifications.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20241216-sysfs-const-bin_attr-scsi-v1-1-f0a5e54b3437@weissschuh.net
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoMerge patch series "Update lpfc to revision 14.4.0.7"
Martin K. Petersen [Thu, 2 Jan 2025 20:02:19 +0000 (15:02 -0500)] 
Merge patch series "Update lpfc to revision 14.4.0.7"

Justin Tee <justintee8345@gmail.com> says:

Update lpfc to revision 14.4.0.7

This patch set contains fixes related to smatch, clean up of obsolete code
and global spinlocks, changes to ADISC and LS_RJT handling, and support for
large fw object reads used in proprietary applications.

The patches were cut against Martin's 6.14/scsi-queue tree.

Link: https://lore.kernel.org/r/20241212233309.71356-1-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: lpfc: Copyright updates for 14.4.0.7 patches
Justin Tee [Thu, 12 Dec 2024 23:33:09 +0000 (15:33 -0800)] 
scsi: lpfc: Copyright updates for 14.4.0.7 patches

Update copyrights to 2024 for files modified in the 14.4.0.7 patch set.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20241212233309.71356-11-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: lpfc: Update lpfc version to 14.4.0.7
Justin Tee [Thu, 12 Dec 2024 23:33:08 +0000 (15:33 -0800)] 
scsi: lpfc: Update lpfc version to 14.4.0.7

Update lpfc version to 14.4.0.7

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20241212233309.71356-10-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: lpfc: Add support for large fw object application layer reads
Justin Tee [Thu, 12 Dec 2024 23:33:07 +0000 (15:33 -0800)] 
scsi: lpfc: Add support for large fw object application layer reads

Current lpfc bsg implementation allows a maximum fw read object size of
30KB.  Implementation and support for read object mailbox commands for fw
objects larger than 30KB are now required for proprietary applications.

Thus, update the lpfc_sli_config_emb0_subsys structure and its associated
submission and completion paths to accommodate for an alternative form of
read object command that supports large fw objects.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20241212233309.71356-9-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: lpfc: Update definition of firmware configuration mbox cmds
Justin Tee [Thu, 12 Dec 2024 23:33:06 +0000 (15:33 -0800)] 
scsi: lpfc: Update definition of firmware configuration mbox cmds

There are unused fields in mailbox commands that query for firmware
configuration information.  As such, update the struct definitions by
correcting the name of certain fields and removing the unused fields.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20241212233309.71356-8-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: lpfc: Change lpfc_nodelist save_flags member into a bitmask
Justin Tee [Thu, 12 Dec 2024 23:33:05 +0000 (15:33 -0800)] 
scsi: lpfc: Change lpfc_nodelist save_flags member into a bitmask

In attempt to reduce the amount of unnecessary ndlp->lock acquisitions in
the lpfc driver, change save_flags into an unsigned long bitmask and use
clear_bit/test_bit bitwise atomic APIs instead of reliance on ndlp->lock
for synchronization.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20241212233309.71356-7-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: lpfc: Add handling for LS_RJT reason explanation authentication required
Justin Tee [Thu, 12 Dec 2024 23:33:04 +0000 (15:33 -0800)] 
scsi: lpfc: Add handling for LS_RJT reason explanation authentication required

When a LS_RJT is received with reason explanation authentication required,
current driver logic is to retry the PLOGI up to 48 times.  In the worse
case scenario, 48 retries can take longer than dev_loss_tmo and if there is
an RSCN received indicating an authentication requirement change, the
driver may miss processing it.  Fix by adding logic to specifically handle
reason explanation authentication required and set the max retry count to 8
times.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20241212233309.71356-6-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: lpfc: Modify handling of ADISC based on ndlp state and RPI registration
Justin Tee [Thu, 12 Dec 2024 23:33:03 +0000 (15:33 -0800)] 
scsi: lpfc: Modify handling of ADISC based on ndlp state and RPI registration

In lpfc_check_adisc, remove the requirement that the ndlp object must have
been RPI registered.  Whether or not the ndlp is RPI registered is
unrelated to verifying that the received ADISC is intended for that ndlp
rport object.

After ADISC receipt, there's no need to put the ndlp state into NPR.  Let
the cmpl routines from the actions taken earlier in ADISC handling set the
proper ndlp state.

Also, refactor when a RESUME_RPI mailbox command should be sent.  It should
only be sent if the RPI registered flag is set.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20241212233309.71356-5-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: lpfc: Delete NLP_TARGET_REMOVE flag due to obsolete usage
Justin Tee [Thu, 12 Dec 2024 23:33:02 +0000 (15:33 -0800)] 
scsi: lpfc: Delete NLP_TARGET_REMOVE flag due to obsolete usage

Remove the NLP_TARGET_REMOVE flag as its usage is obsolete.  The current
framework is to rely on the lpfc_dev_loss_tmo_callbk from upper layer to
notify final ndlp kref release.  There's no need to specifically set
NLP_EVT_DEVICE_RM when a LOGO completes.  The dev_loss_tmo_callbk is
responsible for the final kref put.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20241212233309.71356-4-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: lpfc: Restrict the REG_FCFI MAM field to FCoE adapters only
Justin Tee [Thu, 12 Dec 2024 23:33:01 +0000 (15:33 -0800)] 
scsi: lpfc: Restrict the REG_FCFI MAM field to FCoE adapters only

Qualify setting the REG_FCFI MAM field to FCoE adapters only by keying off
HBA_FCOE_MODE phba->hba_flag.  The field is not applicable to FC adapters.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20241212233309.71356-3-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: lpfc: Redefine incorrect type in lpfc_create_device_data()
Justin Tee [Thu, 12 Dec 2024 23:33:00 +0000 (15:33 -0800)] 
scsi: lpfc: Redefine incorrect type in lpfc_create_device_data()

Fix smatch warning by redefining local variable memory_flags from int to
gfp_t.

lpfc_scsi.c: warning: incorrect type in argument 2 (different base types)
lpfc_scsi.c:    expected restricted gfp_t [usertype] gfp_mask
lpfc_scsi.c:    got int memory_flags

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20241212233309.71356-2-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: myrb: Remove dead code
Ariel Otilibili [Fri, 13 Dec 2024 22:57:29 +0000 (23:57 +0100)] 
scsi: myrb: Remove dead code

* reported by Coverity ID 1602240
* ldev_info is always true, therefore the branch statement is never called.

Fixes: 081ff398c56c ("scsi: myrb: Add Mylex RAID controller (block interface)")
Cc: Hannes Reinecke <hare@kernel.org>
Cc: James E.J. Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Ariel Otilibili <ariel.otilibili-anieli@eurecom.fr>
Link: https://lore.kernel.org/r/20241213225852.62741-2-ariel.otilibili-anieli@eurecom.fr
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: mpt3sas: Set ioc->manu_pg11.EEDPTagMode directly to 1
Paul Menzel [Thu, 12 Dec 2024 22:18:12 +0000 (23:18 +0100)] 
scsi: mpt3sas: Set ioc->manu_pg11.EEDPTagMode directly to 1

Currently, the code does:

    if (x == 0) {
     x &= ~0x3;
x |= 0x1;
    }

Zeroing bits 0 and 1 of a variable that is 0 is not necessary. So directly
set the variable to 1.

Cc: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Fixes: f92363d12359 ("[SCSI] mpt3sas: add new driver supporting 12GB SAS")
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
Link: https://lore.kernel.org/r/20241212221817.78940-2-pmenzel@molgen.mpg.de
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: mpt3sas: Add details to EEDPTagMode error message
Paul Menzel [Thu, 12 Dec 2024 22:18:11 +0000 (23:18 +0100)] 
scsi: mpt3sas: Add details to EEDPTagMode error message

Linux 5.15 logs the error below

    mpt3sas_cm0: overriding NVDATA EEDPTagMode setting

on a Dell PowerEdge T440 with the card below.

    5e:00.0 Serial Attached SCSI controller [0107]: Broadcom / LSI SAS3008 PCI-Express Fusion-MPT SAS-3 [1000:0097] (rev 02)

It’s not clear to a user what this error is about. As a first step to
improve this, add the values to the error message.

Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
Link: https://lore.kernel.org/r/20241212221817.78940-1-pmenzel@molgen.mpg.de
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: esp: Fix variable typo
Siddharth Menon [Tue, 10 Dec 2024 04:02:02 +0000 (09:32 +0530)] 
scsi: esp: Fix variable typo

Renamed ESP_CONGIG4_TEST to ESP_CONFIG4_TEST

Signed-off-by: Siddharth Menon <simeddon@gmail.com>
Link: https://lore.kernel.org/r/20241210040202.11112-1-simeddon@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: ufs: crypto: Remove ufs_hba_variant_ops::program_key
Eric Biggers [Fri, 13 Dec 2024 04:19:47 +0000 (20:19 -0800)] 
scsi: ufs: crypto: Remove ufs_hba_variant_ops::program_key

There are no longer any implementations of
ufs_hba_variant_ops::program_key, so remove it.

As a result, ufshcd_program_key() no longer can return an error, so also
clean it up to return void.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Link: https://lore.kernel.org/r/20241213041958.202565-5-ebiggers@kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: ufs: qcom: Convert to use UFSHCD_QUIRK_CUSTOM_CRYPTO_PROFILE
Eric Biggers [Fri, 13 Dec 2024 04:19:46 +0000 (20:19 -0800)] 
scsi: ufs: qcom: Convert to use UFSHCD_QUIRK_CUSTOM_CRYPTO_PROFILE

By default the UFS core is responsible for initializing the
blk_crypto_profile, but Qualcomm platforms have their own way of
programming and evicting crypto keys.  So currently
ufs_hba_variant_ops::program_key is used to redirect control flow from
ufshcd_program_key().  This has worked until now, but it's a bit of a hack,
given that the key (and algorithm ID etc.) ends up being converted from
blk_crypto_key => ufs_crypto_cfg_entry => SCM call parameters, where the
intermediate ufs_crypto_cfg_entry step is unnecessary.  Taking a similar
approach with the upcoming wrapped key support, the implementation of which
is similarly platform-specific, would require adding four new methods to
ufs_hba_variant_ops, changing program_key to take the struct
blk_crypto_key, and adding a new UFSHCD_CAP_* flag to indicate support for
wrapped keys.

This patch takes a different approach.  It changes ufs-qcom to use the
existing UFSHCD_QUIRK_CUSTOM_CRYPTO_PROFILE which was recently added for
ufs-exynos.  This allows it to override the full blk_crypto_profile,
eliminating the need for the existing ufs_hba_variant_ops::program_key and
the hooks that would have been needed for wrapped key support.  It does
require a bit of duplicated code to read the crypto capability registers,
but it's worth the simplification in design with ufs-qcom and ufs-exynos
now using the same method to customize the crypto profile, and it makes it
much easier to add wrapped key support.

Tested-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> # sm8650
Signed-off-by: Eric Biggers <ebiggers@google.com>
Link: https://lore.kernel.org/r/20241213041958.202565-4-ebiggers@kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: ufs: crypto: Add ufs_hba_from_crypto_profile()
Eric Biggers [Fri, 13 Dec 2024 04:19:45 +0000 (20:19 -0800)] 
scsi: ufs: crypto: Add ufs_hba_from_crypto_profile()

Add a helper function that encapsulates a container_of expression.  For now
there are two users but soon there will be more.

Tested-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> # sm8650
Signed-off-by: Eric Biggers <ebiggers@google.com>
Link: https://lore.kernel.org/r/20241213041958.202565-3-ebiggers@kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: ufs: qcom: Fix crypto key eviction
Eric Biggers [Tue, 10 Dec 2024 03:08:39 +0000 (19:08 -0800)] 
scsi: ufs: qcom: Fix crypto key eviction

Commit 56541c7c4468 ("scsi: ufs: ufs-qcom: Switch to the new ICE API")
introduced an incorrect check of the algorithm ID into the key eviction
path, and thus qcom_ice_evict_key() is no longer ever called.  Fix it.

Fixes: 56541c7c4468 ("scsi: ufs: ufs-qcom: Switch to the new ICE API")
Cc: stable@vger.kernel.org
Cc: Abel Vesa <abel.vesa@linaro.org>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Link: https://lore.kernel.org/r/20241210030839.1118805-1-ebiggers@kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: isci: Remove unused isci_remote_device_reset_complete()
Dr. David Alan Gilbert [Mon, 23 Dec 2024 18:02:18 +0000 (18:02 +0000)] 
scsi: isci: Remove unused isci_remote_device_reset_complete()

isci_remote_device_reset_complete() last use was removed in 2012 by commit
14aaa9f0a318 ("isci: Redesign device suspension, abort, cleanup.")

Remove it.

It was the last user of sci_remote_device_reset_complete().

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Link: https://lore.kernel.org/r/20241223180218.50426-1-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: iscsi: Remove unused iscsi_create_session()
Dr. David Alan Gilbert [Mon, 23 Dec 2024 18:01:10 +0000 (18:01 +0000)] 
scsi: iscsi: Remove unused iscsi_create_session()

iscsi_create_session() last use was removed in 2008 by commit 756135215ec7
("[SCSI] iscsi: remove session and host binding in libiscsi")

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Link: https://lore.kernel.org/r/20241223180110.50266-1-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: target: Remove unused functions
Dr. David Alan Gilbert [Sun, 22 Dec 2024 21:35:24 +0000 (21:35 +0000)] 
scsi: target: Remove unused functions

The functions:

  iscsit_check_unsolicited_dataout()
  iscsit_fail_session()
  iscsit_create_conn_recovery_datain_values()
  iscsit_create_conn_recovery_dataout_values()
  iscsit_tpg_dump_params()
  iscsit_print_session_params()

were all added in 2011 by commit e48354ce078c ("iscsi-target: Add iSCSI
fabric support for target v4.1") but have remained unused.

Remove them.

Having deleted them, the functions:

  iscsi_print_params()
  iscsi_dump_conn_ops()
  iscsi_dump_sess_ops()

are also unused.

Remove them.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Link: https://lore.kernel.org/r/20241222213524.270735-1-linux@treblig.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: documentation: scsi_eh: updates for EH changes
Randy Dunlap [Thu, 19 Dec 2024 21:49:28 +0000 (13:49 -0800)] 
scsi: documentation: scsi_eh: updates for EH changes

SCSI_SOFTIRQ and scsi_softirq() are no longer used. Change to block layer
equivalents.

scsi_setup_cmd_retry() has been deleted. Remove references to it.

SCSI_EH_CANCEL_CMD has been deleted. Remove references to it.

scsi_eh_abort_cmds() has been deleted. Remove references to it.

[mkp: fixed START STOP UNIT]

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/r/20241219214928.1170302-1-rdunlap@infradead.org
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: linux-doc@vger.kernel.org
Cc: James E.J. Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: ufs: qcom: Power down the controller/device during system suspend for SM8550...
Manivannan Sadhasivam [Thu, 19 Dec 2024 16:50:44 +0000 (22:20 +0530)] 
scsi: ufs: qcom: Power down the controller/device during system suspend for SM8550/SM8650 SoCs

SM8550 and SM8650 SoCs doesn't support UFS PHY retention. So once these SoCs
reaches the low power state (CX power collapse) during system suspend, all
the PHY hardware state gets lost. This leads to the UFS resume failure:

  ufshcd-qcom 1d84000.ufs: ufshcd_uic_hibern8_exit: hibern8 exit failed. ret = 5
  ufshcd-qcom 1d84000.ufs: __ufshcd_wl_resume: hibern8 exit failed 5
  ufs_device_wlun 0:0:0:49488: ufshcd_wl_resume failed: 5
  ufs_device_wlun 0:0:0:49488: PM: dpm_run_callback(): scsi_bus_resume+0x0/0x84 returns 5
  ufs_device_wlun 0:0:0:49488: PM: failed to resume async: error 5

With the default system suspend level of UFS_PM_LVL_3, the power domain for
UFS PHY needs to be kept always ON to retain the state. But this would
prevent these SoCs from reaching the CX power collapse state, leading to
poor power saving during system suspend.

So to fix this issue without affecting the power saving, set
'ufs_qcom_drvdata::no_phy_retention' to true which sets 'hba->spm_lvl' to
UFS_PM_LVL_5 to allow both the controller and device (in turn the PHY) to be
powered down during system suspend for these SoCs by default.

Cc: stable@vger.kernel.org # 6.3
Fixes: 35cf1aaab169 ("arm64: dts: qcom: sm8550: Add UFS host controller and phy nodes")
Fixes: 10e024671295 ("arm64: dts: qcom: sm8650: add interconnect dependent device nodes")
Reported-by: Neil Armstrong <neil.armstrong@linaro.org>
Tested-by: Amit Pundir <amit.pundir@linaro.org> # on SM8550-HDK
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Link: https://lore.kernel.org/r/20241219-ufs-qcom-suspend-fix-v3-4-63c4b95a70b9@linaro.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: ufs: qcom: Allow passing platform specific OF data
Manivannan Sadhasivam [Thu, 19 Dec 2024 16:50:43 +0000 (22:20 +0530)] 
scsi: ufs: qcom: Allow passing platform specific OF data

In order to allow platform specific flags and configurations, introduce the
platform specific OF data and move the existing quirk
UFSHCD_QUIRK_BROKEN_LSDBS_CAP for SM8550 and SM8650 SoCs.

Reviewed-by: Avri Altman <avri.altman@wdc.com>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Tested-by: Amit Pundir <amit.pundir@linaro.org> # on SM8550-HDK
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Link: https://lore.kernel.org/r/20241219-ufs-qcom-suspend-fix-v3-3-63c4b95a70b9@linaro.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: ufs: core: Honor runtime/system PM levels if set by host controller drivers
Manivannan Sadhasivam [Thu, 19 Dec 2024 16:50:42 +0000 (22:20 +0530)] 
scsi: ufs: core: Honor runtime/system PM levels if set by host controller drivers

Otherwise, the default levels will override the levels set by the host
controller drivers.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Link: https://lore.kernel.org/r/20241219-ufs-qcom-suspend-fix-v3-2-63c4b95a70b9@linaro.org
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: ufs: qcom: Power off the PHY if it was already powered on in ufs_qcom_power_up_...
Manivannan Sadhasivam [Thu, 19 Dec 2024 16:50:41 +0000 (22:20 +0530)] 
scsi: ufs: qcom: Power off the PHY if it was already powered on in ufs_qcom_power_up_sequence()

PHY might already be powered on during ufs_qcom_power_up_sequence() in a
couple of cases:

 1. During UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH quirk

 2. Resuming from spm_lvl = 5 suspend

In those cases, it is necessary to call phy_power_off() and phy_exit() in
ufs_qcom_power_up_sequence() function to power off the PHY before calling
phy_init() and phy_power_on().

Case (1) is doing it via ufs_qcom_reinit_notify() callback, but case (2) is
not handled. So to satisfy both cases, call phy_power_off() and phy_exit()
if the phy_count is non-zero. And with this change, the reinit_notify()
callback is no longer needed.

This fixes the below UFS resume failure with spm_lvl = 5:

ufshcd-qcom 1d84000.ufshc: Enabling the controller failed
ufshcd-qcom 1d84000.ufshc: Enabling the controller failed
ufshcd-qcom 1d84000.ufshc: Enabling the controller failed
ufshcd-qcom 1d84000.ufshc: ufshcd_host_reset_and_restore: Host init failed -5
ufshcd-qcom 1d84000.ufshc: Enabling the controller failed
ufshcd-qcom 1d84000.ufshc: Enabling the controller failed
ufshcd-qcom 1d84000.ufshc: Enabling the controller failed
ufshcd-qcom 1d84000.ufshc: ufshcd_host_reset_and_restore: Host init failed -5
ufshcd-qcom 1d84000.ufshc: Enabling the controller failed
ufshcd-qcom 1d84000.ufshc: Enabling the controller failed
ufshcd-qcom 1d84000.ufshc: Enabling the controller failed
ufshcd-qcom 1d84000.ufshc: ufshcd_host_reset_and_restore: Host init failed -5
ufshcd-qcom 1d84000.ufshc: Enabling the controller failed
ufshcd-qcom 1d84000.ufshc: Enabling the controller failed
ufshcd-qcom 1d84000.ufshc: Enabling the controller failed
ufshcd-qcom 1d84000.ufshc: ufshcd_host_reset_and_restore: Host init failed -5
ufshcd-qcom 1d84000.ufshc: Enabling the controller failed
ufshcd-qcom 1d84000.ufshc: Enabling the controller failed
ufshcd-qcom 1d84000.ufshc: Enabling the controller failed
ufshcd-qcom 1d84000.ufshc: ufshcd_host_reset_and_restore: Host init failed -5
ufs_device_wlun 0:0:0:49488: ufshcd_wl_resume failed: -5
ufs_device_wlun 0:0:0:49488: PM: dpm_run_callback(): scsi_bus_resume returns -5
ufs_device_wlun 0:0:0:49488: PM: failed to resume async: error -5

Cc: stable@vger.kernel.org # 6.3
Fixes: baf5ddac90dc ("scsi: ufs: ufs-qcom: Add support for reinitializing the UFS device")
Reported-by: Ram Kumar Dwivedi <quic_rdwivedi@quicinc.com>
Tested-by: Amit Pundir <amit.pundir@linaro.org> # on SM8550-HDK
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Link: https://lore.kernel.org/r/20241219-ufs-qcom-suspend-fix-v3-1-63c4b95a70b9@linaro.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: qedi: Use kthread_create_on_cpu()
Frederic Weisbecker [Wed, 11 Dec 2024 15:40:18 +0000 (16:40 +0100)] 
scsi: qedi: Use kthread_create_on_cpu()

Use the proper API instead of open coding it.

However it looks like qedi_percpu_io_thread() kthread could be replaced by
the use of a high prio workqueue instead.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Link: https://lore.kernel.org/r/20241211154035.75565-6-frederic@kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: bnx2i: Use kthread_create_on_cpu()
Frederic Weisbecker [Wed, 11 Dec 2024 15:40:17 +0000 (16:40 +0100)] 
scsi: bnx2i: Use kthread_create_on_cpu()

Use the proper API instead of open coding it.

However it looks like bnx2i_percpu_io_thread() kthread could be replaced by
the use of a high prio workqueue instead.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Link: https://lore.kernel.org/r/20241211154035.75565-5-frederic@kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: bnx2fc: Use kthread_create_on_cpu()
Frederic Weisbecker [Wed, 11 Dec 2024 15:40:16 +0000 (16:40 +0100)] 
scsi: bnx2fc: Use kthread_create_on_cpu()

Use the proper API instead of open coding it.

However it looks like bnx2fc_percpu_io_thread() kthread could be replaced
by the use of a high prio workqueue instead.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Link: https://lore.kernel.org/r/20241211154035.75565-4-frederic@kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
6 months agoscsi: MAINTAINERS: Remove myself as isci driver maintainer
Artur Paszkiewicz [Tue, 10 Dec 2024 11:30:28 +0000 (12:30 +0100)] 
scsi: MAINTAINERS: Remove myself as isci driver maintainer

I'm leaving Intel and I could not find a new maintainer for this so mark it
as orphan.

Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Link: https://lore.kernel.org/r/20241210113028.13810-1-artur.paszkiewicz@intel.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 months agoscsi: Constify struct pci_device_id
Christophe JAILLET [Sat, 7 Dec 2024 16:48:28 +0000 (17:48 +0100)] 
scsi: Constify struct pci_device_id

'struct pci_device_id' is not modified in these drivers.

Constifying this structure moves some data to a read-only section, so
increase overall security.

On a x86_64, with allmodconfig, as an example:
Before:
======
   text    data     bss     dec     hex filename
  70237    9137     320   79694   1374e drivers/scsi/3w-9xxx.o

After:
=====
   text    data     bss     dec     hex filename
  70461    8913     320   79694   1374e drivers/scsi/3w-9xxx.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/fc61b1946488c1ea8f7a17a06cf40fbd05dcc6de.1733590049.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 months agoscsi: storvsc: Don't assume cpu_possible_mask is dense
Michael Kelley [Thu, 3 Oct 2024 03:53:32 +0000 (20:53 -0700)] 
scsi: storvsc: Don't assume cpu_possible_mask is dense

Current code allocates the stor_chns array with size num_possible_cpus().
This code assumes cpu_possible_mask is dense, which is not true in the
general case per [1]. If cpu_possible_mask is sparse, the array might be
indexed by a value beyond the size of the array.

However, the configurations that Hyper-V provides to guest VMs on x86 and
ARM64 hardware, in combination with how architecture specific code assigns
Linux CPU numbers, *does* always produce a dense cpu_possible_mask.  So the
dense assumption is not currently causing failures. But for robustness
against future changes in how cpu_possible_mask is populated, update the
code to no longer assume dense.

The correct approach is to allocate and initialize the array using size
"nr_cpu_ids". While this leaves unused array entries corresponding to holes
in cpu_possible_mask, the holes are assumed to be minimal and hence the
amount of memory wasted by unused entries is minimal.

[1] https://lore.kernel.org/lkml/SN6PR02MB4157210CC36B2593F8572E5ED4692@SN6PR02MB4157.namprd02.prod.outlook.com/

Signed-off-by: Michael Kelley <mhklinux@outlook.com>
Link: https://lore.kernel.org/r/20241003035333.49261-5-mhklinux@outlook.com
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 months agoscsi: MAINTAINERS: Update zfcp entry
Steffen Maier [Thu, 5 Dec 2024 14:19:32 +0000 (15:19 +0100)] 
scsi: MAINTAINERS: Update zfcp entry

Nihar takes over the zfcp maintainer work. Update the MAINTAINERS entry
accordingly.

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Acked-by: Steffen Maier <maier@linux.ibm.com>
Acked-by: Benjamin Block <bblock@linux.ibm.com>
Acked-by: Nihar Panda <niharp@linux.ibm.com>
Signed-off-by: Nihar Panda <niharp@linux.ibm.com>
Link: https://lore.kernel.org/r/20241205141932.1227039-4-niharp@linux.ibm.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 months agoscsi: zfcp: Clarify zfcp_port refcount ownership during "link" test
Steffen Maier [Thu, 5 Dec 2024 14:19:31 +0000 (15:19 +0100)] 
scsi: zfcp: Clarify zfcp_port refcount ownership during "link" test

Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Signed-off-by: Nihar Panda <niharp@linux.ibm.com>
Link: https://lore.kernel.org/r/20241205141932.1227039-3-niharp@linux.ibm.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 months agoscsi: zfcp: Correct kdoc parameter description for sending ELS and CT
Fedor Loshakov [Thu, 5 Dec 2024 14:19:30 +0000 (15:19 +0100)] 
scsi: zfcp: Correct kdoc parameter description for sending ELS and CT

Since commit 7c7dc196814b ("[SCSI] zfcp: Simplify handling of ct and els
requests") there are no more such structures as zfcp_send_els and
zfcp_send_ct. Instead there is now one common fsf structure to hold zfcp
data for ct and els requests. Fix parameter description for
zfcp_fsf_send_ct() and zfcp_fsf_send_els() accordingly.

Signed-off-by: Fedor Loshakov <loshakov@linux.ibm.com>
Reviewed-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Nihar Panda <niharp@linux.ibm.com>
Link: https://lore.kernel.org/r/20241205141932.1227039-2-niharp@linux.ibm.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 months agoscsi: Eliminate scsi_register() and scsi_unregister() usage & docs
Randy Dunlap [Thu, 5 Dec 2024 04:18:39 +0000 (20:18 -0800)] 
scsi: Eliminate scsi_register() and scsi_unregister() usage & docs

scsi_mid_low_api.rst refers to scsi_register() and scsi_unregister() but
these functions don't exist. They have been replaced by more meaningful
names.

Update one driver (megaraid_mbox.c) that uses "scsi_unregister" in a
warning message. Update scsi_mid_low_api.rst to eliminate references to
scsi_register() and scsi_unregister().

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/r/20241205041839.164404-1-rdunlap@infradead.org
Cc: James E.J. Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: Bart Van Assche <bvanassche@acm.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: linux-doc@vger.kernel.org
Cc: Kashyap Desai <kashyap.desai@broadcom.com>
Cc: Sumit Saxena <sumit.saxena@broadcom.com>
Cc: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Cc: Chandrakanth patil <chandrakanth.patil@broadcom.com>
Cc: megaraidlinux.pdl@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 months agoscsi: docs: Remove init_this_scsi_driver()
Randy Dunlap [Thu, 5 Dec 2024 03:13:07 +0000 (19:13 -0800)] 
scsi: docs: Remove init_this_scsi_driver()

Finish removing mention of init_this_scsi_driver() that was removed ages
ago.

Fixes: 83c9f08e6c6a ("scsi: remove the old scsi_module.c initialization model")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/r/20241205031307.130441-1-rdunlap@infradead.org
Cc: Christoph Hellwig <hch@lst.de>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: James E.J. Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: linux-doc@vger.kernel.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 months agoscsi: ufs: core: Update compl_time_stamp_local_clock after completing a cqe
liuderong [Fri, 6 Dec 2024 07:29:42 +0000 (15:29 +0800)] 
scsi: ufs: core: Update compl_time_stamp_local_clock after completing a cqe

lrbp->compl_time_stamp_local_clock is set to zero after sending a sqe
but it is not updated after completing a cqe.  Thus the printed
information in ufshcd_print_tr() will always be zero.

Update lrbp->cmpl_time_stamp_local_clock after completing a cqe.

Log sample:

ufshcd-qcom 1d84000.ufshc: UPIU[8] - issue time 8750227249 us
ufshcd-qcom 1d84000.ufshc: UPIU[8] - complete time 0 us

Fixes: c30d8d010b5e ("scsi: ufs: core: Prepare for completion in MCQ")
Reviewed-by: Bean Huo <beanhuo@micron.com>
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: liuderong <liuderong@oppo.com>
Link: https://lore.kernel.org/r/1733470182-220841-1-git-send-email-liuderong@oppo.com
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 months agoscsi: ufs: core: Do not hold any lock in ufshcd_hba_stop()
Avri Altman [Thu, 28 Nov 2024 07:25:42 +0000 (09:25 +0200)] 
scsi: ufs: core: Do not hold any lock in ufshcd_hba_stop()

This change is motivated by Bart's suggestion in [1], which enables to
further reduce the SCSI host lock usage in the UFS driver. The reason why
it makes sense, because although the legacy interrupt is disabled by some
but not all ufshcd_hba_stop() callers, it is safe to nest disable_irq()
calls as it checks the irq depth.

[1] https://lore.kernel.org/linux-scsi/c58e4fce-0a74-4469-ad16-f1edbd670728@acm.org/

Suggested-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Avri Altman <avri.altman@wdc.com>
Link: https://lore.kernel.org/r/20241128072542.219170-1-avri.altman@wdc.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 months agoMerge patch series "Replace the "slave_*" function names"
Martin K. Petersen [Wed, 4 Dec 2024 21:54:10 +0000 (16:54 -0500)] 
Merge patch series "Replace the "slave_*" function names"

Bart Van Assche <bvanassche@acm.org> says:

Hi Martin,

The text "slave_" in multiple function names does not make it clear what
the purpose of these functions is. Hence this patch series that renames all
SCSI functions that have the word "slave" in their function name. Please
consider this patch series for the next merge window.

Thanks,

Bart.

Link: https://lore.kernel.org/r/20241022180839.2712439-1-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 months agoscsi: core: Update API documentation
Bart Van Assche [Tue, 22 Oct 2024 18:07:57 +0000 (11:07 -0700)] 
scsi: core: Update API documentation

Since the .slave_alloc(), .slave_destroy() and .slave_configure() methods
have been renamed in struct scsi_host_template, also rename these in the
API documentation.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20241022180839.2712439-6-bvanassche@acm.org
Reviewed-by: Damien Le Maol <dlemoal@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 months agoscsi: core: Remove the .slave_configure() method
Bart Van Assche [Tue, 22 Oct 2024 18:07:56 +0000 (11:07 -0700)] 
scsi: core: Remove the .slave_configure() method

Now that all SCSI drivers have been converted from .slave_configure() to
.sdev_configure(), remove support for .slave_configure() from the SCSI
core.

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20241022180839.2712439-5-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
7 months agoscsi: Convert SCSI drivers to .sdev_configure()
Bart Van Assche [Tue, 22 Oct 2024 18:07:55 +0000 (11:07 -0700)] 
scsi: Convert SCSI drivers to .sdev_configure()

The only difference between the .sdev_configure() and .slave_configure()
methods is that the former accepts an additional 'limits' argument.
Convert all SCSI drivers that define a .slave_configure() method to
.sdev_configure(). This patch prepares for removing the
.slave_configure() method. No functionality has been changed.

Acked-by: Geoff Levand <geoff@infradead.org> # for ps3rom
Acked-by: Khalid Aziz <khalid@gonehiking.org> # for the BusLogic driver
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20241022180839.2712439-4-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>