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.
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.
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>
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>
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.
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:
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.
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>
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>
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.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
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.
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>
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>
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:
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>
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>
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>
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.
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>
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>
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>
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>
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>
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.
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.
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.
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>